PIPS
|
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "linear_assert.h"
#include "boolean.h"
#include "arithmetique.h"
#include "vecteur.h"
#include "contrainte.h"
Go to the source code of this file.
Functions | |
static Value | fprint_contrainte_vecteur (FILE *fp, Pvecteur v, char *(*variable_name)(Variable)) |
package contrainte - operations d'entree-sortie More... | |
void | contrainte_fprint (FILE *fp, Pcontrainte c, bool is_inegalite, char *(*variable_name)(Variable)) |
void | egalite_fprint (FILE *fp, Pcontrainte eg, char *(*variable_name)(Variable)) |
void egalite_fprint(FILE * fp, Pcontrainte eg, char * (*variable_name)()): impression d'une egalite eg dans le fichier fp avec des noms de variables donnes par variable_name; voir contrainte_fprint More... | |
void | egalite_dump (Pcontrainte c) |
void egalite_dump(Pcontrainte c): impression "physique" d'une egalite; utilise en debugging More... | |
void | inegalite_fprint (FILE *fp, Pcontrainte ineg, char *(*variable_name)(Variable)) |
void inegalite_fprint(FILE * fp, Pcontrainte ineg, char * (*variable_name)()): impression d'une inegalite ineg dans le fichier fp avec des noms de variables donnes par variable_name; voir contrainte_fprint More... | |
void | inegalite_dump (Pcontrainte c) |
void inegalite_dump(Pcontrainte c): impression "physique" d'une inegalite; utilise en debugging More... | |
void | egalites_fprint (FILE *fp, Pcontrainte eg, char *(*variable_name)(Variable)) |
void egalites_fprint(FILE * fp, Pcontrainte eg, char * (*variable_name)()): impression d'une liste d'egalites eg dans le fichier fp avec des noms de variables donnes par variable_name; voir contrainte_fprint More... | |
void | egalites_dump (Pcontrainte eg) |
void | inegalites_fprint (FILE *fp, Pcontrainte ineg, char *(*variable_name)(Variable)) |
void inegalites_fprint(FILE * fp, Pcontrainte ineg, char * (*variable_name)()): impression d'une liste d'inegalites ineg dans le fichier fp avec des noms de variables donnes par variable_name; voir contrainte_fprint More... | |
void | inegalites_dump (Pcontrainte eg) |
void | sprint_operator (char *s, bool is_inegalite, bool a_la_fortran) |
static char * | heuristique_1 (char *s, Pvecteur v, bool is_inegalite, char *(*variable_name)(Variable), bool a_la_fortran) |
static char * | heuristique_3 (char *s, Pvecteur v, bool is_inegalite, char *(*variable_name)(Variable), bool a_la_fortran) |
char * | contrainte_sprint (char *s, Pcontrainte c, bool is_inegalite, char *(*variable_name)(Variable)) |
char * contrainte_sprint(char * s, Pcontrainte c, bool is_inegalite, char * (*variable_name)()): Traduction d'une contrainte c en une chaine s de caracteres ASCII. More... | |
char * | contrainte_sprint_format (char *s, Pcontrainte c, bool is_inegalite, char *(*variable_name)(Variable), bool a_la_fortran) |
char * | egalite_sprint (char *s, Pcontrainte eg, char *(*variable_name)(Variable)) |
void egalite_fprint(FILE * fp, Pcontrainte eg, char * (*variable_name)()): impression d'une egalite eg dans la chaine s avec des noms de variables donnes par variable_name; voir contrainte_sprint More... | |
char * | inegalite_sprint (char *s, Pcontrainte ineg, char *(*variable_name)(Variable)) |
char * | egalite_sprint_format (char *s, Pcontrainte eg, char *(*variable_name)(Variable), bool a_la_fortran) |
char * | inegalite_sprint_format (char *s, Pcontrainte ineg, char *(*variable_name)(Variable), bool a_la_fortran) |
void contrainte_fprint | ( | FILE * | fp, |
Pcontrainte | c, | ||
bool | is_inegalite, | ||
char * (*)(Variable) | variable_name | ||
) |
Definition at line 123 of file io.c.
References assert, CONTRAINTE_UNDEFINED_P, contrainte_vecteur, fprint_contrainte_vecteur(), fprint_Value(), fprintf(), value_uminus, VALUE_ZERO, variable_name(), vect_check(), and VECTEUR_NUL.
Referenced by egalite_fprint(), egalites_fprint(), inegalite_fprint(), and inegalites_fprint().
char* contrainte_sprint | ( | char * | s, |
Pcontrainte | c, | ||
bool | is_inegalite, | ||
char * (*)(Variable) | variable_name | ||
) |
char * contrainte_sprint(char * s, Pcontrainte c, bool is_inegalite, char * (*variable_name)()): Traduction d'une contrainte c en une chaine s de caracteres ASCII.
Les noms des variables sont recuperes via la fonction variable_name(). Egalites et inegalites sont traitees.
La chaine s doit avoir ete allouee par le programme appelant, avec une longueur suffisante. Pour etre propre, il faudrait aussi passer cette longueur.
Plusieurs heuristiques d'impression ont ete proposees:
Pour avoir de bons resultats, il doit sans doute falloir faire du cas par cas, distinguer les egalites des inegalites et prendre en compte le nombre de termes de la contrainte. A ameliorer experimentalement.
Note: variable_name() should return an empty string for constant terms
Modifications:
Definition at line 424 of file io.c.
References contrainte_sprint_format(), and variable_name().
Referenced by egalite_sprint(), and inegalite_sprint().
char* contrainte_sprint_format | ( | char * | s, |
Pcontrainte | c, | ||
bool | is_inegalite, | ||
char *(*)(Variable) | variable_name, | ||
bool | a_la_fortran | ||
) |
Definition at line 435 of file io.c.
References assert, contrainte_error(), CONTRAINTE_UNDEFINED_P, contrainte_vecteur, heuristique_1(), heuristique_3(), variable_name(), vect_check(), and VECTEUR_NUL.
Referenced by contrainte_sprint(), egalite_sprint_format(), and inegalite_sprint_format().
void egalite_dump | ( | Pcontrainte | c | ) |
void egalite_dump(Pcontrainte c): impression "physique" d'une egalite; utilise en debugging
Definition at line 160 of file io.c.
References egalite_fprint(), and variable_debug_name.
void egalite_fprint | ( | FILE * | fp, |
Pcontrainte | eg, | ||
char *(*)(Variable) | variable_name | ||
) |
void egalite_fprint(FILE * fp, Pcontrainte eg, char * (*variable_name)()): impression d'une egalite eg dans le fichier fp avec des noms de variables donnes par variable_name; voir contrainte_fprint
Ancien nom: eg_print(), print_eq()
Definition at line 152 of file io.c.
References contrainte_fprint(), and variable_name().
Referenced by egalite_dump().
char* egalite_sprint | ( | char * | s, |
Pcontrainte | eg, | ||
char * (*)(Variable) | variable_name | ||
) |
void egalite_fprint(FILE * fp, Pcontrainte eg, char * (*variable_name)()): impression d'une egalite eg dans la chaine s avec des noms de variables donnes par variable_name; voir contrainte_sprint
Definition at line 468 of file io.c.
References contrainte_sprint(), and variable_name().
char* egalite_sprint_format | ( | char * | s, |
Pcontrainte | eg, | ||
char * (*)(Variable) | variable_name, | ||
bool | a_la_fortran | ||
) |
Definition at line 486 of file io.c.
References contrainte_sprint_format(), and variable_name().
void egalites_dump | ( | Pcontrainte | eg | ) |
eg | g |
Definition at line 201 of file io.c.
References egalites_fprint(), and variable_debug_name.
void egalites_fprint | ( | FILE * | fp, |
Pcontrainte | eg, | ||
char * (*)(Variable) | variable_name | ||
) |
void egalites_fprint(FILE * fp, Pcontrainte eg, char * (*variable_name)()): impression d'une liste d'egalites eg dans le fichier fp avec des noms de variables donnes par variable_name; voir contrainte_fprint
Ancien nom: fprint_leq()
Definition at line 192 of file io.c.
References contrainte_fprint(), Scontrainte::succ, and variable_name().
Referenced by egalites_dump().
|
static |
package contrainte - operations d'entree-sortie
modifications :
tre a_la_fortran pour une impression compatible avec Fortran (permet a
certains logiciels externes de re'cupe'rer les syste`mes sous un format compatible au leur. BA, avril 1994. INTLIBRARY void contrainte_fprint(FILE * fp, Pcontrainte c, bool is_inegalite, char * (*variable_name)()):imprime dans le fichier fp la contrainte c, de type egalite ou inegalite suivant la valeur du booleen is_inegalite, en utilisant la fonction variable_name pour trouver les noms des variables.
Pour suivre les convention usuelles, le terme constant est imprime comme membre droit.
On considere que CONTRAINTE_UNDEFINED => CONTRAINTE_NULLE
Resultat: 2 * I - J = 4 LF -I + 3 * J <= 5 LF
Note: l'impression se termine par un LF aucun routine ne sait lire ce format ancien nom eq_print returns the constant
on admet plusieurs occurences du terme constant!?!
To handle cases where the constraint only has constant (this is a bug somewhere, we must remove the constraint). If we print: "<= constant ," then sc_fscan cannot read this output, so let's print: " constant <= constant ," which is readable by sc_fscan, and doesn't change the sc.
Definition at line 74 of file io.c.
References fprint_Value(), fprintf(), Svecteur::succ, TCST, val_of, value_addto, value_notone_p, value_notzero_p, value_pos_p, value_uminus, VALUE_ZERO, var_of, variable_name(), and VECTEUR_NUL_P.
Referenced by contrainte_fprint().
|
static |
on admet plusieurs occurences du terme constant!?!
Definition at line 231 of file io.c.
References sprint_operator(), sprint_Value(), Svecteur::succ, TCST, val_of, value_addto, value_notone_p, value_notzero_p, value_pos_p, value_uminus, VALUE_ZERO, var_of, variable_name(), and VECTEUR_NUL_P.
Referenced by contrainte_sprint_format().
|
static |
Save the constant term for future use
And now, a lie... In fact, rhs_terms++
Definition at line 275 of file io.c.
References assert, sprint_operator(), sprint_Value(), Svecteur::succ, TCST, term_cst, value_mone_p, value_neg_p, value_notzero_p, value_one_p, value_pos_p, value_uminus, var_of, variable_name(), vect_chg_sgn(), VECTEUR_NUL_P, vecteur_val, and vecteur_var.
Referenced by contrainte_sprint_format().
void inegalite_dump | ( | Pcontrainte | c | ) |
void inegalite_dump(Pcontrainte c): impression "physique" d'une inegalite; utilise en debugging
Definition at line 182 of file io.c.
References inegalite_fprint(), and variable_debug_name.
void inegalite_fprint | ( | FILE * | fp, |
Pcontrainte | ineg, | ||
char * (*)(Variable) | variable_name | ||
) |
void inegalite_fprint(FILE * fp, Pcontrainte ineg, char * (*variable_name)()): impression d'une inegalite ineg dans le fichier fp avec des noms de variables donnes par variable_name; voir contrainte_fprint
Ancien nom: ineg_print(), print_ineq()
Definition at line 171 of file io.c.
References contrainte_fprint(), and variable_name().
Referenced by inegalite_dump().
char* inegalite_sprint | ( | char * | s, |
Pcontrainte | ineg, | ||
char * (*)(Variable) | variable_name | ||
) |
Definition at line 477 of file io.c.
References contrainte_sprint(), and variable_name().
char* inegalite_sprint_format | ( | char * | s, |
Pcontrainte | ineg, | ||
char * (*)(Variable) | variable_name, | ||
bool | a_la_fortran | ||
) |
Definition at line 497 of file io.c.
References contrainte_sprint_format(), and variable_name().
void inegalites_dump | ( | Pcontrainte | eg | ) |
eg | g |
Definition at line 220 of file io.c.
References inegalites_fprint(), and variable_debug_name.
Referenced by build_convex_constraints_from_vertices(), check_coefficient_reduction(), and sc_bounded_normalization().
void inegalites_fprint | ( | FILE * | fp, |
Pcontrainte | ineg, | ||
char * (*)(Variable) | variable_name | ||
) |
void inegalites_fprint(FILE * fp, Pcontrainte ineg, char * (*variable_name)()): impression d'une liste d'inegalites ineg dans le fichier fp avec des noms de variables donnes par variable_name; voir contrainte_fprint
Ancien nom: fprint_lineq()
Definition at line 211 of file io.c.
References contrainte_fprint(), Scontrainte::succ, and variable_name().
Referenced by inegalites_dump().
is_inegalite | s_inegalite |
a_la_fortran | _la_fortran |
Definition at line 224 of file io.c.
Referenced by heuristique_1(), and heuristique_3().