Hermes
0.9.5-beta
Hierarchical Distributed I/O Buffering System
|
#include <linprog.h>
Public Member Functions | |
LinearProgram (const char *name) | |
~LinearProgram () | |
void | DefineDimension (int num_vars, int num_constraints) |
void | AddConstraint (const std::string &base_name, int op_type, double lb, double ub) |
void | SetConstraintCoeff (int var, double val) |
void | SetVariableBounds (const std::string &base_name, int var, int op_type, double lb, double ub) |
void | SetObjective (int objective) |
void | SetObjectiveCoeff (int var, double val) |
void | Solve () |
bool | IsOptimal () |
double | GetSolution () |
double | GetVariable (int var) |
std::vector< double > | ToVector () |
Private Attributes | |
int | num_vars_ |
int | num_constraints_ |
glp_prob * | lp_ |
std::vector< int > | ia_ |
std::vector< int > | ja_ |
std::vector< double > | ar_ |
size_t | cur_constraint_ |
size_t | result_ |
A structure to represent linear program
|
inlineexplicit |
Initialize linear program solver with name.
|
inline |
Clean up resources used by the GLPK solver.
|
inline |
Define the problem size using num_vars and num_constraints.
|
inline |
Add a constraint to the GLPK solver.
|
inline |
Set coefficient value as val for the var variable.
|
inline |
Set the upper and lower bound for var variable.
|
inline |
Set the objective function to optimize.
|
inline |
Set the coefficients of objective function.
|
inline |
Solve the problem.
|
inline |
Check if optimal solution exists.
|
inline |
Get solution.
|
inline |
Get the values for optimal solution.
|
inline |
Collect the values as a vector.
|
private |
number of variables
|
private |
number of constraints
|
private |
pointer to GLPK problem solver
|
private |
The "i" in A[i][j]
|
private |
The "j" in A[i][j]
|
private |
values for A[i][j]
|
private |
current constraint
|
private |
result of solver