simplex.h
Go to the documentation of this file.00001 #ifndef SIMPLEXH
00002 #define SIMPLEXH
00003
00004 #include "box.h"
00005 #include "interval.h"
00006 #include "linear_constraint.h"
00007 #include "equation.h"
00008
00009 #if (_SIMPLEX_ENGINE==_GLPK)
00010 #include <glpk.h>
00015 #define SimplexType LPX
00016 #endif
00017
00018 #if (_SIMPLEX_ENGINE==_CLP)
00019 #include <Clp/Clp_C_Interface.h>
00024 #define SimplexType Clp_Simplex
00025 #endif
00026
00027 #if (_SIMPLEX_ENGINE==_LP_SOLVE)
00028 #include <lp_solve/lp_lib.h>
00033 #define SimplexType lprec
00034 #endif
00035
00055
00063 #define SIMPLEX_TIMEOUT 10
00064
00065
00073 typedef struct {
00074
00075 SimplexType *lp;
00077 #if (_SIMPLEX_ENGINE==_CLP)
00078 unsigned int fakeRows;
00080 double *lower;
00081 double *upper;
00082 double *obj;
00083 #endif
00084
00085 #if (_SIMPLEX_ENGINE==_LP_SOLVE)
00086 double inf;
00088 #endif
00089
00090 } TSimplex;
00091
00092
00093
00094
00106 void SimplexCreate(double epsilon,unsigned int ncols,TSimplex *s);
00107
00108
00116 void ResetSimplex(TSimplex *s);
00117
00127 unsigned int SimplexNColumns(TSimplex *s);
00128
00129
00139 unsigned int SimplexNRows(TSimplex *s);
00140
00150 void SimplexSetColBounds(unsigned int ncol,Tinterval *i,TSimplex *s);
00151
00161 void SimplexGetColBounds(unsigned int ncol,Tinterval *i,TSimplex *s);
00162
00172 void SimplexGetColConstraint(unsigned int ncol,TLinearConstraint *lc,TSimplex *s);
00173
00184 boolean SimplexColEmpty(unsigned int ncol,TSimplex *s);
00185
00196 double SimplexGetColPrimal(unsigned int ncol,TSimplex *s);
00197
00198
00209 double SimplexGetColDual(unsigned int ncol,TSimplex *s);
00210
00220 void SimplexSetRowBounds(unsigned int nrow,Tinterval *i,TSimplex *s);
00221
00231 void SimplexGetRowBounds(unsigned int nrow,Tinterval *i,TSimplex *s);
00232
00242 void SimplexGetRowConstraint(unsigned int nrow,TLinearConstraint *lc,TSimplex *s);
00243
00254 double SimplexGetRowPrimal(unsigned int nrow,TSimplex *s);
00255
00266 double SimplexGetRowDual(unsigned int nrow,TSimplex *s);
00267
00282 void SimplexAddNewConstraintRaw(TLinearConstraint *lc,
00283 TSimplex *s);
00284
00297 void SimplexSetOptimizationFunction(TLinearConstraint *obj,TSimplex *s);
00298
00307 void SimplexGetOptimizationFunction(TLinearConstraint *obj,TSimplex *s);
00308
00323 double SimplexGetOptimalValueRaw(TSimplex *s);
00324
00336 unsigned int SimplexSolve(TSimplex *s);
00337
00338
00346 void SimplexDelete(TSimplex *s);
00347
00348
00368 void SimplexExpandBounds(unsigned int eq_type,Tinterval *b);
00369
00370
00380 void SetSimplexBounds(Tbox *b,TSimplex *lp);
00381
00404 boolean SimplexAddNewConstraint(double epsilon,
00405 TLinearConstraint *lc,
00406 unsigned int eq_type,
00407 Tinterval *is,
00408 TSimplex *s);
00409
00431 double SimplexGetOptimalValue(unsigned int safe_simplex,double m,Tbox *b,TSimplex *s);
00432
00458 unsigned int ReduceRange(double epsilon,unsigned int safe_simplex,unsigned int nv,Tbox *b,TSimplex *lp);
00459 #endif