net.sourceforge.combean.mathprog.grooml
Class GLPSolver

Convenient Groovy frontend for a solver class written in Java.

Field Summary
 Map objective
           
 String solverId
           
 
Constructor Summary
GLPSolver()
           
 
Method Summary
GLPModel getGLPModel()
           Returns the model loaded into the solver.
int getLocalColumnIndex(String varId, Object index)
           Convert a variable name and an index into a (local) column index, i.e., an index local to the set of variables with the given name.
double getSolution(GTerm term)
           Evaluate a term with the current solution, i.e., replace the variable in the terms with its solution value.
double getSolution(String termDef)
           Variant of getSolution() where the term is given as String.
double getSolution(String offsetId, Object idx)
           Return the value of a given variable.
byte getSolutionStatus()
           Get the solution status of the solver.
double getSolutionValue()
           Get the objective value of the solution.
void setLPSolver(String solver)
           Set the LP solver engine.
void setObjective(String obj)
           Set the objective of the solver.
void solveMIP()
           Run the MIP solver.
 

Constructor Detail

GLPSolver

GLPSolver()


Method Detail

getGLPModel

public GLPModel getGLPModel()
Returns the model loaded into the solver.
returns:
the model loaded into the solver.


getLocalColumnIndex

int getLocalColumnIndex(String varId, Object index)
Convert a variable name and an index into a (local) column index, i.e., an index local to the set of variables with the given name.
params:
varId the name of the variables
params:
index the symbolic index of the variable
returns:
the local index of the corresponding variable


getSolution

public double getSolution(GTerm term)
Evaluate a term with the current solution, i.e., replace the variable in the terms with its solution value.
params:
term the term which shall be evaluated
returns:
the value of the term when the variable in the term is replace
by its solution value.


getSolution

public double getSolution(String termDef)
Variant of getSolution() where the term is given as String.
params:
term definition as String
returns:
the value of the term with the current solution value for the variable


getSolution

public double getSolution(String offsetId, Object idx)
Return the value of a given variable.
params:
offsetId the id of the variable
params:
idx the symbolic index of the variable
returns:
the solution value of the variable


getSolutionStatus

public byte getSolutionStatus()
Get the solution status of the solver.
returns:
the solution status.


getSolutionValue

public double getSolutionValue()
Get the objective value of the solution.
returns:
the objective value of the solution.


setLPSolver

public void setLPSolver(String solver)
Set the LP solver engine.
params:
solver identifier of the solver engine to be used
todo:
reprogram this in a way such that there is no static dependency
on the solver classes


setObjective

public void setObjective(String obj)
Set the objective of the solver.
params:
the objective encoded as String ('min' or 'max')


solveMIP

public void solveMIP()
Run the MIP solver.
throw:
GModelException if the solver does not support solving MIPs.