PIPS
sc_simplex_feasibility.c
Go to the documentation of this file.
1 /*
2 
3  $Id: sc_simplex_feasibility.c 1669 2019-06-26 17:24:57Z coelho $
4 
5  Copyright 1989-2016 MINES ParisTech
6 
7  This file is part of Linear/C3 Library.
8 
9  Linear/C3 Library is clear 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 clear 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 /**
26  * @file
27  * This file provides a function to test whether a constraint system is
28  * feasible, using simplex method.
29  */
30 
31 #ifdef HAVE_CONFIG_H
32 #include "config.h"
33 #endif
34 
35 #include <stdlib.h>
36 
37 #include "boolean.h"
38 #include "linear_assert.h"
39 #include "vecteur.h"
40 #include "contrainte.h"
41 #include "sc.h"
42 
43 #define WNOGMP (fprintf(stderr, "[" __FILE__ "] linear was compiled without GMP support\n"))
44 
45 static bool usegmp()
46 {
47  char* env = getenv("LINEAR_USE_GMP");
48  return env && atoi(env) != 0;
49 }
50 
51 /**
52  * Main Function
53  */
54 /**@{*/
55 
56 /**
57  * Determine whether a system @a sys of equations and inequations is feasible.
58  * Parameter @a ofl_ctrl indicates whether an overflow control is performed
59  * (possible values: @c NO_OFL_CTRL, @c FWD_OFL_CTRL).
60  */
62 {
63  if (usegmp()) {
64 #ifdef HAVE_GMP_H
65  return sc_simplex_feasibility_ofl_ctrl_mulprec(sys, ofl_ctrl);
66 #else
67  WNOGMP;
68  return sc_simplex_feasibility_ofl_ctrl_fixprec(sys, ofl_ctrl);
69 #endif
70  }
71  else {
72  return sc_simplex_feasibility_ofl_ctrl_fixprec(sys, ofl_ctrl);
73  }
74 }
75 
76 /**@}*/
77 
static jmp_buf env
Definition: genClib.c:2473
#define WNOGMP
bool sc_simplex_feasibility_ofl_ctrl(Psysteme sys, int ofl_ctrl)
Main Function.
static bool usegmp()
bool sc_simplex_feasibility_ofl_ctrl_fixprec(Psysteme sc, int ofl_ctrl)
fonction de calcul de la faisabilite' d'un systeme d'equations et d'inequations Auteur : Robert Mahl,...