KrisLibrary  1.0.0
GLPKInterface.h
1 #ifndef OPTIMIZATION_GLPK_INTERFACE_H
2 #define OPTIMIZATION_GLPK_INTERFACE_H
3 
4 #include "LinearProgram.h"
5 #if HAVE_GLPK
6 
7 #include <glpk.h>
8 
9 #else
10 #define glp_prob void
11 #endif
12 
13 namespace Optimization {
14 
20 {
21  GLPKInterface();
22  ~GLPKInterface();
23  //easiest interface
24  void Set(const LinearProgram& LP);
25  void Set(const LinearProgram_Sparse& LP);
26  LinearProgram::Result Solve(Vector& xopt);
27  //low level commands
28  void Create(int m,int n);
29  void Clear();
30  void SetObjective(const Vector& c,bool minimize=true);
31  void SetRow(int i,const Vector& Ai);
32  void SetRowBounds(int i,Real low,Real high);
33  void SetVariableBounds(int j,Real low,Real high);
34 
35  //warm starting the solver
36  void SetRowBasic(int i); //inactive
37  void SetRowNonBasic(int i,bool upper=false); //active
38  void SetVariableBasic(int i); //inactive
39  void SetVariableNonBasic(int i,bool upper=false); //active
40  bool GetRowBasic(int i); //inactive
41  bool GetVariableBasic(int i); //inactive
42  double GetRowDual(int i);
43  double GetVariableDual(int j);
44 
45  static bool Enabled();
46  static void SelfTest();
47 
48  glp_prob* lp;
49 };
50 
51 } //namespace Optimization
52 
53 #endif
An interface to the GLPK linear program solver. Activated with the HAVE_GLPK preprocessor define...
Definition: GLPKInterface.h:19
Namespace for classes and functions in the Optimization package.
Definition: CSet.h:7
Linear program definition with sparse matrix A.
Definition: LinearProgram.h:158
Linear program definition.Represents the LP min/max c.x subject to qi <= ai.x <= pi lj <= xj <= u...
Definition: LinearProgram.h:139