public class DenseLP extends Object implements Serializable, Cloneable
Class DenseLP
uses an active set strategy to
solve linear programming problems, i.e., problems of the form
subject to
where c is the objective coefficient vector, A is the coefficient matrix, and the vectors , , , and are the lower and upper bounds on the constraints and the variables, respectively.
If the linear constraints are infeasible an solution
to the constraints are used as a replacement for the stated constraints.
An exception is thrown but a generalized solution is computed and available
using methods getPrimalSolution
or getDualSolution
.
Similar comments hold for any of the three additional conditions:
(1) There are multiple solutions; (2) some constraints are discarded, or
(3) cycling in the algorithm is identified.
Refer to the following paper for further information:
Krogh, Fred, T. (2005), see An Algorithm for Linear Programming http://mathalacarte.com/fkrogh/pub/lp.pdf
Modifier and Type  Class and Description 

static class 
DenseLP.AllConstraintsNotSatisfiedException
All constraints are not satisfied.

static class 
DenseLP.BoundsInconsistentException
The bounds given are inconsistent.

static class 
DenseLP.CyclingOccurringException
The algorithm appears to be cycling.

static class 
DenseLP.MultipleSolutionsException
The problem has multiple solutions giving essentially the same
minimum.

static class 
DenseLP.NoAcceptablePivotException
No acceptable pivot could be found.

static class 
DenseLP.ProblemUnboundedException
The problem is unbounded.

static class 
DenseLP.ProblemVacuousException
The problem is vaxuous.

static class 
DenseLP.SomeConstraintsDiscardedException
Some constraints were discarded because they were too linearly
dependent on other active constraints.

Constructor and Description 

DenseLP(double[][] a,
double[] b,
double[] c)
Constructor variables of type
double . 
DenseLP(MPSReader mps)
Constructor using an MPSReader object.

Modifier and Type  Method and Description 

Object 
clone()
Creates and returns a copy of this object.

double[] 
getDualSolution()
Returns the dual solution.

int 
getIterationCount()
Returns the iteration count.

double 
getOptimalValue()
Returns the optimal value of the objective function.

double[] 
getPrimalSolution()
Returns the solution x of the linear programming problem.

void 
setConstraintType(int[] constraintType)
Sets the types of general constraints in the matrix
a . 
void 
setLowerBound(double[] lowerBound)
Sets the lower bound, , on the variables.

void 
setRefinementType(int iRefinement)
Set the type of refinement used.

void 
setUpperBound(double[] upperBound)
Sets the upper bound, , on the variables.

void 
setUpperLimit(double[] upperLimit)
Sets the upper limit of the constraints.

void 
solve()
Solves the problem using an active set method.

public DenseLP(double[][] a, double[] b, double[] c)
double
.a
 A double
matrix with coefficients of the constraints.b
 A double
array containing the righthand side of the constraints.c
 A double
array containing the coefficients of the objective function.IllegalArgumentException
 is thrown if the dimensions of a
,
b.length
, and c.length
are not consistent.public DenseLP(MPSReader mps)
mps
 An MPSReader
object specifying the Linear Programming problem.IllegalArgumentException
 is thrown if the problem dimensions are not consistent.public Object clone()
public double[] getDualSolution()
double
array containing the dual
solution of the linear programming problem.public int getIterationCount()
int
scalar containing the iteration
count.public double getOptimalValue()
double
scalar containing the optimal
value of the objective function. If a solution has not
been computed, Double.NaN
is returned.public double[] getPrimalSolution()
double
array containing the
solution x of the linear programming problem.public void setConstraintType(int[] constraintType)
a
.constraintType
 an int
array containing the types
of general constraints. Let . Then the
value of constraintType[i]
signifies the following:
constraintType 
Constraint 
0  
1  
2  
3 
Default=0.
public void setLowerBound(double[] lowerBound)
lowerBound
 a double
array containing the lower
bound on the variables. Default = 0.public void setRefinementType(int iRefinement)
iRefinement
 An int
scalar value which defines the type
of refinement to be used. The possible settings are:
iRefinement  Action 
0  No refinement. Always compute dual. Default. 
1  Iterative refinement. 
2  Use extended refinement. Iterate until no more progress. 
If refinement is used, the coefficient matrices and other data are saved at the beginning of the computation. When finished this data together with the solution obtained is checked for consistency. If the discrepancy is too large, the solution process is restarted using the problem data just after processing the equalities, but with the final x values and final active set.
public void setUpperBound(double[] upperBound)
upperBound
 a double
array containing the upper
bound on the variables. The default is no upper bound.public void setUpperLimit(double[] upperLimit)
upperLimit
 a double
array containing the upper
limit, , of the constraints.public final void solve() throws DenseLP.BoundsInconsistentException, DenseLP.NoAcceptablePivotException, DenseLP.ProblemUnboundedException, DenseLP.ProblemVacuousException, DenseLP.AllConstraintsNotSatisfiedException, DenseLP.MultipleSolutionsException, DenseLP.SomeConstraintsDiscardedException, DenseLP.CyclingOccurringException
solve
must be
invoked prior to calling any of the "get" methods.DenseLP.BoundsInconsistentException
 is thrown if the bounds are inconsistent.DenseLP.NoAcceptablePivotException
 is thrown if an acceptable pivot could
not be found.DenseLP.ProblemUnboundedException
 is thrown if there is no finite solution
to the problem.DenseLP.ProblemVacuousException
 is thrown if the problem is vacuous.DenseLP.AllConstraintsNotSatisfiedException
 is thrown if all
constraints are not satisfied.DenseLP.MultipleSolutionsException
DenseLP.SomeConstraintsDiscardedException
DenseLP.CyclingOccurringException
Copyright © 19702015 Rogue Wave Software
Built October 13 2015.