net.sourceforge.combean.samples.mathprog.lp.matrixrounding
Class MatrixToRoundAsLP

Package class diagram package MatrixToRoundAsLP
java.lang.Object
  extended by net.sourceforge.combean.mathprog.lp.model.AbstractLPModelComponent
      extended by net.sourceforge.combean.mathprog.lp.model.AbstractSimpleIndexLPModelComponent
          extended by net.sourceforge.combean.mathprog.lp.model.AbstractSimpleIndexLPConstrainedRows
              extended by net.sourceforge.combean.mathprog.lp.model.AbstractSimpleIndexLPConstrainedRowsWithVars
                  extended by net.sourceforge.combean.samples.mathprog.lp.matrixrounding.MatrixToRoundAsLP
All Implemented Interfaces:
AbstractMatrix, LPConstraintSequence, LPModelComponent, LPModelRows, LPVariableSequence

public class MatrixToRoundAsLP
extends AbstractSimpleIndexLPConstrainedRowsWithVars
implements LPModelRows, LPConstraintSequence, LPVariableSequence

A matrix rounding problem as linear program.


Field Summary
 
Fields inherited from class net.sourceforge.combean.mathprog.lp.model.AbstractSimpleIndexLPModelComponent
columnOffsetId, rowOffsetId
 
Fields inherited from interface net.sourceforge.combean.interfaces.mathprog.lp.model.LPConstraintSequence
OFFSET_UNDEFINED
 
Fields inherited from interface net.sourceforge.combean.interfaces.mathprog.lp.model.LPVariableSequence
OFFSET_UNDEFINED
 
Constructor Summary
MatrixToRoundAsLP(Matrix matrixToRound)
          Constructor
 
Method Summary
 LPConstraint getLPConstraint(int localRow)
          Get the constraint for a given (local) row index.
 LPVariable getLPVariable(int localColumn)
          Return the LP variable for a given local column index.
 int getNumColumns()
          Return the number of columns of the model component.
 int getNumRows()
          Return the number of rows of the model component.
 double[][] getRoundedMatrix(LPModelSolver solver)
          Translate the result of the solver back into a matrix of doubles
 LPSparseVector getRowVector(int localRow)
           
 
Methods inherited from class net.sourceforge.combean.mathprog.lp.model.AbstractSimpleIndexLPConstrainedRowsWithVars
getNumVars, getVarOffset, getVarOffsetId, isInteger, setVarOffset, setVarOffsetId
 
Methods inherited from class net.sourceforge.combean.mathprog.lp.model.AbstractSimpleIndexLPConstrainedRows
getConstrOffset, getConstrOffsetId, getNumConstrs, setConstrOffset, setConstrOffsetId
 
Methods inherited from class net.sourceforge.combean.mathprog.lp.model.AbstractSimpleIndexLPModelComponent
getColumnModelIndex, getColumnOffsetId, getColumnOffsetIds, getRowModelIndex, getRowOffsetId, getRowOffsetIds, setColumnOffsetId, setRowOffsetId
 
Methods inherited from class net.sourceforge.combean.mathprog.lp.model.AbstractLPModelComponent
getOrientation, setOrientation, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface net.sourceforge.combean.interfaces.mathprog.lp.model.LPModelRows
getRowModelIndex
 
Methods inherited from interface net.sourceforge.combean.interfaces.mathprog.lp.model.LPModelComponent
getColumnOffsetIds, getOrientation, getRowOffsetIds
 
Methods inherited from interface net.sourceforge.combean.interfaces.mathprog.lp.model.LPConstraintSequence
getConstrOffset, getConstrOffsetId, getNumConstrs, setConstrOffset, setConstrOffsetId
 
Methods inherited from interface net.sourceforge.combean.interfaces.mathprog.lp.model.LPVariableSequence
getNumVars, getVarOffset, getVarOffsetId, isInteger, setVarOffset, setVarOffsetId
 

Constructor Detail

MatrixToRoundAsLP

public MatrixToRoundAsLP(Matrix matrixToRound)
Constructor

Parameters:
matrixToRound - the matrix to be rounded
Method Detail

getNumColumns

public int getNumColumns()
Description copied from interface: AbstractMatrix
Return the number of columns of the model component.

Specified by:
getNumColumns in interface AbstractMatrix
Returns:
the number of columns.

getNumRows

public int getNumRows()
Description copied from interface: AbstractMatrix
Return the number of rows of the model component.

Specified by:
getNumRows in interface AbstractMatrix
Returns:
the number of rows.

getLPVariable

public LPVariable getLPVariable(int localColumn)
Description copied from interface: LPVariableSequence
Return the LP variable for a given local column index.

Specified by:
getLPVariable in interface LPVariableSequence
Parameters:
localColumn - the local column index.
Returns:
the correponding LP variable.

getRowVector

public LPSparseVector getRowVector(int localRow)
Specified by:
getRowVector in interface LPModelRows

getLPConstraint

public LPConstraint getLPConstraint(int localRow)
Description copied from interface: LPConstraintSequence
Get the constraint for a given (local) row index.

Specified by:
getLPConstraint in interface LPConstraintSequence
Parameters:
localRow - a local row index.
Returns:
the corresponding LP constraint.

getRoundedMatrix

public double[][] getRoundedMatrix(LPModelSolver solver)
Translate the result of the solver back into a matrix of doubles

Parameters:
solver - the solver which has solved the model "this".
Returns:
the result given by the solver converted to a matrix of doubles.