PIPS
sc_projection.c
Go to the documentation of this file.
1 /*
2 
3  $Id: sc_projection.c 1671 2019-06-26 19:14:11Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of Linear/C3 Library.
8 
9  Linear/C3 Library is free software: you can redistribute it and/or modify it
10  under the terms of the GNU Lesser General Public License as published by
11  the Free Software Foundation, either version 3 of the License, or
12  any later version.
13 
14  Linear/C3 Library is distributed in the hope that it will be useful, but WITHOUT ANY
15  WARRANTY; without even the implied warranty of MERCHANTABILITY or
16  FITNESS FOR A PARTICULAR PURPOSE.
17 
18  See the GNU Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public License
21  along with Linear/C3 Library. If not, see <http://www.gnu.org/licenses/>.
22 
23 */
24 
25 /* Package systeme de contraintes (SC) : sc_projection.c
26  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
27  *
28  * Projection of a system of constraints (equalities and inequalities)
29  * along one or several variables. The variables are always eliminated,
30  * even if the projection is not exact, i.e. introduces integer points
31  * that do not belong to the projections of the initial integer points.
32  *
33  * Arguments of these functions :
34  *
35  * - s or sc is the system of constraints.
36  *
37  * - ofl_ctrl is the way overflow errors are handled
38  *
39  * ofl_ctrl == NO_OFL_CTRL
40  * -> overflow errors are not handled
41  *
42  * ofl_ctrl == OFL_CTRL
43  * -> overflow errors are handled in the called function
44  * (not often available, check first!)
45  *
46  * ofl_ctrl == FWD_OFL_CTRL
47  * -> overflow errors must be handled by the calling function
48  *
49  * Comments :
50  *
51  * The base of the Psysteme is not always updated. Check the comments at the
52  * head of each function for more details.
53  *
54  * In the functions that update the base, there is an assert if the variables
55  * that are eliminated do not belong to the base.
56  *
57  * No attempt is made at speeding the projection when many variables
58  * are projected simultaneously. The projection could be speeded up
59  * when all variables used in the constraints are projected and when
60  * all variables projected are used in convex components not related
61  * to the preserved variables. In the later case, the convex
62  * components must be checked for emptiness. The system decomposition
63  * in convex components is performed by function xyz... (see Beatrice
64  * Creusillet)
65  *
66  * Authors :
67  *
68  * Remi Triolet, Malik Imadache, Francois Irigoin, Yi-Qing Yang,
69  * Corinne Ancourt, Be'atrice Creusillet, Fabien Coelho, Duong Nguyen,
70  * Serge Guelton.
71  *
72  */
73 
74 #ifdef HAVE_CONFIG_H
75  #include "config.h"
76 #endif
77 
78 #include <stdio.h>
79 #include <stdlib.h>
80 #include "linear_assert.h"
81 #include <string.h>
82 
83 #include "boolean.h"
84 #include "arithmetique.h"
85 #include "vecteur.h"
86 #include "contrainte.h"
87 #include "sc.h"
88 
89 #include <signal.h>
90 
91 #define EXCEPTION_PRINT_PROJECTION true
92 
93 // Duong Nguyen: constants used to filter out the most complicated
94 // systems of constraints
95 #ifdef FILTERING
96 
97 #define FILTERING_DIMENSION_PROJECTION filtering_dimension_projection
98 #define FILTERING_NUMBER_CONSTRAINTS_PROJECTION filtering_number_constraints_projection
99 #define FILTERING_DENSITY_PROJECTION filtering_density_projection
100 #define FILTERING_MAGNITUDE_PROJECTION (Value) filtering_magnitude_projection
101 
102 #define FILTERING_TIMEOUT_PROJECTION filtering_timeout_projection
103 
104 static bool PROJECTION_timeout = false;
105 
106 static void
107 catch_alarm_projection (int sig)
108 {
109  alarm(0); /*clear the alarm*/
110  PROJECTION_timeout = true;
111 }
112 #endif
113 
114 /* void sc_projection_along_variable_ofl_ctrl(Psysteme *psc, Variable v,
115  * int ofl_ctrl)
116  * input : the systeme to project, a variable along which the projection
117  * will be performed.
118  * output : the projected system. If it is not feasible, returns
119  * sc_empty(initial_base).
120  * modifies : sc
121  * comment :
122  * The base of *psc is not updated.
123  * It is not even checked if the variable belongs to the base.
124  *
125  * The case ofl_ctrl == OFL_CTRL is not handled, because
126  * the user may want an SC_UNDEFINED, or an sc_empty(sc->base)
127  * or an sc_rn(sc->base) as a result. It is not homogeneous.
128  *
129  * projection d'un systeme sc selon une var v
130  * et expansion virtuelle en un cylindre d'axe v.
131  *
132  * Modifications:
133  *
134  * - ajout de la normalisation de l'equation eq avant les substitutions;
135  * cette normalisation permet de detecter une equation infaisable; le
136  * probleme a ete mis en evidence par Yi-Qing dans le test de dependance
137  * de Linear/C3 Library pour T(2*i+4*j) vs T(2*i+2*j+1) donnant 2*j + 2*di + 2*dj + 1 =0;
138  * la projection de j faisait perdre la non-faisabilite; Francois Irigoin,
139  * 8 novembre 1991
140  *
141  * - Added timeout control in
142  * sc_fourier_motzkin_variable_elimination_ofl_ctrl. Better use
143  * sc_projection_along_variable_ofl_ctrl_timeout_ctrl. Duong Nguyen
144  * 29/10/2002
145  */
146 void sc_projection_along_variable_ofl_ctrl(psc, v, ofl_ctrl)
147 Psysteme volatile *psc;
148 Variable v;
149 int ofl_ctrl;
150 {
151 
152  Pcontrainte eq;
153  Value coeff;
154 
155  /* trouver une egalite ou v a un coeff. minimal en valeur absolu */
156  eq = contrainte_var_min_coeff((*psc)->egalites, v, &coeff, false);
157 
158  if (eq != NULL) {
159  if(!egalite_normalize(eq)) {
160  Psysteme new_psc = sc_empty((*psc)->base);
161  (*psc)->base = BASE_UNDEFINED;
162  sc_rm(*psc);
163  *psc = new_psc;
164  return;
165  }
166  else
167  {
168  /* si au moins une egalite contient v avec un coeff. non nul */
169  *psc = sc_variable_substitution_with_eq_ofl_ctrl
170  (*psc,eq,v, ofl_ctrl);
171  }
172  }
173  else {
174  bool fm_int_exact_p;
175  /* v n'apparait dans aucune egalite, il faut l'eliminer des inegalites
176  par des combinaisons (fonction combiner) */
177 
178  fm_int_exact_p =
179  sc_fourier_motzkin_variable_elimination_ofl_ctrl(*psc, v, false,
180  false, ofl_ctrl);
181  if (fm_int_exact_p == false) {
182  /* detection de la non faisabilite du Psysteme */
183  Psysteme new_psc = sc_empty((*psc)->base);
184  (*psc)->base = BASE_UNDEFINED;
185  sc_rm(*psc);
186  *psc = new_psc;
187  return;
188  }
189  (*psc)->nb_ineq = nb_elems_list((*psc)->inegalites);
190  }
191 
192 }
193 
194 
195 
196 /* void sc_and_base_projection_along_variable_ofl_ctrl(Psysteme psc,Variable v)
197  * input : a Psysteme to project along the input variable.
198  * output : nothing.
199  * modifies : the initial Psysteme and its base.
200  * comment : The initial system is projected along the variable, which is then
201  * eliminated from the base. assert if the variable does not belong to
202  * the base.
203  */
204 void sc_and_base_projection_along_variable_ofl_ctrl(psc,v, ofl_ctrl)
205 Psysteme volatile *psc;
206 Variable v;
207 int ofl_ctrl;
208 {
209  sc_projection_along_variable_ofl_ctrl(psc,v,ofl_ctrl);
210  sc_base_remove_variable(*psc,v);
211 }
212 
213 
214 
215 
216 /* void sc_projection_ofl_along_variables(Psysteme *psc, Pvecteur pv)
217  * input : a system of constraints, and a vector of variables.
218  * output : a system of contraints, resulting of the successive projection
219  * of the initial system along each variable of pv.
220  * modifies : *psc.
221  * comment : it is very different from
222  * sc_projection_with_test_along_variables_ofl_ctrl.
223  * sc_empty is returned if the system is not feasible (BC).
224  * The base of *psc is updated. assert if one of the variable
225  * does not belong to the base.
226  * The case ofl_ctrl == OFL_CTRL is not handled, because
227  * the user may want an SC_UNDEFINED, or an sc_empty(sc->base)
228  * or an sc_rn(sc->base) as a result. It is not homogeneous.
229  */
230 void sc_projection_along_variables_ofl_ctrl(psc, pv, ofl_ctrl)
231 Psysteme *psc;
232 Pvecteur pv;
233 int ofl_ctrl;
234 {
235  Pvecteur pv1;
236 
237  if (!VECTEUR_NUL_P(pv)) {
238  for (pv1 = pv;!VECTEUR_NUL_P(pv1) && !SC_UNDEFINED_P(*psc); pv1=pv1->succ) {
239 
240  sc_projection_along_variable_ofl_ctrl(psc,vecteur_var(pv1),
241  ofl_ctrl);
242  if (!SC_UNDEFINED_P(*psc)) {
244  (void) sc_nredund(psc);
245  }
246  }
247  }
248 
249 }
250 
251 
252 /* void sc_projection_with_test_along_variables_ofl_ctrl(Psysteme *psc,
253  * Pvecteur pv,
254  * bool *is_proj_exact)
255  * input : the systeme to project along the variables of the vector pv.
256  * *is_proj_exact is supposed to be initialized.
257  * output : nothing.
258  * modifies : *is_proj_exact is set to false if the projection is not exact.
259  * comment : The initial systeme is successively projected along
260  * all the variables of pv, even if the projection is not exact.
261  * The projection is done first by eliminating variables in the
262  * part of equations (the variables which coefficient is 1 are
263  * considered before : in such case an integer elimination is
264  * performed, and the projection is exact); the rest is projected
265  * using Fourier-Motzkin, with a test to know if the projection
266  * is exact.
267  *
268  * The case ofl_ctrl == OFL_CTRL is not handled, because
269  * the user may want an SC_UNDEFINED, or an sc_empty(sc->base)
270  * or an sc_rn(sc->base) as a result. It is not homogeneous.
271  */
272 void sc_projection_along_variables_with_test_ofl_ctrl(psc, pv, is_proj_exact,
273  ofl_ctrl)
274 Psysteme *psc;
275 Pvecteur pv;
276 bool *is_proj_exact; /* this bool is supposed to be initialized */
277 int ofl_ctrl;
278 {
279  Pcontrainte eq;
280  Pvecteur current_pv, pve, pvr;
281  Variable v;
282  Value coeff;
283  Psysteme sc = *psc;
284 
285  pve = vect_copy(pv);
286 
287  /* elimination of variables with the equations of sc */
288 
289  if (pve != NULL && sc->nb_eq != 0 && !sc_empty_p(sc)) {
290  /* first carry out integer elimination when possible */
291 
292  pvr = NULL;
293  current_pv = pve;
294 
295  while (!VECTEUR_NUL_P(current_pv) &&
296  (sc->nb_eq != 0) && !sc_empty_p(sc)) {
297  v = current_pv->var;
298  eq = eq_v_min_coeff(sc->egalites, v, &coeff);
299  if ((eq == NULL) || (value_notone_p(coeff))) {
300  pvr = current_pv;
301  current_pv = current_pv->succ;
302  }
303  else {
304  /* the coefficient of v in eq is 1 : carry out integer
305  * elimination for v with the other constraints of sc */
306 
307  sc = sc_variable_substitution_with_eq_ofl_ctrl
308  (sc, eq, v, ofl_ctrl);
309 
310  if (sc_empty_p(sc))
311  break;
312 
313  sc = sc_normalize(sc);
314 
315  if (sc_empty_p(sc))
316  break;
317 
318  /* v has been eliminated : remove it from pve */
319  if (pvr == NULL) /* v is the fisrt */
320  pve = current_pv = current_pv->succ;
321  else
322  pvr->succ = current_pv = current_pv->succ;
323 
324  } /* if-else */
325  } /* while */
326 
327  } /* if */
328 
329 
330  /* carry out non-exact elimination if necessary and possible */
331  if (pve != NULL && sc->nb_eq != 0 && !sc_empty_p(sc)) {
332  /* first carry out integer elimination when possible */
333 
334  pvr = NULL;
335  current_pv = pve;
336 
337  while (!VECTEUR_NUL_P(current_pv) &&
338  (sc->nb_eq != 0) && !sc_empty_p(sc)) {
339 
340  v = current_pv->var;
341  eq = eq_v_min_coeff(sc->egalites, v, &coeff);
342  if (eq == NULL) {
343  pvr = current_pv;
344  current_pv = current_pv->succ;
345  }
346  else {
347  /* elimination for v with the constraints of sc other than eq*/
348 
349  if (*is_proj_exact) *is_proj_exact = false;
350 
351  sc = sc_variable_substitution_with_eq_ofl_ctrl
352  (sc, eq, v, ofl_ctrl);
353 
354  sc = sc_normalize(sc);
355  if (sc_empty_p(sc))
356  break;
357 
358  /* v has been eliminated : remove it from pve */
359  if (pvr == NULL) /* v is the fisrt */
360  pve = current_pv = current_pv->succ;
361  else
362  pvr->succ = current_pv = current_pv->succ;
363 
364  } /* if-else */
365  } /* while */
366 
367  } /* if */
368 
369  /* carry out the elimination of Fourier-Motzkin for the remaining variables */
370  if (pve != NULL && !sc_empty_p(sc)) {
371  Pbase base_sc = base_copy(sc->base);
372 
373  current_pv = pve;
374  while (current_pv != NULL) {
375  v = current_pv->var;
376 
377  if (! sc_fourier_motzkin_variable_elimination_ofl_ctrl(sc, v, true,
378  is_proj_exact,
379  ofl_ctrl))
380  {
381  /* sc_rm(sc); ???????? BC ??????? */
382  sc = sc_empty(base_sc);
383  base_sc = NULL;
384  break;
385  }
386 
387  sc = sc_normalize(sc);
388  if (sc_empty_p(sc))
389  break;
390  current_pv = current_pv->succ;
391 
392  } /* while */
393  if (base_sc != NULL) base_rm(base_sc);
394 
395  } /* if */
396 
397  sc->nb_ineq = nb_elems_list(sc->inegalites);
398  sc->nb_eq = nb_elems_list(sc->egalites);
399 
400  for(current_pv = pv; current_pv != NULL; current_pv = current_pv->succ) {
401  v = current_pv->var;
403  }
404 
405  vect_rm(pve);
406  *psc = sc;
407 }
408 
409 
410 
411 
412 
413 /* Psysteme sc_variable_substitution_with_eq_ofl_ctrl(Psysteme sc, Pcontrainte eq,
414  * Variable v, int ofl_ctrl)
415  * input : a system of contraints sc, a contraint eq that must belong to sc,
416  * and a variable v that appears in the constraint eq.
417  * output : a Psysteme which is the projection of sc along v using the equation
418  * eq.
419  * modifies : sc.
420  * comment : The case ofl_ctrl == OFL_CTRL is not handled, because it would
421  * have no sense here.
422  */
423 Psysteme sc_variable_substitution_with_eq_ofl_ctrl(sc, eq, v, ofl_ctrl)
424 Psysteme sc;
426 Variable v;
427 int ofl_ctrl;
428 {
429  Pcontrainte pr;
430  Pcontrainte current_eq;
431 
432  pr = NULL;
433  current_eq = sc->egalites;
434  while(current_eq != NULL)
435  {
436  /* eq must be removed from the list of equalities of sc */
437  if(current_eq == eq)
438  {
439  if (pr == NULL){ /* eq is at the head of the list */
440  sc->egalites = current_eq = current_eq->succ;
441  }
442  else
443  {
444  pr->succ = current_eq = current_eq->succ;
445  }
446  }
447  else
448  {
449  switch (contrainte_subst_ofl_ctrl(v, eq, current_eq, true, ofl_ctrl))
450  {
451  case 0 :
452  {
453  /* the substitution found that the system is not feasible */
454  Psysteme new_sc = sc_empty(sc->base);
455  sc->base=BASE_UNDEFINED;
456  sc_rm(sc);
457  sc = new_sc;
458  eq = contrainte_free(eq);
459  return(sc);
460  break;
461  }
462 
463  case -1 : {
464  /* the substitution created a trivial equation (0==0)
465  * which must be eliminated */
466  Pcontrainte pc = current_eq;
467  if (pr == NULL)
468  sc->egalites = current_eq = current_eq->succ;
469  else
470  pr->succ = current_eq = current_eq->succ;
471  contrainte_free(pc);
472  pc = NULL;
473  break;
474  }
475 
476  case 1 :
477  pr = current_eq;
478  current_eq = current_eq->succ;
479  break;
480  }
481  }
482  }
483 
484  pr = NULL;
485  current_eq = sc->inegalites;
486  while(current_eq != NULL) {
487 
488  switch (contrainte_subst_ofl_ctrl(v, eq, current_eq, false,ofl_ctrl)) {
489 
490  case 0 :
491  {
492  /* the substitution found that the system is not feasible */
493  Psysteme new_sc = sc_empty(sc->base);
494  sc->base=BASE_UNDEFINED;
495  sc_rm(sc);
496  sc = new_sc;
497  eq = contrainte_free(eq);
498  return(sc);
499  break;
500  }
501 
502  case -1 : {
503  /* the substitution created a trivial inequation (0=<cste)
504  * which must be eliminated */
505  Pcontrainte pc = current_eq;
506  if (pr == NULL)
507  sc->inegalites = current_eq = current_eq->succ;
508  else
509  pr->succ = current_eq = current_eq->succ;
510  contrainte_free(pc);
511  pc = NULL;
512  break;
513  }
514 
515  case 1 :
516  pr = current_eq;
517  current_eq = current_eq->succ;
518  break;
519  }
520  }
521 
522  eq = contrainte_free(eq);
523  sc->nb_eq = nb_elems_list(sc->egalites);
524  sc->nb_ineq = nb_elems_list(sc->inegalites);
525  return(sc);
526 }
527 
528 /* Psysteme sc_simple_variable_substitution_with_eq_ofl_ctrl
529  * (Psysteme sc, Pcontrainte def, Variable v, int ofl_ctrl)
530  * input : a system of contraints sc, a contraint eq that must belong to sc,
531  * and a variable v that appears in the constraint eq.
532  * output : a Psysteme which is the projection of sc along v using
533  * equation eq.
534  * modifies : sc.
535  * comment : The case ofl_ctrl == OFL_CTRL is not handled, because it would
536  * have no sense here.
537  *
538  * Trivial constraints and trivially non-feasible constraints
539  * are not tested but intentionnally left in sc
540  */
541 Psysteme sc_simple_variable_substitution_with_eq_ofl_ctrl(sc, def, v, ofl_ctrl)
542 Psysteme sc;
543 Pcontrainte def;
544 Variable v;
545 int ofl_ctrl;
546 {
549 
550  assert(!SC_UNDEFINED_P(sc));
551 
552  /* FI/CA: in case the overflow must be handled by this function,
553  the function should catch it and remove the constraint that
554  generate the overflow. If this is ever implemented,
555  sc_normalize2() should be simplified by delegating overflow
556  control to this function. */
557 
558  for(eq = sc_egalites(sc); !CONTRAINTE_UNDEFINED_P(eq);
559  eq = contrainte_succ(eq)){
560  if (eq!=def) /* skip if aliased! */
561  (void) contrainte_subst_ofl_ctrl(v, def, eq, true, ofl_ctrl);
562  }
563 
564  for(ineq = sc_inegalites(sc); !CONTRAINTE_UNDEFINED_P(ineq);
565  ineq = contrainte_succ(ineq)){
566  (void) contrainte_subst_ofl_ctrl(v, def, ineq, false, ofl_ctrl);
567  }
568  return sc;
569 }
570 
571 /* bool sc_fourier_motzkin_variable_elimination_ofl_ctrl(Psysteme sc,
572  * Variable v,
573  * bool integer_test_p, bool *integer_test_res_p,
574  * int ofl_ctrl)
575  * input : a systeme of constraints sc, a variable to eliminate using
576  * Fourier-Motzking elimination, a bool (integer_test_p)
577  * true when the test of sufficient conditions for an exact
578  * projection must be performed, a pointer towards an already
579  * initialized bool (integer_test_res_p) to store the
580  * logical and of its initial value and of the result of the
581  * previous test, and an integer to indicate how the overflow
582  * error must be handled (see sc-types.h). The case OFL_CTRL
583  * is of no interest here.
584  * output : true if sc is feasible (w.r.t the inequalities),
585  * false otherwise;
586  * modifies : sc, *integer_test_res_p if integer_test_p == true.
587  * comment : eliminates v from sc by combining the inequalities of sc
588  * (Fourier-Motzkin). If this elimination is not exact,
589  * *integer_test_res_p is set to false.
590  * *integer_test_res_p must be initialized.
591  *
592  */
593 
594 bool sc_fourier_motzkin_variable_elimination_ofl_ctrl(sc,v, integer_test_p,
595  integer_test_res_p, ofl_ctrl)
596 Psysteme sc;
597 Variable v;
598 bool integer_test_p;
599 bool *integer_test_res_p;
600 int ofl_ctrl;
601 {
602  volatile Psysteme sc1 = SC_UNDEFINED;
603  Pcontrainte pos, neg, nul;
604  Pcontrainte pcp, pcn;
605  Value c;
606  int nnul;
607 
608  if ((sc->inegalites) == NULL) {
609  return(true);
610  }
611 
613 
614  ifscdebug(5) {
615  fprintf(stderr,"\n[sc_fourier_motzkin_variable_elimination_ofl_ctr] overflow or timeoutl!!!\n");}
616 
617 #ifdef FILTERING
618  alarm(0);
619 #endif
620  if (ofl_ctrl==FWD_OFL_CTRL) {
622  }
623  else {
624  ifscdebug(5) {
625  fprintf(stderr,"\n[fourier_motzkin_variable_elimination_ofl_ctrl]: ofl_ctrl <> FWD_OFL_CTRL \n");}
626  /*return false means system non feasible. return true, mean ok => both wrong */
627  }
628  }
629  TRY
630  {
631  Pcontrainte volatile pc = sc->inegalites;
632 #ifdef FILTERING
633  signal(SIGALRM, catch_alarm_projection);
634  alarm(FILTERING_TIMEOUT_PROJECTION);
635 #endif
636  if (integer_test_p) sc1 = sc_copy(sc);
637 
638  pos = neg = nul = NULL;
639  nnul = 0;
640  while (pc != NULL) {
641  Pcontrainte pcs = pc->succ;
642  c = vect_coeff(v,pc->vecteur);
643  if (value_pos_p(c)) {
644  pc->succ = pos;
645  pos = pc;
646  }
647  else if (value_neg_p(c)) {
648  pc->succ = neg;
649  neg = pc;
650  }
651  else {
652  pc->succ = nul;
653  nul = pc;
654  nnul++;
655  }
656 
657  pc = pcs;
658  }
659  sc->inegalites = NULL;
660  sc->nb_ineq = 0;
661 
662  for (pcp = pos; pcp != NULL; pcp = pcp->succ) {
663  for (pcn = neg; pcn != NULL; pcn = pcn->succ) {
664 
665  Pcontrainte pcnew;
666 
667  if (integer_test_p) {
668  bool int_comb_p;
669  pcnew =
670  sc_integer_inequalities_combination_ofl_ctrl
671  (sc1, pcp, pcn, v, &int_comb_p, ofl_ctrl);
672  *integer_test_res_p = *integer_test_res_p && int_comb_p;
673  }
674  else
675  pcnew = inegalite_comb_ofl_ctrl(pcp, pcn, v, ofl_ctrl);
676 
677  if (contrainte_constante_p(pcnew)) {
678  if (contrainte_verifiee(pcnew,false)) {
679  contrainte_free(pcnew);
680  }
681  else {
682  contraintes_free(pos);
683  contraintes_free(neg);
684  contraintes_free(nul);
685  contraintes_free(pcnew);
686  if (integer_test_p) sc_rm(sc1);
687 #ifdef FILTERING
688 alarm(0);
689 #endif
691  return(false);
692  }
693  }
694  else {
695  pcnew->succ = nul;
696  nul = pcnew;
697  nnul++;
698  }
699  }
700  }/*of for*/
701 
702  /* apres les combinaisons eliminer les elements devenus inutiles */
703  contraintes_free(pos);
704  contraintes_free(neg);
705 
706  /* mise a jour du systeme */
707  sc->inegalites = nul;
708  sc->nb_ineq = nnul;
709  if (integer_test_p) sc_rm(sc1);
710 
712  }/*of TRY*/
713 
714 #ifdef FILTERING
715 alarm(0);
716 /*clear the alarm*/
717 #endif
718 
719  return true;
720 }
721 
722 /* Psysteme sc_projection_on_variables
723  * (Psysteme sc, Pbase index_base, Pvecteur pv)
724  * input :
725  * output : a Psysteme representing the union of all the systems
726  * resulting of the projection of the system sc on each
727  * variable contained in vecteur index_base.
728  * pv is the list of variables that might be eliminated from
729  * the system (symbolic constants are not in).
730  * modifies :
731  * comment :
732  */
733 Psysteme sc_projection_on_variables(
734  Psysteme sc,
735  Pbase index_base,
736  Pvecteur pv)
737 {
738  Pvecteur lvar_proj;
739  Psysteme sc1 = sc_init_with_sc(sc);
740  // Automatic variables read in a CATCH block need to be declared volatile as
741  // specified by the documentation
742  volatile Psysteme sc2;
743  Variable var;
744 
745  if (!VECTEUR_NUL_P(pv))
746  {
747  volatile Pvecteur pv1, pv2;
748  lvar_proj = vect_copy(pv);
749  for (pv1 = index_base;!VECTEUR_NUL_P(pv1); pv1=pv1->succ) {
750  sc2 = sc_copy(sc);
751  var = vecteur_var(pv1);
752  vect_erase_var(&lvar_proj,var);
753  for (pv2 = lvar_proj;!VECTEUR_NUL_P(pv2); pv2=pv2->succ) {
754 
756  sc_elim_var(sc2, vecteur_var(pv2));
757  }
758  TRY {// force the overflow forwarding in order to apply sc_elim_var in case of overflow
759  sc_projection_along_variable_ofl_ctrl
760  (&sc2,vecteur_var(pv2), FWD_OFL_CTRL);
762  }
763  sc2 = sc_normalize(sc2);
764  if (SC_EMPTY_P(sc2)) {
765  sc2 = sc_empty(base_copy(sc->base));
766  break;
767  }
768  else {
770  }
771  }
772  vect_chg_coeff(&lvar_proj, var, VALUE_ONE);
773  sc1 = sc_intersection(sc1,sc1,sc2);
774  sc1 = sc_normalize(sc1);
775  if (SC_EMPTY_P(sc1)) {
776  sc1 = sc_empty(base_copy(sc->base));
777  break;
778  }
779  }
780  }
781  return sc1;
782 }
783 
784 
785 
786 /* Pcontrainte sc_integer_inequalities_combination_ofl_ctrl(Psysteme sc,
787  * Pcontrainte posit, negat,
788  * Variable v,
789  * bool *integer_combination_p,
790  * int ofl_ctrl)
791  * input : many things !
792  * output : a constraint which is the combination of the constraints
793  * posit and negat by the variable v.
794  * modifies : *integer_combination_p.
795  * comment :
796  * *integer_combination_p is set to true, if the Fourier Motzkin
797  * projection is equivalent to the "integer projection".
798  * else, it is set to false.
799  *
800  * Redundancy is checked using contrainte_reverse() and feasability
801  * checking. Non-redundant constraints in rational may be discarded.
802  */
803 Pcontrainte sc_integer_inequalities_combination_ofl_ctrl
804  (sc,posit,negat,v, integer_combination_p, ofl_ctrl)
805 Psysteme sc;
806 Pcontrainte posit, negat;
807 Variable v;
808 bool *integer_combination_p;
809 int ofl_ctrl;
810 {
811  Value cp, cn;
812  Pcontrainte ineg = NULL;
813 
814  if (!CONTRAINTE_UNDEFINED_P(posit) && !CONTRAINTE_UNDEFINED_P(negat))
815  {
816  /* ??? one is positive and the other is negative! FC */
817  cp = vect_coeff(v, posit->vecteur);
818  cp = value_abs(cp);
819  cn = vect_coeff(v, negat->vecteur);
820  cn = value_abs(cn);
821 
822  ineg = contrainte_new();
823  ineg->vecteur = vect_cl2_ofl_ctrl
824  (cp, negat->vecteur, cn, posit->vecteur, ofl_ctrl);
825 
826  if (value_gt(cp,VALUE_ONE) && value_gt(cn,VALUE_ONE))/* cp>1 && cn>1 */
827  {
828  /* tmp = cp*cn - cp - cn + 1. Note: cp and cn are >0! */
829  Value tmp = value_mult(cp,cn);
830  tmp = value_minus(value_plus(tmp, VALUE_ONE), value_plus(cp, cn));
831 
832  if (contrainte_constante_p(ineg) &&
834  *integer_combination_p = true;
835  else {
836  Pcontrainte ineg_test = contrainte_copy(ineg);
837  Psysteme sc_test = sc_copy(sc);
838 
839  vect_add_elem(&(ineg_test->vecteur), TCST, tmp);
840 
841  contrainte_reverse(ineg_test);
842 
843  sc_add_inegalite(sc_test,ineg_test);
844 
845  if (!sc_rational_feasibility_ofl_ctrl(sc_test, OFL_CTRL, true))
846  *integer_combination_p = true;
847  else
848  *integer_combination_p = false;
849  sc_rm(sc_test);
850  }
851  }
852  else {
853  *integer_combination_p = true;
854  }
855 
856  }
857  return(ineg);
858 }
859 
860 
861 /* FOR BACKWARD COMPATIBILITY ONLY. DO NOT USE ANYMORE, PLEASE. */
862 
863 Psysteme sc_projection(Psysteme sc, Variable v)
864 {
865  if (!sc_rn_p(sc)) {
867  sc_elim_var(sc , v);
868  }
869  TRY { // force the overflow forwarding in order to apply sc_elim_var in case of overflow
870  sc_projection_along_variable_ofl_ctrl(&sc,v, FWD_OFL_CTRL);
872  }
873  if (sc_empty_p(sc)) {
874  sc_rm(sc);
875  sc = SC_EMPTY;
876  }
877  }
878  return sc;
879 }
880 
881 Psysteme sc_projection_ofl(Psysteme sc, Variable v)
882 {
883  sc_projection_along_variable_ofl_ctrl(&sc,v, FWD_OFL_CTRL);
884  if (sc_empty_p(sc)) {
885  sc_rm(sc);
886  sc = SC_EMPTY;
887  }
888  return sc;
889 }
890 
891 
892 
893 Psysteme sc_projection_pure(sc,v)
894 Psysteme sc;
895 Variable v;
896 {
898  sc_elim_var(sc , v);
899  }
900  TRY {// force the overflow forwarding in order to apply sc_elim_var in case of overflow
901  sc_and_base_projection_along_variable_ofl_ctrl(&sc,v,FWD_OFL_CTRL);
903  }
904  if (sc_empty_p(sc)) {
905  sc_rm(sc);
906  sc = SC_EMPTY;
907  }
908  return(sc );
909 }
910 
911 
912 Psysteme sc_projection_ofl_along_variables(sc,pv)
913 Psysteme sc;
914 Pvecteur pv;
915 {
916  sc_projection_along_variables_ofl_ctrl(&sc,pv, FWD_OFL_CTRL);
917  return(sc);
918 }
919 
920 
921 
922 Psysteme sc_projection_ofl_along_variables_with_test(sc, pv, is_proj_exact)
923 Psysteme sc;
924 Pvecteur pv;
925 bool *is_proj_exact; /* this bool is supposed to be initialized */
926 {
927  sc_projection_along_variables_with_test_ofl_ctrl(&sc, pv, is_proj_exact,
928  FWD_OFL_CTRL);
929  return(sc);
930 }
931 
932 
933 Psysteme sc_projection_by_eq(sc, eq, v)
934 Psysteme sc;
936 Variable v;
937 {
938  Psysteme res;
939  res = sc_variable_substitution_with_eq_ofl_ctrl(sc, eq, v, FWD_OFL_CTRL);
940 
941  if (sc_empty_p(res)){
942  sc_rm(res);
943  res = SC_EMPTY;
944  }
945 
946  return(res);
947 }
948 
949 bool cond_suff_comb_integer_ofl_ctrl(sc,posit,negat, v, ofl_ctrl)
950 Psysteme sc;
951 Pcontrainte posit,negat;
952 Variable v;
953 int ofl_ctrl;
954 {
956  bool result;
957 
958  ineg = sc_integer_inequalities_combination_ofl_ctrl(sc, posit, negat, v,
959  &result, ofl_ctrl);
960  contrainte_rm(ineg);
961  return(result);
962 
963 }
964 
965 
966 
967 Psysteme sc_projection_optim_along_vecteur(volatile Psysteme sc, Pvecteur pv)
968 {
970  /* sc_rm(sc1); */
971  return sc;
972  }
973  TRY {
974  Psysteme sc1 = sc_copy(sc);
975  bool exact = true;
976  sc1 = sc_projection_ofl_along_variables_with_test(sc1,pv,&exact);
977  sc_rm(sc);
979  return sc1;
980  }
981 }
982 
983 
984 Pcontrainte eq_v_coeff_min(contraintes, v)
985 Pcontrainte contraintes;
986 Variable v;
987 {
988  Value coeff;
989  return contrainte_var_min_coeff(contraintes, v, &coeff, true);
990 }
991 
992 bool sc_expensive_projection_p(sc,v)
993 Psysteme sc;
994 Variable v;
995 {
996  bool expensive = false;
997  /* if Variable v is constrained by equalities, the system size
998  is kept (-1) after projection */
999  if (!var_in_lcontrainte_p(sc->egalites,v)
1000  && sc->nb_ineq > 20 /* was max for FM */) {
1001  Pcontrainte ineg;
1002  int nb_pvar = 0, nb_nvar = 0;
1003  for (ineg=sc->inegalites;!CONTRAINTE_UNDEFINED_P(ineg);
1004  ineg=ineg->succ) {
1005  int coeff= vect_coeff(v,ineg->vecteur);
1006  if (coeff >0) nb_pvar ++;
1007  else if (coeff<0) nb_nvar ++;
1008  }
1009  if (nb_pvar*nb_nvar>200)
1010  expensive=true;
1011  }
1012  return (expensive);
1013 
1014 
1015 }
1016 
1017 /* from sc_common_projection_convex_hull...
1018  extract exact equalities on cl, put them in common,
1019  and project them in cl, s1 and s2...
1020  */
1021 #define SUBS(s,e,v) \
1022  sc_simple_variable_substitution_with_eq_ofl_ctrl(s,e,v,OFL_CTRL)
1023 /* sc_variable_substitution_with_eq_ofl_ctrl(s,contrainte_copy(e),v,OFL_CTRL) */
1024 
1025 void sc_extract_exact_common_equalities
1026  (Psysteme cl, Psysteme common, Psysteme s1, Psysteme s2)
1027 {
1028  Pcontrainte eq, neq, peq;
1029  for (peq = CONTRAINTE_UNDEFINED,
1030  eq = sc_egalites(cl),
1031  neq = eq? eq->succ: CONTRAINTE_UNDEFINED;
1032  eq;
1033  peq = eq==neq? peq: eq,
1034  eq = neq,
1035  neq = eq? eq->succ: CONTRAINTE_UNDEFINED)
1036  {
1038  if (v)
1039  {
1040  /* unlink eq and update count. */
1041  if (peq) peq->succ = neq; else sc_egalites(cl) = neq;
1042  sc_nbre_egalites(cl)--;
1043 
1044  /* put equality back in common. */
1045  eq->succ = sc_egalites(common);
1046  sc_egalites(common) = eq;
1047  sc_nbre_egalites(common)++;
1048 
1049  /* drop variable. */
1050  s1 = SUBS(s1, eq, v);
1051  s2 = SUBS(s2, eq, v);
1052  cl = SUBS(cl, eq, v);
1053 
1054  eq = neq; /* let's hope neq is still there... */
1055  }
1056  }
1057 }
1058 
1059 /* make exact projection of simple equalities where possible,
1060  * so as to simplify the system by avoiding X == Y and Y == 3.
1061  * poor's man normalization;-) should use Hermite for better results?
1062  * the result is not deterministic, we should iterate till stable,
1063  * however no information is available from substitutions to tell
1064  * whether the system was changed or not...
1065  */
1066 void sc_project_very_simple_equalities(Psysteme s)
1067 {
1068  Pcontrainte e;
1069  for (e = sc_egalites(s); e; e = e->succ)
1070  {
1072  if (v) SUBS(s, e, v);
1073  }
1074 }
1075 
1076 /* void sc_projection_along_variable_ofl_ctrl_timeout_ctrl(psc, v ofl_ctrl)
1077  *
1078  * See (void) sc_projection_along_variable_ofl_ctrl(psc, v, ofl_ctrl).
1079  *
1080  * We need a function that returns nothing, modifies the input
1081  * systeme, but can print the original system of constraints only in
1082  * case of failure, it means we have to catch overflow_error from
1083  * sc_fourier_motzkin_variable_elimination_ofl_ctrl, in order to print
1084  * the systems only in Linear. This function will make a copy of the
1085  * system, and print it to stderr if there is an exception. Surely
1086  * the copy will be removed afterward. (Duong Nguyen 17/7/02) add SIZE
1087  * CONTROL
1088 */
1089 
1090 void sc_projection_along_variable_ofl_ctrl_timeout_ctrl(psc, v, ofl_ctrl)
1091 Psysteme volatile *psc;
1092 Variable v;
1093 int ofl_ctrl;
1094 {
1095  /* static bool DN = false; */
1096  /* Automatic variables read in a CATCH block need to be declared volatile as
1097  * specified by the documentation*/
1098  Psysteme volatile sc;
1099  Pbase volatile base_saved;
1100  static int volatile projection_sc_counter = 0;
1101 
1102  sc= sc_copy(*psc);
1103  base_saved = base_copy((*psc)->base);
1104 
1105  if (sc==NULL) {
1106  sc_rm(*psc);
1107  sc_rm(sc);
1108  *psc = sc_empty(base_saved);
1109  return;
1110  }
1111 
1112  ifscdebug(5) {projection_sc_counter ++;}
1113 
1114 
1115  /*We can put the size filters here! filtering timeout is integrated in the methods themself */
1116  /* size filtering: dimension, number_constraints, density, magnitude */
1117 
1118 #ifdef FILTERING
1119 
1120  PROJECTION_timeout = false;
1121  /*Begin size filters */
1122 
1123  if (true) { /* all these stuff in a block*/
1124  Value magnitude;
1125  int dimens, nb_cont_eq = 0, nb_ref_eq = 0, nb_cont_in = 0, nb_ref_in = 0;
1126 
1127  dimens = sc->dimension; value_assign(magnitude,VALUE_ZERO);
1128  decision_data(sc_egalites(sc), &nb_cont_eq, &nb_ref_eq, &magnitude, 1);
1129  decision_data(sc_inegalites(sc), &nb_cont_in, &nb_ref_in, &magnitude, 1);
1130 
1131  if ((FILTERING_DIMENSION_PROJECTION>0)&&(dimens>=FILTERING_DIMENSION_PROJECTION)) {
1132  char *directory_name = "projection_dimension_filtering_SC_OUT";
1133  sc_default_dump_to_files(sc,projection_sc_counter,directory_name);
1134  }
1135  if ((FILTERING_NUMBER_CONSTRAINTS_PROJECTION>0)&&((nb_cont_eq + nb_cont_in) >= FILTERING_NUMBER_CONSTRAINTS_PROJECTION)) {
1136  char *directory_name = "projection_number_constraints_filtering_SC_OUT";
1137  sc_default_dump_to_files(sc,projection_sc_counter,directory_name);
1138  }
1139  if ((FILTERING_DENSITY_PROJECTION>0)&&((nb_ref_eq + nb_ref_in) >= FILTERING_DENSITY_PROJECTION)) {
1140  char *directory_name = "projection_density_filtering_SC_OUT";
1141  sc_default_dump_to_files(sc,projection_sc_counter,directory_name);
1142  }
1143  if ((value_notzero_p(FILTERING_MAGNITUDE_PROJECTION))&&(value_gt(magnitude,FILTERING_MAGNITUDE_PROJECTION))) {
1144  char *directory_name = "projection_magnitude_filtering_SC_OUT";
1145  sc_default_dump_to_files(sc,projection_sc_counter,directory_name);
1146  }
1147  }
1148  /*End size filters*/
1149 #endif
1150 
1152 
1153  if (EXCEPTION_PRINT_PROJECTION) {
1154  char *directory_name = "projection_fail_SC_OUT";
1155  sc_default_dump_to_files(sc,projection_sc_counter,directory_name);
1156  }
1157  sc_rm(sc);
1158 
1159  if (ofl_ctrl==FWD_OFL_CTRL) {
1160  base_rm(base_saved);
1161  /*The modified sc is returned to the calling function, so we can see why the projection fails*/
1162  RETHROW();
1163  } else {
1164  ifscdebug(5) {
1165  fprintf(stderr,"\n[sc_projection_along_variable_ofl_ctrl_timeout_ctrl]: projection failed, return sc_empty(base_saved)\n");
1166  }
1167  sc_rm(*psc);
1168  *psc = sc_empty(base_saved);
1169  return;
1170  }
1171  }
1172  TRY {
1173 
1174  sc_projection_along_variable_ofl_ctrl(psc, v, ofl_ctrl);
1175 
1177  }//of TRY
1178 
1179 #ifdef FILTERING
1180  if (PROJECTION_timeout) {
1181  char * directory_name = "projection_timeout_filtering_SC_OUT";
1182  sc_default_dump_to_files(sc,projection_sc_counter,directory_name);
1183  }
1184 #endif
1185  sc_rm(sc);
1186  base_rm(base_saved);
1187 }
1188 
1189 /* FC: it is unclear how this one differs from others...
1190  */
1191 Psysteme sc_system_projection_along_variables(Psysteme ps, Pvecteur pv)
1192 {
1193  // handle overflow by the calling procedure (FWD_OFL_CTRL)
1195  return SC_UNDEFINED;
1196  TRY
1197  {
1198  bool is_proj_exact = true;
1199  sc_projection_along_variables_with_test_ofl_ctrl(
1200  &ps, pv, &is_proj_exact, FWD_OFL_CTRL);
1202  if (is_proj_exact)
1203  return ps;
1204  return SC_UNDEFINED;
1205  }
1206 }
#define CATCH(what)
@ overflow_error
@ timeout_error
#define THROW(what)
#define UNCATCH(what)
#define RETHROW()
#define TRY
#define value_pos_p(val)
#define VALUE_ZERO
#define value_minus(v1, v2)
#define value_gt(v1, v2)
#define value_le(v1, v2)
#define value_notzero_p(val)
#define value_uminus(val)
unary operators on values
#define value_notone_p(val)
#define value_assign(ref, val)
assigments
int Value
#define value_plus(v1, v2)
binary operators on values
#define VALUE_ONE
#define value_abs(val)
#define value_mult(v, w)
whether the default is protected or not this define makes no sense any more...
#define value_neg_p(val)
#define CONTRAINTE_UNDEFINED_P(c)
#define contrainte_succ(c)
#define CONTRAINTE_UNDEFINED
#define contrainte_rm(c)
the standard xxx_rm does not return a value
Pcontrainte contraintes_free(Pcontrainte pc)
Pcontrainte contraintes_free(Pcontrainte pc): desallocation de toutes les contraintes de la liste pc.
Definition: alloc.c:226
Pcontrainte contrainte_free(Pcontrainte c)
Pcontrainte contrainte_free(Pcontrainte c): liberation de l'espace memoire alloue a la contrainte c a...
Definition: alloc.c:184
Pcontrainte contrainte_copy(Pcontrainte c_in)
Have a look at contrainte_dup and contraintes_dup which reverse the order of the list This copy versi...
Definition: alloc.c:254
Pcontrainte contrainte_new(void)
package contrainte - allocations et desallocations
Definition: alloc.c:47
int contrainte_subst_ofl_ctrl(Variable v, Pcontrainte def, Pcontrainte c, bool eq_p, int ofl_ctrl)
int contrainte_subst_ofl_ctrl(Variable v, Pcontrainte def, Pcontrainte c Boolean eq_p,...
Definition: binaires.c:107
Pcontrainte inegalite_comb_ofl_ctrl(Pcontrainte posit, Pcontrainte negat, Variable v, int ofl_ctrl)
Pcontrainte inegalite_comb_ofl_ctrl(Pcontrainte posit, Pcontrainte negat, Variable v,...
Definition: binaires.c:179
Pcontrainte contrainte_var_min_coeff(Pcontrainte, Variable, Value *, bool)
Pcontrainte contrainte_var_min_coeff(Pcontrainte contraintes, Variable v, int *coeff) input : a list ...
Definition: unaires.c:345
bool egalite_normalize(Pcontrainte)
bool egalite_normalize(Pcontrainte eg): reduction d'une equation diophantienne par le pgcd de ses coe...
Definition: normalize.c:136
int nb_elems_list(Pcontrainte)
int nb_elems_list(Pcontrainte list): nombre de contraintes se trouvant dans une liste de contraintes
Definition: listes.c:129
Variable contrainte_simple_equality(Pcontrainte)
returns whether a constraint is a simple equality: X == 12 the system is expected to be normalized?
Definition: unaires.c:521
bool contrainte_constante_p(Pcontrainte)
bool contrainte_constante_p(Pcontrainte c): test de contrainte triviale sans variables (ie du type 0<...
Definition: predicats.c:192
void contrainte_reverse(Pcontrainte)
void contrainte_reverse(Pcontrainte eq): changement de signe d'une contrainte, i.e.
Definition: unaires.c:67
bool contrainte_verifiee(Pcontrainte, bool)
bool contrainte_verifiee(Pcontrainte ineg, bool eq_p): test de faisabilite d'inegalite (eq_p == false...
Definition: predicats.c:234
#define assert(ex)
Definition: newgen_assert.h:41
void sc_base_remove_variable(Psysteme sc, Variable v)
Definition: sc.c:239
bool sc_rn_p(Psysteme sc)
bool sc_rn_p(Psysteme sc): check if the set associated to sc is the whole space, rn
Definition: sc_alloc.c:369
Psysteme sc_empty(Pbase b)
Psysteme sc_empty(Pbase b): build a Psysteme with one unfeasible constraint to define the empty subsp...
Definition: sc_alloc.c:319
void sc_rm(Psysteme ps)
void sc_rm(Psysteme ps): liberation de l'espace memoire occupe par le systeme de contraintes ps;
Definition: sc_alloc.c:277
Psysteme sc_init_with_sc(Psysteme sc)
This function returns a new empty system which has been initialized with the same dimension and base ...
Definition: sc_alloc.c:303
bool sc_empty_p(Psysteme sc)
bool sc_empty_p(Psysteme sc): check if the set associated to sc is the constant sc_empty or not.
Definition: sc_alloc.c:350
void sc_add_inegalite(Psysteme p, Pcontrainte i)
void sc_add_inegalite(Psysteme p, Pcontrainte i): macro ajoutant une inegalite i a un systeme p; la b...
Definition: sc_alloc.c:406
Psysteme sc_copy(Psysteme ps)
Psysteme sc_copy(Psysteme ps): duplication d'un systeme (allocation et copie complete des champs sans...
Definition: sc_alloc.c:230
void build_sc_nredund_1pass(Psysteme volatile *ps)
Computation of a new system sc from the system ps, where each constraint of the system ps is added to...
void decision_data(Pcontrainte c, int volatile *pc, int volatile *pv, Value *magnitude, int weight)
just a test to improve the Simplex/FM decision.
bool sc_rational_feasibility_ofl_ctrl(Psysteme sc, int ofl_ctrl, bool ofl_res)
Pcontrainte eq
element du vecteur colonne du systeme donne par l'analyse
Definition: sc_gram.c:108
Pvecteur cp
pointeur sur l'egalite ou l'inegalite courante
Definition: sc_read.c:87
Psysteme sc_intersection(Psysteme s1, Psysteme s2, Psysteme s3)
Psysteme sc_intersection(Psysteme s1, Psysteme s2, Psysteme s3): calcul d'un systeme de contraintes s...
void sc_default_dump_to_files(Psysteme sc, int sc_nb, char *directory_name)
void sc_default_dump_to_files(Psysteme sc, sc_nb,directory_name):
Definition: sc_io.c:288
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
Psysteme sc_normalize(Psysteme ps)
Psysteme sc_normalize(Psysteme ps): normalisation d'un systeme d'equation et d'inequations lineaires ...
Psysteme sc_elim_var(Psysteme sc, Variable v)
package sur les systemes de contraintes sc
Definition: sc_unaires.c:49
bool var_in_lcontrainte_p(Pcontrainte pc, Variable var)
Check if variable var appears in at least on of the constraints in constraint list pc with a non-zero...
Definition: sc_var.c:122
s1
Definition: set.c:247
Pvecteur vecteur
struct Scontrainte * succ
Pcontrainte inegalites
Definition: sc-local.h:71
Pcontrainte egalites
Definition: sc-local.h:70
Pbase base
Definition: sc-local.h:75
int dimension
Definition: sc-local.h:74
int nb_ineq
Definition: sc-local.h:73
int nb_eq
Definition: sc-local.h:72
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89
Variable var
Definition: vecteur-local.h:90
struct Svecteur * succ
Definition: vecteur-local.h:92
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
#define vecteur_var(v)
#define VECTEUR_NUL_P(v)
#define base_rm(b)
void * Variable
arithmetique is a requirement for vecteur, but I do not want to inforce it in all pips files....
Definition: vecteur-local.h:60
#define FWD_OFL_CTRL
#define BASE_UNDEFINED
#define OFL_CTRL
I do thing that overflows are managed in a very poor manner.
Pbase vect_copy(Pvecteur b)
direct duplication.
Definition: alloc.c:240
Pbase base_copy(Pbase b)
Direct duplication.
Definition: alloc.c:300
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Definition: alloc.c:78
Pvecteur vect_cl2_ofl_ctrl(Value x1, Pvecteur v1, Value x2, Pvecteur v2, int ofl_ctrl)
Pvecteur vect_cl2_ofl(Value x1, Pvecteur v1, Value x2, Pvecteur v2): allocation d'un vecteur v dont l...
Definition: binaires.c:204
void vect_erase_var(Pvecteur *ppv, Variable v)
void vect_erase_var(Pvecteur * ppv, Variable v): projection du vecteur *ppv selon la direction v (i....
Definition: unaires.c:106
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
Value vect_coeff(Variable var, Pvecteur vect)
Variable vect_coeff(Variable var, Pvecteur vect): coefficient de coordonnee var du vecteur vect —> So...
Definition: unaires.c:228
Variable vect_one_coeff_if_any(Pvecteur v)
Definition: unaires.c:182
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val)
void vect_chg_coeff(Pvecteur *ppv, Variable var, Value val): mise de la coordonnee var du vecteur *pp...
Definition: unaires.c:143