PIPS
simp.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 simp.c:

Go to the source code of this file.

Functions

static void test_system (Psysteme sc)
 test du simplex : ce test s'appelle par : programme fichier1.data fichier2.data ... More...
 
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 80 of file simp.c.

81 {
82  /* Programme de test de faisabilite'
83  * d'un ensemble d'equations et d'inequations.
84  */
85  FILE * f1;
86  int i; /* compte les systemes, chacun dans un fichier */
87 
89 
90  /* lecture et test de la faisabilite' de systemes sur fichiers */
91 
92  if(argc>=2)
93  {
94  for(i=1;i<argc;i++)
95  {
96  if((f1 = fopen(argv[i],"r")) == NULL) {
97  fprintf(stdout,"Ouverture fichier %s impossible\n", argv[i]);
98  exit(4);
99  }
100  test_file(f1, argv[i]);
101  fclose(f1) ;
102  }
103  }
104  else
105  {
106  test_file(stdin, "standard input");
107  }
108  exit(0) ;
109 }
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 ...
static void test_file(FILE *f, char *name)
Definition: simp.c:60

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 60 of file simp.c.

61 {
62  Psysteme sc=sc_new();
63  printf("systeme initial \n");
64  if(sc_fscan(f,&sc))
65  {
66  printf("syntaxe correcte dans %s\n",name);
67  sc_fprint(stdout, sc, *variable_default_name);
68  printf("Nb_eq %d , Nb_ineq %d, dimension %d\n",
69  sc->nb_eq, sc->nb_ineq, sc->dimension) ;
70  test_system(sc);
71  }
72  else
73  {
74  fprintf(stderr,"erreur syntaxe dans %s\n",name);
75  exit(1);
76  }
77 }
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()
static void test_system(Psysteme sc)
test du simplex : ce test s'appelle par : programme fichier1.data fichier2.data .....
Definition: simp.c:49
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

test du simplex : ce test s'appelle par : programme fichier1.data fichier2.data ...

fichiern.data ou bien : programme<fichier.data Si on compile grace a` "make sim" dans le directory /home/users/pips/C3/Linear/Development/polyedre.dir/test.dir alors on peut tester l'execution dans le meme directory en faisant : tests|more

Definition at line 49 of file simp.c.

50 {
52  fprintf(stdout, "*** Arithmetic error occured in simplex\n");
53  TRY
54  if (sc_simplexe_feasibility_ofl_ctrl(sc,FWD_OFL_CTRL))
55  printf("Systeme faisable (soluble) en rationnels\n") ;
56  else
57  printf("Systeme insoluble\n");
58 }
#define CATCH(what)
@ overflow_error
#define TRY
#define FWD_OFL_CTRL

References CATCH, fprintf(), FWD_OFL_CTRL, overflow_error, printf(), and TRY.

Referenced by test_file().

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