PIPS
plfonct-eco.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
#include "contrainte.h"
#include "sc.h"
#include "sommet.h"
#include "matrix.h"
#include "plint.h"
+ Include dependency graph for plfonct-eco.c:

Go to the source code of this file.

Macros

#define MALLOC(s, t, f)   malloc((unsigned)(s))
 package plint More...
 

Functions

Psommet fonct_init ()
 
Psommet fonct_min (int nbvars, Pbase b)
 RGSUSED. More...
 
Psommet fonct_max (int nbvars, Pbase b)
 
Psommet fonct_min_all (int nbvars, Pbase b)
 
Psommet fonct_max_all (int nbvars, Pbase b)
 
Psommet fonct_min_d (int nbvars, Pbase b)
 RGSUSED. More...
 
Psommet fonct_max_d (int nbvars, Pbase b)
 RGSUSED. More...
 
Psommet fonct_read (int nbvars, Pbase b)
 

Macro Definition Documentation

◆ MALLOC

#define MALLOC (   s,
  t,
  f 
)    malloc((unsigned)(s))

package plint

Definition at line 45 of file plfonct-eco.c.

Function Documentation

◆ fonct_init()

Psommet fonct_init ( )

Definition at line 53 of file plfonct-eco.c.

54 {
55  Psommet fonct_eco;
56 
57 #ifdef TRACE
58  printf(" ** creation fonction economique de base \n");
59 #endif
60  fonct_eco = sommet_new();
61  fonct_eco->denominateur =VALUE_ONE;
62  fonct_eco->eq_sat = (int *)MALLOC(sizeof(int),INTEGER,"fonct_init");
63  *(fonct_eco->eq_sat) = 0;
64  return (fonct_eco);
65 }
#define VALUE_ONE
#define MALLOC(s, t, f)
package plint
Definition: plfonct-eco.c:45
int printf()
Psommet sommet_new()
Creation d'un sommet
Definition: sommet.c:51
structure de donnees Sommet
Definition: sommet-local.h:64
int * eq_sat
Definition: sommet-local.h:65
Value denominateur
Definition: sommet-local.h:67

References typ_som::denominateur, typ_som::eq_sat, MALLOC, printf(), sommet_new(), and VALUE_ONE.

Referenced by find_eg().

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

◆ fonct_max()

Psommet fonct_max ( int  nbvars,
Pbase  b 
)

Definition at line 93 of file plfonct-eco.c.

96 {
97  Psommet fonct_eco;
98 
99  fonct_eco = sommet_new();
100  fonct_eco->denominateur = VALUE_ONE;
101  fonct_eco->vecteur = vect_new(vecteur_var(b),VALUE_MONE);
102  fonct_eco->eq_sat = (int *)MALLOC(sizeof(int),INTEGER,"fonct_max");
103  *(fonct_eco->eq_sat) = 0;
104  return (fonct_eco);
105 }
#define VALUE_MONE
Pvecteur vecteur
Definition: sommet-local.h:66
#define vecteur_var(v)
Pvecteur vect_new(Variable var, Value coeff)
Pvecteur vect_new(Variable var,Value coeff): allocation d'un vecteur colineaire au vecteur de base va...
Definition: alloc.c:110

References typ_som::denominateur, typ_som::eq_sat, MALLOC, sommet_new(), VALUE_MONE, VALUE_ONE, vect_new(), typ_som::vecteur, and vecteur_var.

+ Here is the call graph for this function:

◆ fonct_max_all()

Psommet fonct_max_all ( int  nbvars,
Pbase  b 
)

Definition at line 155 of file plfonct-eco.c.

158 {
159  Psommet fonct_eco;
160  Pvecteur pv = VECTEUR_NUL;
161 #ifdef TRACE
162  printf(" ** creation fonction economique \n");
163 #endif
164  fonct_eco =sommet_new();
165  fonct_eco->denominateur = VALUE_ONE;
166  fonct_eco->vecteur = vect_new(vecteur_var(b),VALUE_MONE);
167  for (pv= b->succ;!VECTEUR_NUL_P(pv);pv=pv->succ)
168  vect_add_elem (&(fonct_eco->vecteur),vecteur_var(pv),VALUE_MONE);
169  fonct_eco->eq_sat = (int *)MALLOC(sizeof(int),
170  INTEGER,"fonct_max_all");
171  *(fonct_eco->eq_sat) = 0;
172  return (fonct_eco);
173 }
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
struct Svecteur * succ
Definition: vecteur-local.h:92
#define VECTEUR_NUL
DEFINITION DU VECTEUR NUL.
#define VECTEUR_NUL_P(v)
void vect_add_elem(Pvecteur *pvect, Variable var, Value val)
void vect_add_elem(Pvecteur * pvect, Variable var, Value val): addition d'un vecteur colineaire au ve...
Definition: unaires.c:72

References typ_som::denominateur, typ_som::eq_sat, MALLOC, printf(), sommet_new(), Svecteur::succ, VALUE_MONE, VALUE_ONE, vect_add_elem(), vect_new(), typ_som::vecteur, VECTEUR_NUL, VECTEUR_NUL_P, and vecteur_var.

+ Here is the call graph for this function:

◆ fonct_max_d()

Psommet fonct_max_d ( int  nbvars,
Pbase  b 
)

RGSUSED.

Definition at line 212 of file plfonct-eco.c.

215 {
216  Psommet fonct_eco;
217 
218  fonct_eco =sommet_new();
219  fonct_eco->denominateur = VALUE_ONE;
220  fonct_eco->vecteur = vect_new(vecteur_var(b),VALUE_MONE);
221  vect_add_elem(&(fonct_eco->vecteur),vecteur_var(b->succ),VALUE_ONE);
222  fonct_eco->eq_sat = (int *)MALLOC(sizeof(int),INTEGER,"fonct_max_d");
223  *(fonct_eco->eq_sat) = 0;
224  return (fonct_eco);
225 }

References typ_som::denominateur, typ_som::eq_sat, MALLOC, sommet_new(), Svecteur::succ, VALUE_MONE, VALUE_ONE, vect_add_elem(), vect_new(), typ_som::vecteur, and vecteur_var.

+ Here is the call graph for this function:

◆ fonct_min()

Psommet fonct_min ( int  nbvars,
Pbase  b 
)

RGSUSED.

Definition at line 78 of file plfonct-eco.c.

81 {
82  Psommet fonct_eco;
83 
84  fonct_eco = sommet_new();
85  fonct_eco->denominateur = VALUE_ONE;
86  fonct_eco->vecteur = vect_new(vecteur_var(b),VALUE_ONE);
87  fonct_eco->eq_sat = (int *)MALLOC(sizeof(int),INTEGER,"fonct_min");
88  *(fonct_eco->eq_sat) = 0;
89  return (fonct_eco);
90 }

References typ_som::denominateur, typ_som::eq_sat, MALLOC, sommet_new(), VALUE_ONE, vect_new(), typ_som::vecteur, and vecteur_var.

Referenced by sys_int_fais().

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

◆ fonct_min_all()

Psommet fonct_min_all ( int  nbvars,
Pbase  b 
)

Definition at line 120 of file plfonct-eco.c.

123 {
124  Psommet fonct_eco;
125  register int i=0;
126  Pvecteur pv;
127 
128 #ifdef TRACE
129  printf(" ** creation fonction economique \n");
130 #endif
131  fonct_eco =sommet_new();
132  fonct_eco->denominateur = VALUE_ONE;
133  fonct_eco->vecteur = vect_new(vecteur_var(b),VALUE_ONE);
134  for (i = 1, pv= b->succ;i< nbvars && !VECTEUR_NUL_P(pv); i++, pv=pv->succ)
135  vect_add_elem (&(fonct_eco->vecteur),vecteur_var(pv),VALUE_ONE);
136 
137  fonct_eco->eq_sat = (int *)MALLOC(sizeof(int),
138  INTEGER,"fonct_min_all");
139  *(fonct_eco->eq_sat) = 0;
140  return (fonct_eco);
141 }

References typ_som::denominateur, typ_som::eq_sat, MALLOC, printf(), sommet_new(), Svecteur::succ, VALUE_ONE, vect_add_elem(), vect_new(), typ_som::vecteur, VECTEUR_NUL_P, and vecteur_var.

+ Here is the call graph for this function:

◆ fonct_min_d()

Psommet fonct_min_d ( int  nbvars,
Pbase  b 
)

RGSUSED.

Definition at line 187 of file plfonct-eco.c.

190 {
191  Psommet fonct_eco;
192 
193  fonct_eco =sommet_new();
194  fonct_eco->denominateur = VALUE_ONE;
195  fonct_eco->vecteur = vect_new(vecteur_var(b),VALUE_ONE);
196  vect_add_elem(&(fonct_eco->vecteur),vecteur_var(b->succ),VALUE_MONE);
197  fonct_eco->eq_sat = (int *)MALLOC(sizeof(int),INTEGER,"fonct_min_d");
198  *(fonct_eco->eq_sat) = 0;
199  return (fonct_eco);
200 }

References typ_som::denominateur, typ_som::eq_sat, MALLOC, sommet_new(), Svecteur::succ, VALUE_MONE, VALUE_ONE, vect_add_elem(), vect_new(), typ_som::vecteur, and vecteur_var.

+ Here is the call graph for this function:

◆ fonct_read()

Psommet fonct_read ( int  nbvars,
Pbase  b 
)

Definition at line 236 of file plfonct-eco.c.

239 {
240  Psommet fonct_eco;
241  register int i=0;
242  Value d;
243 Pvecteur pv;
244 
245  fonct_eco =sommet_new();
246  fonct_eco->denominateur = VALUE_ONE;
247  printf (" *** creation d'une fonction economique \n");
248  printf (" pour la premiere variable : 1 ou -1 ");
249  scan_Value(&d);
250  fonct_eco->vecteur = vect_new(vecteur_var(b),d);
251  for (i = 1 ,pv= b->succ;i< nbvars && !VECTEUR_NUL_P(pv);
252  i++,pv=pv->succ)
253  {
254  printf (" pour l'indice %d : 1 ou -1 ",i+1);
255  scan_Value(&d);
256  vect_add_elem (&(fonct_eco->vecteur),vecteur_var(pv),d);
257  }
258  printf ("\n");
259 
260  fonct_eco->eq_sat = (int *)MALLOC(sizeof(int),INTEGER,"fonct_read");
261  *(fonct_eco->eq_sat) = 0;
262  return (fonct_eco);
263 }
int Value
int scan_Value(Value *)
Definition: io.c:63

References typ_som::denominateur, typ_som::eq_sat, MALLOC, printf(), scan_Value(), sommet_new(), Svecteur::succ, VALUE_ONE, vect_add_elem(), vect_new(), typ_som::vecteur, VECTEUR_NUL_P, and vecteur_var.

+ Here is the call graph for this function: