PIPS
sc_oppose.c
Go to the documentation of this file.
1
/*
2
3
$Id: sc_oppose.c 1641 2016-03-02 08:20:19Z 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 sc */
26
27
#ifdef HAVE_CONFIG_H
28
#include "config.h"
29
#endif
30
31
#include <stdio.h>
32
#include <string.h>
33
#include <stdlib.h>
34
35
#include "
boolean.h
"
36
#include "
arithmetique.h
"
37
#include "
vecteur.h
"
38
#include "
contrainte.h
"
39
#include "
sc.h
"
40
41
/* Psysteme sc_oppose(Psysteme ps): calcul, pour un systeme de
42
* contraintes sans egalites, du systeme de contraintes dont les
43
* inegalites sont les negations des inegalites originelles;
44
* attention, cela ne calcule pas le complementaire, qui n'est
45
* d'aileurs pas un polyedre!
46
*
47
* Pour chaque inegalite de, AX <= B, on construit une inegalites "opposee"
48
* AX > B approximee par -AX <= -B
49
*
50
* Un systeme non trivial risque fort d'etre transforme en systeme non
51
* faisable. For instance, -1<=x<=1 is changed into 1<=-x<=-1.
52
*
53
* The function aborts if ps contains equalities.
54
*
55
* The constraint system ps is modified by side effect and
56
* returned. No new system is allocated.
57
*/
58
Psysteme
sc_oppose
(ps)
59
Psysteme
ps;
60
{
61
Pcontrainte
eq
;
62
63
if
(ps->nb_eq != 0) {
64
(void)
fprintf
(stderr,
"sc_oppose: systeme contenant des egalites\n"
);
65
abort
();
66
}
67
68
for
(
eq
= ps->inegalites;
eq
!= (
Pcontrainte
)NULL;
eq
=
eq
->
succ
)
69
(void)
vect_multiply
(
eq
->
vecteur
,
VALUE_MONE
);
70
71
return
(ps);
72
}
VALUE_MONE
#define VALUE_MONE
Definition:
arithmetique-local.h:304
arithmetique.h
boolean.h
contrainte.h
abort
#define abort()
Definition:
misc-local.h:53
sc.h
eq
Pcontrainte eq
element du vecteur colonne du systeme donne par l'analyse
Definition:
sc_gram.c:108
fprintf
int fprintf()
test sc_min : ce test s'appelle par : programme fichier1.data fichier2.data ...
sc_oppose
Psysteme sc_oppose(Psysteme ps)
package sc
Definition:
sc_oppose.c:58
vect_multiply
Pvecteur vect_multiply(Pvecteur v, Value x)
Pvecteur vect_multiply(Pvecteur v, Value x): multiplication du vecteur v par le scalaire x,...
Definition:
scalaires.c:123
Scontrainte
Definition:
contrainte-local.h:86
Scontrainte::vecteur
Pvecteur vecteur
Definition:
contrainte-local.h:89
Scontrainte::succ
struct Scontrainte * succ
Definition:
contrainte-local.h:90
Ssysteme
Definition:
sc-local.h:69
vecteur.h
linear
src
sc
sc_oppose.c
Generated on Thu Sep 26 2024 22:11:30 for PIPS by
1.9.1