net.sourceforge.combean.mathprog.grooml
Class GVariables

A set of variables with a common name and different indices. This object consists of - a set of (symbolic) index values of the variables in the set - a closure which generates the individual variables; the closure is called with the symbolic index of the variable and shall return a list of arguments which will be given to the constructor of a single GVariable (either only a single double value for the coefficient of the variable or the coefficient + a range of allowed values for the variable). - the environment in which the index variable shall be bound See the documentation of GVariable to see the supported constructors. This class is responsible for mapping between the simple indices of the variables in the LPVariableSequence and the symbolic indices in the GLPModel.

Field Summary
 Object env
           
 Closure generateVar
           
 GIndexBinding idxBinding
           
 
Constructor Summary
GVariables(String name, Object bindDef, Object env, Closure generateVar)
            Constructor Create a set of variables based on a binding of index variables.
 
Method Summary
GVariable constructVariable(def varDef)
           Construct a GVariable object.
LPVariable getLPVariable(int localColumn)
           Construct LP-variable that corresponds to a given simple numeric index in the variable sequence
int getLocalColumn(Object idx)
           Convert a symbolic index into a simple numeric index
LPModelIndex getModelIndex(Object idx)
          
String getName()
          
int getNumVars()
          
double getSolution(Object idx, GLPSolver solver)
          
Map getSolutions(GLPSolver solver)
          
void setName(String name)
          
String toString()
          
String toSummaryString()
          
def varIdx(int localColumn)
           Convert a simple numeric index into a symbolic index in the binding
 

Constructor Detail

GVariables

public GVariables(String name, Object bindDef, Object env, Closure generateVar)
Constructor Create a set of variables based on a binding of index variables. For each value in the value set of the binding, one variable is generated.
params:
name name of the variables
params:
idxMap definition of an index binding
params:
env environment in which the index binding is set
params:
generateVar closure which generates individual variables


Method Detail

constructVariable

GVariable constructVariable(def varDef)
Construct a GVariable object. Flatten the arguments, if varDef is a List.


getLPVariable

LPVariable getLPVariable(int localColumn)
Construct LP-variable that corresponds to a given simple numeric index in the variable sequence
params:
localColumn the index in the variable sequence
returns:
the corresponding LPVariable


getLocalColumn

public int getLocalColumn(Object idx)
Convert a symbolic index into a simple numeric index
params:
idx the symbolic index to be converted
returns:
the corresponding simple index


getModelIndex

LPModelIndex getModelIndex(Object idx)


getName

String getName()


getNumVars

int getNumVars()


getSolution

public double getSolution(Object idx, GLPSolver solver)


getSolutions

public Map getSolutions(GLPSolver solver)


setName

void setName(String name)


toString

public String toString()


toSummaryString

public String toSummaryString()


varIdx

def varIdx(int localColumn)
Convert a simple numeric index into a symbolic index in the binding