PIPS
feasability.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include "boolean.h"
#include "linear_assert.h"
#include "arithmetique.h"
#include "vecteur.h"
#include "contrainte.h"
#include "sc.h"
+ Include dependency graph for feasability.c:

Go to the source code of this file.

Functions

static void test_system (Psysteme sc)
 
static void test_file (FILE *f, char *name)
 
int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[] 
)

Programme de test de faisabilite' d'un ensemble d'equations et d'inequations.

compte les systemes, chacun dans un fichier

lecture et test de la faisabilite' de systemes sur fichiers

Definition at line 72 of file feasability.c.

73 {
74  /* Programme de test de faisabilite'
75  * d'un ensemble d'equations et d'inequations.
76  */
77  FILE * f1;
78  int i; /* compte les systemes, chacun dans un fichier */
79 
81 
82  /* lecture et test de la faisabilite' de systemes sur fichiers */
83 
84  if(argc>=2)
85  {
86  for(i=1;i<argc;i++)
87  {
88  if((f1 = fopen(argv[i],"r")) == NULL) {
89  fprintf(stdout,"Ouverture fichier %s impossible\n", argv[i]);
90  exit(4);
91  }
92  test_file(f1, argv[i]);
93  fclose(f1) ;
94  }
95  }
96  else
97  {
98  test_file(stdin, "standard input");
99  }
100  exit(0) ;
101 }
static void test_file(FILE *f, char *name)
Definition: feasability.c:52
char * variable_default_name(Variable v)
char * variable_default_name(Variable v): returns the name of variable v
Definition: variable.c:81
#define exit(code)
Definition: misc-local.h:54
void initialize_sc(char *(*var_to_string)(Variable))
Definition: sc_debug.c:253
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References exit, fprintf(), initialize_sc(), test_file(), and variable_default_name().

+ Here is the call graph for this function:

◆ test_file()

static void test_file ( FILE *  f,
char *  name 
)
static

Definition at line 52 of file feasability.c.

53 {
54  Psysteme sc=sc_new();
55  printf("systeme initial \n");
56  if(sc_fscan(f,&sc))
57  {
58  printf("syntaxe correcte dans %s\n",name);
59  sc_fprint(stdout, sc, *variable_default_name);
60  printf("Nb_eq %d , Nb_ineq %d, dimension %d\n",
61  sc->nb_eq, sc->nb_ineq, sc->dimension) ;
62  test_system(sc);
63  }
64  else
65  {
66  fprintf(stderr,"erreur syntaxe dans %s\n",name);
67  exit(1);
68  }
69 }
static void test_system(Psysteme sc)
Definition: feasability.c:40
int f(int off1, int off2, int n, float r[n], float a[n], float b[n])
Definition: offsets.c:15
Psysteme sc_new(void)
Psysteme sc_new(): alloue un systeme vide, initialise tous les champs avec des valeurs nulles,...
Definition: sc_alloc.c:55
void sc_fprint(FILE *fp, Psysteme ps, get_variable_name_t nom_var)
void sc_fprint(FILE * f, Psysteme ps, char * (*nom_var)()): cette fonction imprime dans le fichier po...
Definition: sc_io.c:220
bool sc_fscan(FILE *f, Psysteme *ps)
bool sc_fscan(FILE * f, Psysteme * ps): construit un systeme d'inegalites et d'egalites lineaires a p...
Definition: sc_io.c:121
int printf()
int dimension
Definition: sc-local.h:74
int nb_ineq
Definition: sc-local.h:73
int nb_eq
Definition: sc-local.h:72

References Ssysteme::dimension, exit, f(), fprintf(), Ssysteme::nb_eq, Ssysteme::nb_ineq, printf(), sc_fprint(), sc_fscan(), sc_new(), test_system(), and variable_default_name().

Referenced by main().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ test_system()

static void test_system ( Psysteme  sc)
static

Definition at line 40 of file feasability.c.

41 {
43  fprintf(stdout, "*** Arithmetic error occured in simplex\n");
44  TRY
45  if (sc_feasibility_ofl_ctrl(sc, false, OFL_CTRL, true))
46  printf("Systeme faisable (soluble) en rationnels\n") ;
47  else
48  printf("Systeme insoluble\n");
49 }
#define CATCH(what)
@ overflow_error
#define TRY
bool sc_feasibility_ofl_ctrl(Psysteme sc, bool integer_p, volatile int ofl_ctrl, volatile bool ofl_res)
return true is the system is feasible
#define OFL_CTRL
I do thing that overflows are managed in a very poor manner.

References CATCH, fprintf(), OFL_CTRL, overflow_error, printf(), sc_feasibility_ofl_ctrl(), and TRY.

Referenced by test_file().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: