FormatTypeInput
public final class LP extends java.lang.Object implements FormatTypeInput
FormatTypeInput.FormatType
Modifier and Type | Field | Description |
---|---|---|
static double |
NaN |
Constructor | Description |
---|---|
LP(java.lang.String path) |
|
LP(java.util.ArrayList<java.lang.String> inequality) |
|
LP(LinearObjectiveFunction fo,
java.util.ArrayList<Constraint> constraints) |
Constructor
Creates an LP object for solving problems expressed in matrix format.
|
LP(LinearObjectiveFunction fo,
ListConstraints constraints) |
Constructor of an LP object for solving problems expressed in matrix format.
|
LP(org.ssclab.ref.Input input_natural) |
Constructor of an LP object for solving problems expressed in coefficient format.
|
LP(org.ssclab.ref.Input input_natural,
org.ssclab.context.Session session) |
Constructor of an LP object for solving problems expressed in coefficient format.
|
LP(org.ssclab.ref.Input input,
org.ssclab.context.Session session,
FormatTypeInput.FormatType format) |
Constructor of an LP object for solving problems expressed in sparse format or coefficient format.
|
LP(org.ssclab.ref.Input input,
FormatTypeInput.FormatType format) |
Constructor of an LP object for solving problems expressed in either sparse or coefficient format.
|
Modifier and Type | Method | Description |
---|---|---|
int |
getNumMaxIteration() |
This method returns the maximum number of simplex iterations
|
Solution |
getSolution() |
If the problem has an optimal solution, this method returns that optimal solution in the form of an object of the
Solution class.
|
double[][] |
getStandartMatrixA() |
This method returns the matrix A obtained after the process of reduction to
standard form (max z , Ax + s=b, x ≥ 0, b ≥ 0) of the original linear programming problem.
|
double[] |
getStandartVectorB() |
This method returns the vector b of the rhs values obtained after the process of reduction to
standard form(max z , Ax+s=b, x ≥ 0, b ≥ 0) of the original linear programming problem.
|
double[] |
getStandartVectorC() |
This method returns the vector c of the coefficients of the objective function after the process of reduction
to standard form (max z , Ax+s=b, x ≥ 0, b ≥ 0) of the original linear programming problem.
|
LPThreadsNumber |
getThreadsNumber() |
|
double[] |
getValuesSolution() |
If the problem has an optimal solution, this method returns that optimal solution in the form of
an array with the values of the variables.
|
boolean |
isJustTakeFeasibleSolution() |
Returns true if only phase 1 execution is set to obtain a feasible solution.
|
boolean |
isParallelSimplex() |
|
SolutionType |
resolve() |
Executes the simplex (phase 1 + phase 2).
|
void |
setCEpsilon(EPSILON epsilon) |
This method allows setting the epsilon value relative to the tolerance in determining if an optimal solution expressed by phase 1
is close to or equal to zero and thus gives rise to feasible solutions for the initial problem.
|
void |
setEpsilon(EPSILON epsilon) |
This method allows setting the epsilon value relative to the tolerance that intervenes in various contexts.
|
void |
setJustTakeFeasibleSolution(boolean isStopPhase2) |
Setting to true allows interrupting the simplex at the end of phase 1, in order
to determine not an optimal solution but only a feasible solution of the problem.
|
void |
setNumMaxIteration(int num_max_iteration) |
This method allows limiting the maximum number of simplex iterations (phase 1 iterations + phase 2 iterations)
|
void |
setParallelSimplex(boolean isParallelSimplex) |
If the number of physical cores of the host on which SSc is running is greater than 4,
the performance of the simplex can be improved by executing the optimization processes in parallel on multiple threads.
|
void |
setThreadsNumber(LPThreadsNumber threadsNumber) |
If the set value is AUTO, the system decides the number of
threads to use.
|
public LP(java.util.ArrayList<java.lang.String> inequality) throws java.lang.Exception
inequality
- An ArrayList (of String objects) containing the problem formulation in the
form of inequalitiesjava.lang.Exception
- An exception is thrown if the problem is not correctly formulatedpublic LP(java.lang.String path) throws java.lang.Exception
path
- The path where the file containing the LP problem formulated with the inequality
format is locatedjava.lang.Exception
- An exception is thrown if the problem is not correctly formulated or
if the file does not existpublic LP(LinearObjectiveFunction fo, java.util.ArrayList<Constraint> constraints) throws java.lang.Exception
fo
- A LinearObjectiveFunction object representing the objective functionconstraints
- The list of constraints expressed as an ArrayList of Constraint objectsjava.lang.Exception
- An exception is thrown if the problem is not correctly formulatedpublic LP(LinearObjectiveFunction fo, ListConstraints constraints) throws java.lang.Exception
fo
- A LinearObjectiveFunction object representing the objective functionconstraints
- The list of constraints as a ListConstraints objectjava.lang.Exception
- An exception is thrown if the problem is not correctly formulatedpublic LP(org.ssclab.ref.Input input, org.ssclab.context.Session session, FormatTypeInput.FormatType format) throws java.lang.Exception
input
- The problem formulated in sparse format or coefficient formatsession
- An SSC working sessionformat
- Constant to express in which format the problem is formulated (FormatType.SPARSE or FormatType.COEFF)java.lang.Exception
- An exception is thrown if the problem is not formulated correctlypublic LP(org.ssclab.ref.Input input, FormatTypeInput.FormatType format) throws java.lang.Exception
input
- The problem formulated in sparse formatformat
- Constant to express in which format the problem is formulated (FormatType.SPARSE or FormatType.COEFF)java.lang.Exception
- An exception is thrown if the problem is not formulated correctlypublic LP(org.ssclab.ref.Input input_natural) throws java.lang.Exception
input_natural
- The problem formulated in coefficient formatjava.lang.Exception
- An exception is thrown if the problem is not formulated correctlypublic LP(org.ssclab.ref.Input input_natural, org.ssclab.context.Session session) throws java.lang.Exception
input_natural
- The problem formulated in coefficient formatsession
- An SSC working sessionjava.lang.Exception
- An exception is thrown if the problem is not formulated correctlypublic void setEpsilon(EPSILON epsilon)
epsilon
- Tolerance used in various phases of the simplex. Default value 1E-10public void setCEpsilon(EPSILON epsilon)
epsilon
- Tolerance of phase 1 solution with respect to zero. Default value 1E-8public void setNumMaxIteration(int num_max_iteration) throws LPException
num_max_iteration
- The maximum number of iterations to be executed.
Default value 10,000,000.LPException
- If an incorrect number (zero or negative) is setpublic int getNumMaxIteration()
public SolutionType resolve() throws java.lang.Exception
java.lang.Exception
- If the execution process generates an errorpublic double[][] getStandartMatrixA() throws org.ssclab.pl.milp.simplex.SimplexException, java.io.IOException
org.ssclab.pl.milp.simplex.SimplexException
- If null matrixjava.io.IOException
- if the problem has not been reduced to standard formpublic double[] getStandartVectorB()
public double[] getStandartVectorC()
public Solution getSolution() throws org.ssclab.pl.milp.simplex.SimplexException
org.ssclab.pl.milp.simplex.SimplexException
- If the optimal solution is not presentpublic double[] getValuesSolution() throws org.ssclab.pl.milp.simplex.SimplexException
org.ssclab.pl.milp.simplex.SimplexException
- If the optimal solution is not presentpublic boolean isParallelSimplex()
public void setParallelSimplex(boolean isParallelSimplex)
isParallelSimplex
- True to activate parallelizationpublic LPThreadsNumber getThreadsNumber()
public void setThreadsNumber(LPThreadsNumber threadsNumber)
threadsNumber
- Sets the number of threads to use in the execution.public boolean isJustTakeFeasibleSolution()
public void setJustTakeFeasibleSolution(boolean isStopPhase2)
isStopPhase2
- true to interrupt the simplex before phase 2.