net.sourceforge.combean.mathprog.grooml
Class GRow

A single row of an LP model, i.e., a binding of an expression to a concrete LP model. Implements the LPSparseVector interface, i.e., can directly be used together with a Combean LP model. This object consists of - a constraint (i.e. the rhs of the row) - an expression (i.e. the lhs of the row) - a reference to an LP model (required to retrieve the columns in the LP when a concrete sparse LP vector is generated from the expression)

Field Summary
 GConstraint constr
           
 Object env
           
 GExpression expr
           
 GLPModel lpModel
           
 int numIter
           
 
Constructor Summary
GRow(GExpression expr, GConstraint constr)
            Constructor (without setting an environment and an LP model yet).
GRow(GExpression expr, GConstraint constr, GLPModel lpModel, Object env)
            Constructor.
 
Method Summary
static GRow convert(Object rowDef, String name, GLPModel lpModel, Object env)
           Convert a row definition to a row object.
GConstraint getConstraint()
          
GExpression getExpr()
          
GLPModel getLPModel()
          
int getNumIterations()
           lhs of the row.
void initNumIter()
           Helper function: calculate the number of non-zero entries in the sparse vector on the lhs of the row.
VectorIterator iterator()
          
void setConstraint(GConstraint constr)
           Set the rhs of the row.
void setEnv(Object env)
           Set the environment.
void setLPModel(GLPModel lpModel)
          
String toString()
          
String toSummaryString()
          
 

Constructor Detail

GRow

public GRow(GExpression expr, GConstraint constr)
Constructor (without setting an environment and an LP model yet). This constructor is used for generating a preliminary row object during the step-wise construction using the operators of the model arithmetic category.
params:
expr the expression on the lhs of the row
params:
constr the constraint on the rhs of the row


GRow

public GRow(GExpression expr, GConstraint constr, GLPModel lpModel, Object env)
Constructor. This constructor does not yet set the constraint on the rhs of the row!
params:
expr the expression of the lhs of the row
params:
constr the constraint on the rhs of the row
params:
lpModel the LP model in which the expression shall be
evaluated
params:
env the environment in which the expression shall be
evaluated


Method Detail

convert

public static GRow convert(Object rowDef, String name, GLPModel lpModel, Object env)
Convert a row definition to a row object. The row may be defined by an object of the following types: - a row (simple - no conversion necessary in that case) - a List with two elements [the expression for lhs, a String containing the definition of the constraint on the rhs]
params:
rowDef the definition of the row object.
params:
name the name of the constraint
params:
lpModel the LP model in which the constraint shall be evaluated
params:
env the environment in which the constraint shall be evaluated
todo:
streamline inconsistent interface (name is only used if List
is given as argument)
todo:
add support for row definition by a single string, e.g. "x[1] <= 2.0"


getConstraint

public GConstraint getConstraint()


getExpr

public GExpression getExpr()


getLPModel

public GLPModel getLPModel()
returns:
the LP model


getNumIterations

public int getNumIterations()
returns:
the number of non-zero entries in the sparse vector on the
lhs of the row.


initNumIter

void initNumIter()
Helper function: calculate the number of non-zero entries in the sparse vector on the lhs of the row.
todo:
make this more efficient in cases when the number of iterations
is known before hand.


iterator

public VectorIterator iterator()
returns:
a vector iterator for the expression (the lhs) of the row


setConstraint

void setConstraint(GConstraint constr)
Set the rhs of the row. Used for step-wise construction of the object. Don't use this for other purposes.


setEnv

public void setEnv(Object env)
Set the environment. Used for step-wise construction of the object. Don't use this for other purposes.


setLPModel

public void setLPModel(GLPModel lpModel)


toString

public String toString()


toSummaryString

public String toSummaryString()