org.akutan.optimization
Class RevisedSimplex

java.lang.Object
  extended by org.akutan.optimization.RevisedSimplex

public class RevisedSimplex
extends java.lang.Object


Field Summary
 cern.colt.matrix.DoubleMatrix2D A
           
static int Artificial
           
 boolean ArtificialAdded
           
 cern.colt.matrix.DoubleMatrix1D b
           
 cern.colt.matrix.DoubleMatrix2D B
           
static int BasicType
           
 int[] BasicVariables
           
 cern.colt.matrix.DoubleMatrix2D Bt
           
 cern.colt.matrix.DoubleMatrix2D colOfA
           
 int[] constraintType
           
static int Continue
           
 double[] cost
           
 int CurrentStep
           
 int EnteringVariable
           
static int Feasible
           
 int LeavingVariable
           
 cern.colt.matrix.DoubleMatrix2D littleCost
           
 double MinRatio
           
static int NonBasicType
           
 int[] NonBasicVariables
           
 int NumArtificials
           
 int numConstraints
           
 int NumIterations
           
 int NumMinRatio
           
 int numNonbasic
           
 int numVariables
           
 double objectiveValue
           
static int Optimal
           
 cern.colt.matrix.DoubleMatrix2D pi
           
 double[] reducedCost
           
static int Regular
           
static int SlackOrSurplus
           
 boolean TypeMinimize
           
static int Unbounded
           
 int[] varType
           
 double[] x
           
 cern.colt.matrix.DoubleMatrix2D yB
           
 
Constructor Summary
RevisedSimplex(int nv, int nc)
          Constructs
 
Method Summary
 void addConstraint(Constraint cons)
          Add a constraint to the list of constraints
 int AugmentBasis(int BasisSize)
           
 double calculateObjective()
          Evaluate the objective function for the current point
 void calculateReducedCosts()
           
 void ChooseEnteringVariable()
          Choose new variable to enter the active set
 void chooseLeavingVariable()
          Choose new variable to leave the active set
 double Dot(cern.colt.matrix.DoubleMatrix2D row, cern.colt.matrix.DoubleMatrix2D col, int size)
          Returns the dot product of the two vectors, but the vectors are stored as 2D matrices
 void getRidOfArtificials()
           
 int iterate()
          Performs one step towards the solution
 boolean preprocess(int numberOfVariables, int numberOfConstraints)
          Preprocesses the problem to get ready for optimization
 void reset(int numberOfVariables, int numberOfConstraints)
          Resets the simplex optimizer to initial state
 void SetCostForPhaseOne()
           
 void showInfo()
          Show diagnostics
 int solveLP()
          Solve the problem
 void specifyObjective(double[] coefficients, boolean type)
          Set the objective function
 boolean testForOptimality()
          Tests to see if the current solution is optimal.
 boolean testUnboundedness()
           
 void updateSolution()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numVariables

public int numVariables

numConstraints

public int numConstraints

numNonbasic

public int numNonbasic

CurrentStep

public int CurrentStep

NumIterations

public int NumIterations

NumArtificials

public int NumArtificials

reducedCost

public double[] reducedCost

cost

public double[] cost

x

public double[] x

pi

public cern.colt.matrix.DoubleMatrix2D pi

yB

public cern.colt.matrix.DoubleMatrix2D yB

MinRatio

public double MinRatio

NumMinRatio

public int NumMinRatio

Bt

public cern.colt.matrix.DoubleMatrix2D Bt

B

public cern.colt.matrix.DoubleMatrix2D B

littleCost

public cern.colt.matrix.DoubleMatrix2D littleCost

objectiveValue

public double objectiveValue

A

public cern.colt.matrix.DoubleMatrix2D A

b

public cern.colt.matrix.DoubleMatrix1D b

constraintType

public int[] constraintType

BasicVariables

public int[] BasicVariables

NonBasicVariables

public int[] NonBasicVariables

varType

public int[] varType

colOfA

public cern.colt.matrix.DoubleMatrix2D colOfA

EnteringVariable

public int EnteringVariable

LeavingVariable

public int LeavingVariable

TypeMinimize

public boolean TypeMinimize

ArtificialAdded

public boolean ArtificialAdded

Continue

public static final int Continue
See Also:
Constant Field Values

Optimal

public static final int Optimal
See Also:
Constant Field Values

Feasible

public static final int Feasible
See Also:
Constant Field Values

Unbounded

public static final int Unbounded
See Also:
Constant Field Values

Regular

public static final int Regular
See Also:
Constant Field Values

SlackOrSurplus

public static final int SlackOrSurplus
See Also:
Constant Field Values

Artificial

public static final int Artificial
See Also:
Constant Field Values

BasicType

public static final int BasicType
See Also:
Constant Field Values

NonBasicType

public static final int NonBasicType
See Also:
Constant Field Values
Constructor Detail

RevisedSimplex

public RevisedSimplex(int nv,
                      int nc)
Constructs

Parameters:
nv - Number of variables
nc - Number of constraints
Method Detail

iterate

public int iterate()
Performs one step towards the solution

Returns:
Status value of whether the problem is solved or not

calculateObjective

public double calculateObjective()
Evaluate the objective function for the current point

Returns:
The value of the objective function at the current point

chooseLeavingVariable

public void chooseLeavingVariable()
Choose new variable to leave the active set


updateSolution

public void updateSolution()

ChooseEnteringVariable

public void ChooseEnteringVariable()
Choose new variable to enter the active set


testUnboundedness

public boolean testUnboundedness()

calculateReducedCosts

public void calculateReducedCosts()

testForOptimality

public boolean testForOptimality()
Tests to see if the current solution is optimal.

Returns:
true if the solution is optimal.

addConstraint

public void addConstraint(Constraint cons)
Add a constraint to the list of constraints

Parameters:
cons -

specifyObjective

public void specifyObjective(double[] coefficients,
                             boolean type)
Set the objective function

Parameters:
coefficients - Array of coefficents for the objective function
type - Solution is minimized (true) or maximized (false)

preprocess

public boolean preprocess(int numberOfVariables,
                          int numberOfConstraints)
Preprocesses the problem to get ready for optimization

Parameters:
numberOfVariables - The number of variables
numberOfConstraints - The number of constraints on the problem
Returns:
true if preprocessing completed successfully

SetCostForPhaseOne

public void SetCostForPhaseOne()

getRidOfArtificials

public void getRidOfArtificials()

Dot

public double Dot(cern.colt.matrix.DoubleMatrix2D row,
                  cern.colt.matrix.DoubleMatrix2D col,
                  int size)
Returns the dot product of the two vectors, but the vectors are stored as 2D matrices

Parameters:
row - The matrix from which the row is selected
col - The matrix matrix from which the column is selected
size - Not used
Returns:
The dot product of the two vectors

showInfo

public void showInfo()
Show diagnostics


solveLP

public int solveLP()
Solve the problem

Returns:
The status of the solution (solved, not-solved)

reset

public void reset(int numberOfVariables,
                  int numberOfConstraints)
Resets the simplex optimizer to initial state

Parameters:
numberOfVariables -
numberOfConstraints -

AugmentBasis

public int AugmentBasis(int BasisSize)