PIPS
disjunct.c File Reference
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "linear_assert.h"
#include <time.h>
#include <sys/time.h>
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
#include "contrainte.h"
#include "sc.h"
#include "sommet.h"
#include "polyedre.h"
#include "union.h"
+ Include dependency graph for disjunct.c:

Go to the source code of this file.

Functions

Pdisjunct dj_new ()
 Package : C3/union Author : Arnauld LESERVOT (leservot(a)limeil.cea.fr) Date :
Modified : 04 04 95 Documents: UNION.tex : `‘Extension de C3 aux unions de polyedres’' Comments : More...
 
Pdisjunct dj_dup (Pdisjunct in_dj)
 Pdisjunct dj_dup( (Pdisjunct) in_dj ) AL 15/11/93 Duplicates input disjunction. More...
 
Pdisjunct dj_free (Pdisjunct in_dj)
 Pdisjunct dj_free( (Pdisjunct) in_dj ) AL 31/05/94 w - 1 depth free of input disjunction. More...
 
Pdisjunct dj_dup1 (Pdisjunct in_dj)
 Pdisjunct dj_dup1( (Pdisjunct) in_dj ) AL 31/05/94 1st depth duplication of input disjunction. More...
 
Pdisjunct dj_free1 (Pdisjunct in_dj)
 Pdisjunct dj_free1( (Pdisjunct) in_dj ) AL 31/05/94 1st depth free of input disjunction. More...
 
Pdisjunct dj_full ()
 Pdisjunct dj_full() AL 18/11/93 Return full space disjunction = dj_new() More...
 
bool dj_full_p (Pdisjunct in_dj)
 dj_full_p( (Pdisjunct) in_dj ) AL 30/05/94 Returns True if in_dj = (NIL) ^ (NIL) More...
 
Pdisjunct dj_empty ()
 Pdisjunct dj_empty() AL 18/11/93 Returns a disjunction with sc_empty() element. More...
 
bool dj_empty_p (Pdisjunct in_dj)
 dj_empty_p( (Ppath) in_pa ) AL 30/05/94 Returns True if in_dj = (1*TCST = 0) ^ (NIL) More...
 
Pdisjunct dj_intersection_ofl_ctrl (Pdisjunct in_dj1, Pdisjunct in_dj2, int ofl_ctrl)
 Pdisjunct dj_intersection_ofl_ctrl( in_dj1, in_dj2, ofl_ctrl ) Computes intersection of two disjunctions. More...
 
Pdisjunct dj_intersect_system_ofl_ctrl (in_dj, in_ps, ofl_ctrl)
 Pdisjunct dj_intersect_system_ofl_ctrl( )
More...
 
Pdisjunct dj_intersect_djcomp_ofl_ctrl (Pdisjunct in_dj1, Pdisjunct in_dj2, int ofl_ctrl)
 Pdisjunct dj_intersect_djcomp_ofl_ctrl( ) No sharing. More...
 
Pdisjunct dj_union (Pdisjunct in_dj1, Pdisjunct in_dj2)
 Pdisjunct dj_union( (Pdisjunct) in_dj1, (Pdisjunct) in_dj2 ) Give the union of the two disjunctions. More...
 
bool dj_feasibility_ofl_ctrl (Pdisjunct in_dj, int ofl_ctrl)
 bool dj_feasibility_ofl_ctrl( (Pdisjunct) in_dj, (int) ofl_ctrl ) Returns true if in_dj is a feasible disjunction. More...
 
Pdisjunct dj_system_complement (Psysteme in_ps)
 Pdisjunct dj_system_complement( (Psystem) in_ps ) AL 26/10/93 Input : A Psysteme. More...
 
Pdisjunct dj_disjunct_complement (Pdisjunct in_dj)
 Returns complement of in_dj. More...
 
Pdisjunct dj_projection_along_variables_ofl_ctrl (Pdisjunct in_dj, Pvecteur in_pv, int ofl_ctrl)
 Returns projection of in_dj along vars of in_pv. More...
 
Pdisjunct dj_simple_inegs_to_eg (Pdisjunct in_dj)
 Pdisjunct dj_simple_inegs_to_eg( in_dj ) transforms two opposite inequalities in a simple equality in each system of the input disjunction. More...
 
bool dj_is_system_p (Pdisjunct in_dj)
 bool dj_is_system_p( (Pdisjunct) in_dj ) AL 16/11/93 Returns True if disjunction in_dj has only one Psysteme in it. More...
 
Pdisjunct dj_append_system (Pdisjunct in_dj, Psysteme in_ps)
 Pdisjunct dj_append_system( (Pdisjunct) in_dj, (Psysteme) in_ps ) Input : A disjunct in_dj to wich in_ps will be added. More...
 
Pdisjunct dj_variable_rename (Pdisjunct in_dj, Variable in_vold, Variable in_vnew)
 dj_variable_rename replaces in_vold with in_vnew : in_dj is modified More...
 
Pdisjunct dj_variable_substitution_with_eqs_ofl_ctrl (in_dj, in_pc, in_pv, ofl_ctrl)
 Pdisjunct dj_variable_substitution_with_eqs_ofl_ctrl() AL160595 Substitutes to all systems of disjunction in_dj definitions of variables in in_pv that are implied by in_pc. More...
 
void dj_fprint_tab (FILE *in_fi, Pdisjunct in_dj, char *(*in_fu)(), int in_tab)
 void dj_fprint_tab(FILE*, Pdisjunct, function, int) prints a Pdisjunct More...
 
Pdisjunct dj_read (char *nomfic)
 void dj_read(FILE*) reads a Pdisjunct More...
 

Function Documentation

◆ dj_append_system()

Pdisjunct dj_append_system ( Pdisjunct  in_dj,
Psysteme  in_ps 
)

Pdisjunct dj_append_system( (Pdisjunct) in_dj, (Psysteme) in_ps ) Input : A disjunct in_dj to wich in_ps will be added.

AL 10/11/93 Output : Disjunct in_dj with in_ps. => ! Sharing. Comment: Nothing is checked on result in_dj.

Parameters
in_djn_dj
in_psn_ps

Definition at line 403 of file disjunct.c.

406 {
407  Pdisjunct ret_dj;
408 
409  if (dj_full_p(in_dj)) { ret_dj = dj_new(); ret_dj->psys = in_ps; }
410  else {ret_dj = (Pdisjunct) sl_append_system((Psyslist) in_dj, in_ps);}
411  return ret_dj;
412 }
Pdisjunct dj_new()
Package : C3/union Author : Arnauld LESERVOT (leservot(a)limeil.cea.fr) Date : Modified : 04 04 95 ...
Definition: disjunct.c:52
bool dj_full_p(Pdisjunct in_dj)
dj_full_p( (Pdisjunct) in_dj ) AL 30/05/94 Returns True if in_dj = (NIL) ^ (NIL)
Definition: disjunct.c:98
Psyslist sl_append_system(Psyslist in_sl, Psysteme in_ps)
Psyslist sl_append_system( (Psyslist) in_sl, (Psysteme) in_ps ) Input : A disjunct in_sl to wich in_p...
Definition: sc_list.c:240
Warning! Do not modify this file that is automatically generated!
Definition: union-local.h:3
Psysteme psys
Definition: union-local.h:4
Ssyslist * Pdisjunct
Definition: union-local.h:10

References dj_full_p(), dj_new(), Ssyslist::psys, and sl_append_system().

Referenced by compatible_pc_p(), dj_system_complement(), and pa_path_to_disjunct_rule4_ofl_ctrl().

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

◆ dj_disjunct_complement()

Pdisjunct dj_disjunct_complement ( Pdisjunct  in_dj)

Returns complement of in_dj.

No sharing

debugging

Parameters
in_djn_dj

Definition at line 299 of file disjunct.c.

301 {
302  Pdisjunct ret_dj;
303  if DJ_UNDEFINED_P(in_dj) return DJ_UNDEFINED;
304  if (dj_empty_p(in_dj)||dj_full_p(in_dj)) return dj_dup(in_dj);
305 
306  /* debugging */
307  C3_DEBUG("dj_disjunct_complement (in_ps)",
308  {dj_fprint_tab(stderr, in_dj, union_variable_name, 1);});
309 
310  ret_dj = dj_full();
311  for(; in_dj != NULL; in_dj = in_dj->succ)
312  { ret_dj = dj_intersection(ret_dj, dj_system_complement(in_dj->psys)); }
313  C3_RETURN(IS_DJ, ret_dj);
314 }
Pdisjunct dj_system_complement(Psysteme in_ps)
Pdisjunct dj_system_complement( (Psystem) in_ps ) AL 26/10/93 Input : A Psysteme.
Definition: disjunct.c:254
Pdisjunct dj_dup(Pdisjunct in_dj)
Pdisjunct dj_dup( (Pdisjunct) in_dj ) AL 15/11/93 Duplicates input disjunction.
Definition: disjunct.c:58
bool dj_empty_p(Pdisjunct in_dj)
dj_empty_p( (Ppath) in_pa ) AL 30/05/94 Returns True if in_dj = (1*TCST = 0) ^ (NIL)
Definition: disjunct.c:118
Pdisjunct dj_full()
Pdisjunct dj_full() AL 18/11/93 Return full space disjunction = dj_new()
Definition: disjunct.c:92
void dj_fprint_tab(FILE *in_fi, Pdisjunct in_dj, char *(*in_fu)(), int in_tab)
void dj_fprint_tab(FILE*, Pdisjunct, function, int) prints a Pdisjunct
Definition: disjunct.c:492
char *(* union_variable_name)(Variable)
Package : C3/union Author : Arnauld LESERVOT (leservot(a)limeil.cea.fr) Date : Modified : 04 04 95 ...
Definition: sc_list.c:51
struct Ssyslist * succ
Definition: union-local.h:5
#define IS_DJ
Definition: union-local.h:135
#define DJ_UNDEFINED_P(dj)
Definition: union-local.h:97
#define C3_DEBUG(fun, code)
Definition: union-local.h:150
#define dj_intersection(dj1, dj2)
Definition: union-local.h:101
#define C3_RETURN(type, val)
Definition: union-local.h:151
#define DJ_UNDEFINED
Definition: union-local.h:12

References C3_DEBUG, C3_RETURN, dj_dup(), dj_empty_p(), dj_fprint_tab(), dj_full(), dj_full_p(), dj_intersection, dj_system_complement(), DJ_UNDEFINED, DJ_UNDEFINED_P, IS_DJ, and union_variable_name.

Referenced by dj_intersect_djcomp_ofl_ctrl().

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

◆ dj_dup()

Pdisjunct dj_dup ( Pdisjunct  in_dj)

Pdisjunct dj_dup( (Pdisjunct) in_dj ) AL 15/11/93 Duplicates input disjunction.

Parameters
in_djn_dj

Definition at line 58 of file disjunct.c.

60 {
61  if (dj_full_p(in_dj)) return dj_full();
62  return (Pdisjunct) sl_dup( (Psyslist) in_dj );
63 }
Psyslist sl_dup(Psyslist in_sl)
Psyslist sl_dup( (Psyslist) in_sl ) AL 15/11/93 w - 1 duplication : everything is duplicated,...
Definition: sc_list.c:296

References dj_full(), dj_full_p(), and sl_dup().

Referenced by dj_disjunct_complement(), dj_intersect_djcomp_ofl_ctrl(), dj_intersection_ofl_ctrl(), and dj_simple_inegs_to_eg().

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

◆ dj_dup1()

Pdisjunct dj_dup1 ( Pdisjunct  in_dj)

Pdisjunct dj_dup1( (Pdisjunct) in_dj ) AL 31/05/94 1st depth duplication of input disjunction.

Parameters
in_djn_dj

Definition at line 76 of file disjunct.c.

78 { return( (Pdisjunct) sl_dup1( (Psyslist) in_dj ) ); }
Psyslist sl_dup1(Psyslist in_sl)
Psyslist sl_dup1( (Psyslist) in_sl ) AL 15/11/93 Duplicates input syslist.
Definition: sc_list.c:311

References sl_dup1().

+ Here is the call graph for this function:

◆ dj_empty()

Pdisjunct dj_empty ( void  )

Pdisjunct dj_empty() AL 18/11/93 Returns a disjunction with sc_empty() element.

Definition at line 111 of file disjunct.c.

112 { return (Pdisjunct) sl_append_system(NULL, sc_empty((Pbase) NULL)); }
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
le type des coefficients dans les vecteurs: Value est defini dans le package arithmetique
Definition: vecteur-local.h:89

References sc_empty(), and sl_append_system().

Referenced by dj_intersect_djcomp_ofl_ctrl(), dj_intersection_ofl_ctrl(), pa_path_to_disjunct_ofl_ctrl(), pa_path_to_disjunct_rule4_ofl_ctrl(), pa_path_to_few_disjunct_ofl_ctrl(), and pa_system_difference_ofl_ctrl().

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

◆ dj_empty_p()

bool dj_empty_p ( Pdisjunct  in_dj)

dj_empty_p( (Ppath) in_pa ) AL 30/05/94 Returns True if in_dj = (1*TCST = 0) ^ (NIL)

Parameters
in_djn_dj

Definition at line 118 of file disjunct.c.

120 {
121  return( ( in_dj != DJ_UNDEFINED ) &&
122  ( in_dj->succ == NULL ) &&
123  ( in_dj->psys != NULL ) &&
124  ( sc_empty_p( in_dj->psys ) ) );
125 }
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

References DJ_UNDEFINED, and sc_empty_p().

Referenced by dj_disjunct_complement(), dj_intersect_djcomp_ofl_ctrl(), dj_intersection_ofl_ctrl(), dj_projection_along_variables_ofl_ctrl(), dj_simple_inegs_to_eg(), dj_union(), dj_variable_rename(), dj_variable_substitution_with_eqs_ofl_ctrl(), and pa_feasibility_ofl_ctrl().

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

◆ dj_feasibility_ofl_ctrl()

bool dj_feasibility_ofl_ctrl ( Pdisjunct  in_dj,
int  ofl_ctrl 
)

bool dj_feasibility_ofl_ctrl( (Pdisjunct) in_dj, (int) ofl_ctrl ) Returns true if in_dj is a feasible disjunction.

AL,BC 23/02/95

Parameters
in_djn_dj
ofl_ctrlfl_ctrl

Definition at line 232 of file disjunct.c.

235 {
236  bool ret_bool = false;
237  Pdisjunct dj;
238 
239  if ( in_dj == DJ_UNDEFINED ) return false;
240  for( dj = in_dj; dj != NULL && !ret_bool; dj = dj->succ ) {
241  if (dj->psys == SC_UNDEFINED) return false;
242  ret_bool = ret_bool ||
243  sc_rational_feasibility_ofl_ctrl( dj->psys, ofl_ctrl, true );
244  }
245  return ret_bool;
246 }
bool sc_rational_feasibility_ofl_ctrl(Psysteme sc, int ofl_ctrl, bool ofl_res)

References DJ_UNDEFINED, Ssyslist::psys, sc_rational_feasibility_ofl_ctrl(), and Ssyslist::succ.

+ Here is the call graph for this function:

◆ dj_fprint_tab()

void dj_fprint_tab ( FILE*  in_fi,
Pdisjunct  in_dj,
char *(*)()  in_fu,
int  in_tab 
)

void dj_fprint_tab(FILE*, Pdisjunct, function, int) prints a Pdisjunct

Definition at line 492 of file disjunct.c.

497 {
498  char* tabs = sl_get_tab_string( in_tab );
499 
500  if (dj_full_p(in_dj)) { fprintf(in_fi, "%sDJ_FULL\n", tabs); return; }
501  if DJ_UNDEFINED_P(in_dj) { fprintf(in_fi, "%sDJ_UNDEFINED\n", tabs); return; }
502 
503  fprintf ( in_fi, "\n%s# -----DJ BEGIN-----\n", tabs );
504  sl_fprint_tab( in_fi, (Psyslist) in_dj, in_fu, in_tab );
505  fprintf ( in_fi, "\n%s# -----DJ END-----\n", tabs );
506 }
char * sl_get_tab_string(int in_tab)
char* sl_get_tab_string( in_tab ) returns a string of in_tab \t
Definition: sc_list.c:366
void sl_fprint_tab(FILE *in_fi, Psyslist in_sl, char *(*in_fu)(), int in_tab)
Definition: sc_list.c:383
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...

References dj_full_p(), DJ_UNDEFINED_P, fprintf(), sl_fprint_tab(), and sl_get_tab_string().

Referenced by dj_disjunct_complement(), dj_intersect_djcomp_ofl_ctrl(), and pa_path_to_few_disjunct_ofl_ctrl().

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

◆ dj_free()

Pdisjunct dj_free ( Pdisjunct  in_dj)

Pdisjunct dj_free( (Pdisjunct) in_dj ) AL 31/05/94 w - 1 depth free of input disjunction.

Parameters
in_djn_dj

Definition at line 69 of file disjunct.c.

70  { return (Pdisjunct) sl_free( (Psyslist) in_dj ); }
Psyslist sl_free(Psyslist psl)
Psyslist sl_free(Psyslist psl) BA, AL 30/05/94 w - 1 depth free.
Definition: sc_list.c:327

References sl_free().

Referenced by disjunction_to_region_sc(), dj_union(), pa_feasibility_ofl_ctrl(), pa_path_to_disjunct_ofl_ctrl(), pa_path_to_few_disjunct_ofl_ctrl(), pa_reduce_simple_complement(), and pa_system_difference_ofl_ctrl().

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

◆ dj_free1()

Pdisjunct dj_free1 ( Pdisjunct  in_dj)

Pdisjunct dj_free1( (Pdisjunct) in_dj ) AL 31/05/94 1st depth free of input disjunction.

Parameters
in_djn_dj

Definition at line 84 of file disjunct.c.

85  { return (Pdisjunct) sl_free1( (Psyslist) in_dj ); }
Psyslist sl_free1(Psyslist psl)
Psyslist sl_free1(Psyslist psl) AL 30/05/94 1 depth free.
Definition: sc_list.c:343

References sl_free1().

Referenced by disjunction_to_region_sc().

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

◆ dj_full()

Pdisjunct dj_full ( void  )

Pdisjunct dj_full() AL 18/11/93 Return full space disjunction = dj_new()

Definition at line 92 of file disjunct.c.

92 { return( dj_new() ); }

References dj_new().

Referenced by dj_disjunct_complement(), dj_dup(), dj_intersection_ofl_ctrl(), dj_system_complement(), pa_path_to_disjunct_ofl_ctrl(), and pa_path_to_few_disjunct_ofl_ctrl().

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

◆ dj_full_p()

bool dj_full_p ( Pdisjunct  in_dj)

dj_full_p( (Pdisjunct) in_dj ) AL 30/05/94 Returns True if in_dj = (NIL) ^ (NIL)

Parameters
in_djn_dj

Definition at line 98 of file disjunct.c.

100 {
101  return( (in_dj != DJ_UNDEFINED) &&
102  ( in_dj->succ == NULL ) &&
103  ( in_dj->psys == NULL ) );
104 }

References DJ_UNDEFINED.

Referenced by dj_append_system(), dj_disjunct_complement(), dj_dup(), dj_fprint_tab(), dj_intersect_djcomp_ofl_ctrl(), dj_intersection_ofl_ctrl(), dj_projection_along_variables_ofl_ctrl(), dj_simple_inegs_to_eg(), dj_union(), dj_variable_rename(), and dj_variable_substitution_with_eqs_ofl_ctrl().

+ Here is the caller graph for this function:

◆ dj_intersect_djcomp_ofl_ctrl()

Pdisjunct dj_intersect_djcomp_ofl_ctrl ( Pdisjunct  in_dj1,
Pdisjunct  in_dj2,
int  ofl_ctrl 
)

Pdisjunct dj_intersect_djcomp_ofl_ctrl( ) No sharing.

in_dj1 and in_dj2 stay as is.

Special cases

debuging

General cases

Parameters
in_dj1n_dj1
in_dj2n_dj2
ofl_ctrlfl_ctrl

Definition at line 173 of file disjunct.c.

176 {
177  Pdisjunct dj, ret_dj;
178 
179  /* Special cases */
180  if (DJ_UNDEFINED_P(in_dj1) || DJ_UNDEFINED_P(in_dj2)) return DJ_UNDEFINED;
181 
182  if (dj_empty_p( in_dj1 ) || dj_full_p(in_dj2)) return dj_empty();
183  if (dj_full_p ( in_dj1 )) return dj_disjunct_complement( in_dj2 );
184  if (dj_empty_p( in_dj2 )) return dj_dup( in_dj1 );
185 
186  /* debuging */
187  C3_DEBUG("dj_intersect_djcomp_ofl_ctrl",{
188  fprintf(stderr,"Inputs (in_dj1, then in_dj2):");
189  dj_fprint_tab(stderr, in_dj1, union_variable_name, 1);
190  dj_fprint_tab(stderr, in_dj2, union_variable_name, 1);
191  });
192 
193  /* General cases */
194  ret_dj = dj_empty();
195  for(dj = in_dj1; dj != NULL; dj = dj->succ ){
196  Ppath pa = pa_make( dj->psys, (Pcomplist) in_dj2 );
197  ret_dj = dj_union( ret_dj, pa_path_to_few_disjunct_ofl_ctrl( pa, ofl_ctrl ) );
198  free(pa);
199  }
200  C3_RETURN(IS_DJ, ret_dj);
201 }
Pdisjunct dj_disjunct_complement(Pdisjunct in_dj)
Returns complement of in_dj.
Definition: disjunct.c:299
Pdisjunct dj_union(Pdisjunct in_dj1, Pdisjunct in_dj2)
Pdisjunct dj_union( (Pdisjunct) in_dj1, (Pdisjunct) in_dj2 ) Give the union of the two disjunctions.
Definition: disjunct.c:211
Pdisjunct dj_empty()
Pdisjunct dj_empty() AL 18/11/93 Returns a disjunction with sc_empty() element.
Definition: disjunct.c:111
void free(void *)
Ppath pa_make(Psysteme in_ps, Pcomplist in_pcomp)
Package : C3/union Author : Arnauld LESERVOT (leservot(a)limeil.cea.fr) Date : Modified : 04 04 95 ...
Definition: path.c:53
Pdisjunct pa_path_to_few_disjunct_ofl_ctrl(Ppath in_pa, int ofl_ctrl)
line 1197 "reduc.w"
Definition: reduc.c:648

References C3_DEBUG, C3_RETURN, dj_disjunct_complement(), dj_dup(), dj_empty(), dj_empty_p(), dj_fprint_tab(), dj_full_p(), DJ_UNDEFINED, DJ_UNDEFINED_P, dj_union(), fprintf(), free(), IS_DJ, pa_make(), pa_path_to_few_disjunct_ofl_ctrl(), Ssyslist::psys, Ssyslist::succ, and union_variable_name.

+ Here is the call graph for this function:

◆ dj_intersect_system_ofl_ctrl()

Pdisjunct dj_intersect_system_ofl_ctrl ( in_dj  ,
in_ps  ,
ofl_ctrl   
)

Pdisjunct dj_intersect_system_ofl_ctrl( )

Definition at line 162 of file disjunct.c.

166 { return dj_intersection_ofl_ctrl( in_dj, sl_append_system(NULL, in_ps), ofl_ctrl ); }
Pdisjunct dj_intersection_ofl_ctrl(Pdisjunct in_dj1, Pdisjunct in_dj2, int ofl_ctrl)
Pdisjunct dj_intersection_ofl_ctrl( in_dj1, in_dj2, ofl_ctrl ) Computes intersection of two disjuncti...
Definition: disjunct.c:134

References dj_intersection_ofl_ctrl(), and sl_append_system().

+ Here is the call graph for this function:

◆ dj_intersection_ofl_ctrl()

Pdisjunct dj_intersection_ofl_ctrl ( Pdisjunct  in_dj1,
Pdisjunct  in_dj2,
int  ofl_ctrl 
)

Pdisjunct dj_intersection_ofl_ctrl( in_dj1, in_dj2, ofl_ctrl ) Computes intersection of two disjunctions.

AL,BC 23/03/95 Very costly function : -> sc_faisabilite_ofl_ctrl used. No sharing

empty intersection

Parameters
in_dj1n_dj1
in_dj2n_dj2
ofl_ctrlfl_ctrl

Definition at line 134 of file disjunct.c.

137 {
138  Pdisjunct dj1, dj2, ret_dj;
139 
140  if (DJ_UNDEFINED_P(in_dj1)||DJ_UNDEFINED_P(in_dj2)) return DJ_UNDEFINED ;
141  if (dj_full_p(in_dj1) && dj_full_p(in_dj2)) return dj_full() ;
142  if (dj_full_p(in_dj1)) return dj_dup(in_dj2) ;
143  if (dj_full_p(in_dj2)) return dj_dup(in_dj1) ;
144  if (dj_empty_p(in_dj1)||dj_empty_p(in_dj2)) return dj_empty() ;
145 
146  ret_dj = (Pdisjunct) NULL;
147  for(dj1 = in_dj1; dj1 != NULL; dj1 = dj1->succ) {
148  for(dj2 = in_dj2; dj2 != NULL; dj2 = dj2->succ) {
149  Psysteme ps = sc_append( sc_dup(dj1->psys), dj2->psys );
150  if (!sc_rational_feasibility_ofl_ctrl( ps, ofl_ctrl, true ))
151  { ps = sc_free( ps ); continue; }
152  ret_dj = (Pdisjunct) sl_append_system( ret_dj, ps );
153  }
154  }
155  if (ret_dj == (Pdisjunct) NULL) return dj_empty(); /* empty intersection */
156  return ret_dj;
157 }
Psysteme sc_dup(Psysteme ps)
Psysteme sc_dup(Psysteme ps): should becomes a link.
Definition: sc_alloc.c:176
Psysteme sc_append(Psysteme s1, Psysteme s2)
Psysteme sc_append(Psysteme s1, Psysteme s2): calcul de l'intersection des polyedres definis par s1 e...
Psysteme sc_free(Psysteme in_ps)
Psysteme sc_free( in_ps ) AL 30/05/94 Free of in_ps.
Definition: sc_list.c:112

References dj_dup(), dj_empty(), dj_empty_p(), dj_full(), dj_full_p(), DJ_UNDEFINED, DJ_UNDEFINED_P, Ssyslist::psys, sc_append(), sc_dup(), sc_free(), sc_rational_feasibility_ofl_ctrl(), sl_append_system(), and Ssyslist::succ.

Referenced by dj_intersect_system_ofl_ctrl(), and pa_path_to_disjunct_ofl_ctrl().

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

◆ dj_is_system_p()

bool dj_is_system_p ( Pdisjunct  in_dj)

bool dj_is_system_p( (Pdisjunct) in_dj ) AL 16/11/93 Returns True if disjunction in_dj has only one Psysteme in it.

Parameters
in_djn_dj

Definition at line 393 of file disjunct.c.

395 { return( sl_is_system_p( (Psyslist) in_dj ) ); }
bool sl_is_system_p(Psyslist in_sl)
bool sl_is_system_p( (Psyslist) in_sl ) AL 16/11/93 Returns True if syslist in_sl has only one Psyste...
Definition: sc_list.c:230

References sl_is_system_p().

+ Here is the call graph for this function:

◆ dj_new()

Pdisjunct dj_new ( void  )

Package : C3/union Author : Arnauld LESERVOT (leservot(a)limeil.cea.fr) Date :
Modified : 04 04 95 Documents: UNION.tex : `‘Extension de C3 aux unions de polyedres’' Comments :

cproto-generated files

           WARNING

THOSE FUNCTIONS ARE AUTOMATICALLY DERIVED

    FROM THE WEB SOURCES !

Ansi includes
Linear includes
Pdisjunct dj_new() AL 26/10/93 Allocate a new Pdisjunct

Definition at line 52 of file disjunct.c.

52 { return( (Pdisjunct) sl_new() ); }
Psyslist sl_new()
Psyslist sl_new() AL 26/10/93 Input : Nothing.
Definition: sc_list.c:277

References sl_new().

Referenced by dj_append_system(), and dj_full().

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

◆ dj_projection_along_variables_ofl_ctrl()

Pdisjunct dj_projection_along_variables_ofl_ctrl ( Pdisjunct  in_dj,
Pvecteur  in_pv,
int  ofl_ctrl 
)

Returns projection of in_dj along vars of in_pv.

Sharing : in_dj is modified

Parameters
in_djn_dj
in_pvn_pv
ofl_ctrlfl_ctrl

Definition at line 319 of file disjunct.c.

323 {
324  Pdisjunct dj;
325  if DJ_UNDEFINED_P(in_dj) return DJ_UNDEFINED;
326  if (dj_empty_p(in_dj)||dj_full_p(in_dj)) return in_dj;
327 
328  for(dj = in_dj; dj != NULL; dj = dj->succ)
329  { sc_projection_along_variables_ofl_ctrl( &(dj->psys), in_pv, ofl_ctrl ); }
330  return in_dj;
331 }

References dj_empty_p(), dj_full_p(), DJ_UNDEFINED, DJ_UNDEFINED_P, Ssyslist::psys, and Ssyslist::succ.

+ Here is the call graph for this function:

◆ dj_read()

Pdisjunct dj_read ( char*  nomfic)

void dj_read(FILE*) reads a Pdisjunct

Parameters
nomficomfic

Definition at line 510 of file disjunct.c.

512 { return ( (Pdisjunct) sl_read(nomfic) ); }
Psyslist sl_read(char *nomfic)
void sl_read(FILE*) reads a Psyslist
Definition: sc_list.c:461

References sl_read().

+ Here is the call graph for this function:

◆ dj_simple_inegs_to_eg()

Pdisjunct dj_simple_inegs_to_eg ( Pdisjunct  in_dj)

Pdisjunct dj_simple_inegs_to_eg( in_dj ) transforms two opposite inequalities in a simple equality in each system of the input disjunction.

Input disjunction is not modified.

Special case

General case

Compare with inequalities

Do we have ineq <= 0 and - ineq <= 0 ?

Parameters
in_djn_dj

Definition at line 339 of file disjunct.c.

341 {
342  Pdisjunct dj;
343  Pdisjunct ret_dj = NULL;
344 
345  /* Special case */
346  if (DJ_UNDEFINED_P(in_dj) || dj_empty_p(in_dj) || dj_full_p(in_dj))
347  return dj_dup(in_dj);
348 
349  /* General case */
350  for( dj = in_dj; dj != NULL; dj = dj->succ) {
351  Psysteme ps = dj->psys, new_ps;
352  Pcontrainte ineq;
353 
354  assert(!SC_UNDEFINED_P(ps)&&!sc_empty_p(ps)&&!sc_full_p(ps));
355 
356  if (ps->nb_ineq <= 1) {
357  ret_dj = sl_append_system( ret_dj, sc_dup( ps ));
358  continue;
359  }
360 
361  /* Compare with inequalities */
363  for (ineq = ps->inegalites; ineq != NULL; ineq = ineq->succ) {
364  Pcontrainte co, ineq2;
365  Pvecteur pv = vect_dup(ineq->vecteur);
366  vect_chg_sgn ( pv );
367  co = contrainte_make( pv );
368  ineq2 = contrainte_dup(ineq);
369 
370  /* Do we have ineq <= 0 and - ineq <= 0 ? */
371  if (contrainte_in_liste(co, ps->inegalites)) {
372  if ( !contrainte_in_liste(ineq, new_ps->egalites)
373  && !contrainte_in_liste(co, new_ps->egalites) )
374  sc_add_egalite( new_ps, ineq2 );
375  }
376  else { sc_add_inegalite( new_ps, ineq2 ); }
377  co = contrainte_free( co );
378  }
379 
380  new_ps->base = NULL;
381  sc_creer_base( new_ps );
382  ret_dj = (Pdisjunct) sl_append_system( ret_dj, new_ps );
383  }
384 
385  return ret_dj;
386 }
#define CONTRAINTE_UNDEFINED
Pcontrainte contrainte_make(Pvecteur pv)
Pcontrainte contrainte_make(Pvecteur pv): allocation et initialisation d'une contrainte avec un vecte...
Definition: alloc.c:73
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_dup(Pcontrainte c_in)
Pcontrainte contrainte_dup(Pcontrainte c_in): allocation d'une contrainte c_out prenant la valeur de ...
Definition: alloc.c:132
Pcontrainte contraintes_dup(Pcontrainte c_in)
Pcontrainte contraintes_dup(Pcontrainte c_in) a list of constraints is copied.
Definition: alloc.c:146
bool contrainte_in_liste(Pcontrainte, Pcontrainte)
listes.c
Definition: listes.c:52
#define assert(ex)
Definition: newgen_assert.h:41
Psysteme sc_make(Pcontrainte leg, Pcontrainte lineg)
Psysteme sc_make(Pcontrainte leg, Pcontrainte lineg): allocation et initialisation d'un systeme d'equ...
Definition: sc.c:78
void sc_creer_base(Psysteme ps)
void sc_creer_base(Psysteme ps): initialisation des parametres dimension et base d'un systeme lineair...
Definition: sc_alloc.c:129
void sc_add_egalite(Psysteme p, Pcontrainte e)
void sc_add_egalite(Psysteme p, Pcontrainte e): macro ajoutant une egalite e a un systeme p; la base ...
Definition: sc_alloc.c:389
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
bool sc_full_p(Psysteme in_ps)
Psysteme sc_full_p( in_ps ) similar to sc_new.
Definition: sc_list.c:61
void vect_chg_sgn(Pvecteur v)
void vect_chg_sgn(Pvecteur v): multiplie v par -1
Definition: scalaires.c:151
Pvecteur vecteur
struct Scontrainte * succ
Pcontrainte inegalites
Definition: sc-local.h:71
Pcontrainte egalites
Definition: sc-local.h:70
int nb_ineq
Definition: sc-local.h:73
Pvecteur vect_dup(Pvecteur v_in)
Pvecteur vect_dup(Pvecteur v_in): duplication du vecteur v_in; allocation de et copie dans v_out;.
Definition: alloc.c:51

References assert, contrainte_dup(), contrainte_free(), contrainte_in_liste(), contrainte_make(), CONTRAINTE_UNDEFINED, contraintes_dup(), dj_dup(), dj_empty_p(), dj_full_p(), DJ_UNDEFINED_P, Ssysteme::egalites, Ssysteme::inegalites, Ssysteme::nb_ineq, Ssyslist::psys, sc_add_egalite(), sc_add_inegalite(), sc_creer_base(), sc_dup(), sc_empty_p(), sc_full_p(), sc_make(), sl_append_system(), Scontrainte::succ, Ssyslist::succ, vect_chg_sgn(), vect_dup(), and Scontrainte::vecteur.

Referenced by pa_system_difference_ofl_ctrl().

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

◆ dj_system_complement()

Pdisjunct dj_system_complement ( Psysteme  in_ps)

Pdisjunct dj_system_complement( (Psystem) in_ps ) AL 26/10/93 Input : A Psysteme.

Output : A disjunction which is complement of in_ps.

debugging

v1 = 1*TCST to build complement system ...

Look for equalities

Look for inequalities

Parameters
in_psn_ps

Definition at line 254 of file disjunct.c.

256 {
257  Pdisjunct ret_dj = NULL;
258  Pvecteur v1 = NULL, pv = NULL;
259  Psysteme ps = NULL;
260  Pcontrainte eq = NULL, ineq = NULL;
261 
262  if ( in_ps == SC_UNDEFINED ) return DJ_UNDEFINED;
263  if (sc_empty_p(in_ps)) return dj_full();
264 
265  /* debugging */
266  C3_DEBUG("dj_system_complement (in_ps)",
267  {sc_fprint(stderr, in_ps, union_variable_name);});
268 
269 
270  /* v1 = 1*TCST to build complement system ... */
271  v1 = vect_new( TCST, VALUE_ONE);
272  /* Look for equalities */
273  for( eq = in_ps->egalites; eq != NULL; eq = eq->succ ) {
275  contrainte_make( vect_add( v1, eq->vecteur ) ) );
276  ret_dj = (Pdisjunct) sl_append_system( ret_dj, ps );
277  pv = vect_dup( eq->vecteur ); vect_chg_sgn( pv );
279  vect_rm( pv ); pv = NULL;
280  ret_dj = (Pdisjunct) sl_append_system( ret_dj, ps );
281 
282  }
283  /* Look for inequalities */
284  for(ineq = in_ps->inegalites; ineq != NULL; ineq = ineq->succ) {
285  pv = vect_dup(ineq->vecteur);
286  vect_chg_sgn( pv );
288  vect_rm( pv ); pv = NULL;
289  ret_dj = dj_append_system( ret_dj, ps );
290  }
291 
292  vect_rm( v1 );
293  C3_RETURN(IS_DJ, ret_dj);
294 }
#define VALUE_ONE
Pdisjunct dj_append_system(Pdisjunct in_dj, Psysteme in_ps)
Pdisjunct dj_append_system( (Pdisjunct) in_dj, (Psysteme) in_ps ) Input : A disjunct in_dj to wich in...
Definition: disjunct.c:403
Pcontrainte eq
element du vecteur colonne du systeme donne par l'analyse
Definition: sc_gram.c:108
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
#define TCST
VARIABLE REPRESENTANT LE TERME CONSTANT.
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
void vect_rm(Pvecteur v)
void vect_rm(Pvecteur v): desallocation des couples de v;
Definition: alloc.c:78
Pvecteur vect_add(Pvecteur v1, Pvecteur v2)
package vecteur - operations binaires
Definition: binaires.c:53

References C3_DEBUG, C3_RETURN, contrainte_make(), CONTRAINTE_UNDEFINED, dj_append_system(), dj_full(), DJ_UNDEFINED, Ssysteme::egalites, eq, Ssysteme::inegalites, IS_DJ, sc_empty_p(), sc_fprint(), sc_make(), sl_append_system(), Scontrainte::succ, TCST, union_variable_name, VALUE_ONE, vect_add(), vect_chg_sgn(), vect_dup(), vect_new(), vect_rm(), and Scontrainte::vecteur.

Referenced by analyze_quast(), dj_disjunct_complement(), pa_path_to_disjunct_ofl_ctrl(), and pa_reduce_simple_complement().

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

◆ dj_union()

Pdisjunct dj_union ( Pdisjunct  in_dj1,
Pdisjunct  in_dj2 
)

Pdisjunct dj_union( (Pdisjunct) in_dj1, (Pdisjunct) in_dj2 ) Give the union of the two disjunctions.

AL 15/11/93 Memory: systems of the 2 unions are shared. in_dj1 = dj_union(in_dj1,in_dj2); (in_dj1 = dj_free(in_dj1); to remove in_dj1 and in_dj2

Parameters
in_dj1n_dj1
in_dj2n_dj2

Definition at line 211 of file disjunct.c.

213 {
214  Pdisjunct dj;
215 
216  if (DJ_UNDEFINED_P(in_dj1) || DJ_UNDEFINED_P(in_dj2)) return DJ_UNDEFINED;
217  if (dj_empty_p( in_dj2 )) {dj_free(in_dj2); return in_dj1;}
218  if (dj_full_p ( in_dj2 )) {dj_free(in_dj1); return in_dj2;}
219  if (dj_empty_p( in_dj1 )) {dj_free(in_dj1); return in_dj2;}
220  if (dj_full_p ( in_dj1 )) {dj_free(in_dj2); return in_dj1;}
221 
222  for( dj = in_dj1; dj->succ != NULL; dj = dj->succ) {};
223  dj->succ = in_dj2;
224  return in_dj1;
225 }
Pdisjunct dj_free(Pdisjunct in_dj)
Pdisjunct dj_free( (Pdisjunct) in_dj ) AL 31/05/94 w - 1 depth free of input disjunction.
Definition: disjunct.c:69

References dj_empty_p(), dj_free(), dj_full_p(), DJ_UNDEFINED, DJ_UNDEFINED_P, and Ssyslist::succ.

Referenced by dj_intersect_djcomp_ofl_ctrl(), and pa_path_to_few_disjunct_ofl_ctrl().

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

◆ dj_variable_rename()

Pdisjunct dj_variable_rename ( Pdisjunct  in_dj,
Variable  in_vold,
Variable  in_vnew 
)

dj_variable_rename replaces in_vold with in_vnew : in_dj is modified

Parameters
in_djn_dj
in_voldn_vold
in_vnewn_vnew

Definition at line 417 of file disjunct.c.

421 {
422  Pdisjunct dj;
423  if DJ_UNDEFINED_P(in_dj) return DJ_UNDEFINED;
424  if (dj_empty_p(in_dj)||dj_full_p(in_dj)) return in_dj;
425 
426  for(dj = in_dj; dj != NULL; dj = dj->succ)
427  { sc_variable_rename( dj->psys, in_vold, in_vnew ); }
428  return in_dj;
429 }
Psysteme sc_variable_rename(Psysteme s, Variable v_old, Variable v_new)
Psysteme sc_variable_rename(Psysteme s, Variable v_old, Variable v_new): reecriture du systeme s remp...
Definition: sc.c:157

References dj_empty_p(), dj_full_p(), DJ_UNDEFINED, DJ_UNDEFINED_P, Ssyslist::psys, sc_variable_rename(), and Ssyslist::succ.

+ Here is the call graph for this function:

◆ dj_variable_substitution_with_eqs_ofl_ctrl()

Pdisjunct dj_variable_substitution_with_eqs_ofl_ctrl ( in_dj  ,
in_pc  ,
in_pv  ,
ofl_ctrl   
)

Pdisjunct dj_variable_substitution_with_eqs_ofl_ctrl() AL160595 Substitutes to all systems of disjunction in_dj definitions of variables in in_pv that are implied by in_pc.

in_pc are equality constraints that define uniquely each variable of in_pc. Function based on sc_variable_substitution_with_eq_ofl_ctrl().

Special cases

For each variable in in_pv, we should have one and only one constraint in in_pc that defines it. In each constraint, we should have only one variable in in_pv.

Find constraint def that defines var (only one !)

Assert that there is no other variable of in_pv that belongs to def

Assert that there is no other variable of in_pv that belongs to def

Definition at line 440 of file disjunct.c.

445 {
446  Pvecteur vec1;
447 
448  /* Special cases */
449  if (dj_full_p(in_dj)||dj_empty_p(in_dj)||DJ_UNDEFINED_P(in_dj)) return in_dj;
450 
451 
452  C3_DEBUG( "dj_variable_substitution_with_eqs_ofl_ctrl", {
453  dj_fprint ( stderr, in_dj, union_variable_name );
454  contrainte_fprint( stderr, in_pc, false, union_variable_name );
455  vect_fprint ( stderr, in_pv, union_variable_name );
456  });
457 
458 
459  /* For each variable in in_pv,
460  * we should have one and only one constraint in in_pc that defines it.
461  * In each constraint, we should have only one variable in in_pv.
462  */
463  for(vec1 = in_pv; vec1 != NULL; vec1 = vec1->succ) {
464  Variable var = vec1->var;
465  int found = 0;
466  Pcontrainte pr, def = NULL;
467  Pvecteur vec2 ;
468  Pdisjunct dj ;
469 
470  /* Find constraint def that defines var (only one !) */
471  for(pr = in_pc; pr != NULL; pr = pr->succ)
472  { if(vect_coeff(var, pr->vecteur) != 0) {found++; def = pr;} }
473  assert( found == 1);
474 
475  /* Assert that there is no other variable of in_pv that belongs to def */
476  for(vec2 = in_pv; vec2 != NULL; vec2 = vec2->succ) {
477  if (vec2->var == var) continue;
478  assert( vect_coeff( vec2->var, def->vecteur ) == 0 );
479  }
480 
481  /* Assert that there is no other variable of in_pv that belongs to def */
482  for(dj = in_dj; dj != NULL; dj = dj->succ)
483  { dj->psys = sc_variable_substitution_with_eq_ofl_ctrl(dj->psys, def, var, ofl_ctrl); }
484 
485  }
486  return( in_dj );
487 }
void contrainte_fprint(FILE *, Pcontrainte, bool, char *(*)(Variable))
io.c
void vect_fprint(FILE *f, Pvecteur v, get_variable_name_t variable_name)
void vect_fprint(FILE * f, Pvecteur v, char * (*variable_name)()): impression d'un vecteur creux v su...
Definition: io.c:124
Variable var
Definition: vecteur-local.h:90
struct Svecteur * succ
Definition: vecteur-local.h:92
#define dj_fprint(fi, dj, fu)
Definition: union-local.h:96
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
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

References assert, C3_DEBUG, contrainte_fprint(), dj_empty_p(), dj_fprint, dj_full_p(), DJ_UNDEFINED_P, Ssyslist::psys, Scontrainte::succ, Ssyslist::succ, Svecteur::succ, union_variable_name, Svecteur::var, vect_coeff(), vect_fprint(), and Scontrainte::vecteur.

+ Here is the call graph for this function: