|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectscpsolver.problems.MathematicalProgram
scpsolver.problems.LinearProgram
public class LinearProgram
Basic description for a linear program. In an ordinary production usage, this class usually gets instanced first. Then all constraints and boundaries are added and finally, a solver is instanced to solve the linear program.
| Field Summary |
|---|
| Fields inherited from class scpsolver.problems.MathematicalProgram |
|---|
c, constraints, isboolean, isinteger, lowerbound, minproblem, upperbound |
| Constructor Summary | |
|---|---|
LinearProgram()
Creates a basic maximization problem with no target function and no constraints. |
|
LinearProgram(double[] pc)
Creates a basic maximization problem with the given target function and no constraints. |
|
LinearProgram(LinearProgram lp)
Creates a shallow copy of a given linear program. |
|
LinearProgram(SparseVector c)
Creates a basic maximization problem with the given target function and no constraints. |
|
| Method Summary | |
|---|---|
boolean |
addConstraint(LinearConstraint c)
Adds a linear constraint to the model. |
boolean |
addConstraints(java.util.ArrayList<LinearConstraint> c)
Adds a list of linear constraint to the model. |
java.lang.StringBuffer |
convertToCPLEX()
Converts a given linear program into the CPLEX file format. |
double |
evaluate(double[] x)
Evaluates the target function at position x. |
java.util.ArrayList<Constraint> |
getConstraints()
Returns the current constraint list. |
java.util.HashMap<java.lang.String,java.lang.Integer> |
getIndexmap()
|
java.lang.String |
getName()
Returns a short String description of the class. |
boolean |
isFeasable(double[] x)
Checks if all constraints are fulfilled for the vector x. |
static void |
main(java.lang.String[] args)
|
void |
setBinary(int i)
Marks a variable as boolean. |
void |
setConstraints(java.util.ArrayList<Constraint> constraints)
Sets the whole list of constraints at once. |
void |
setIndexmap(java.util.HashMap<java.lang.String,java.lang.Integer> indexmap)
|
| Methods inherited from class scpsolver.problems.MathematicalProgram |
|---|
getC, getDimension, getIsboolean, getIsinteger, getLowerbound, getUpperbound, hasBounds, isMinProblem, isMIP, makeDoubleArray, setC, setContinous, setInteger, setIsinteger, setLowerbound, setMinProblem, setUpperbound |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface scpsolver.problems.Problem |
|---|
getDimension, isMinProblem, setMinProblem |
| Constructor Detail |
|---|
public LinearProgram()
public LinearProgram(double[] pc)
pc - the vector of the target functionpublic LinearProgram(SparseVector c)
c - the vector of the target function in its sparse representationpublic LinearProgram(LinearProgram lp)
lp - the program to be copied| Method Detail |
|---|
public void setBinary(int i)
i - The index of the variable.public void setConstraints(java.util.ArrayList<Constraint> constraints)
addConstraint method for adding constraints to a problem model.
On the other hand, this method can be used to delete constraints from a model, but
the user has to ensure that a valid ArrayList<Constraint> is
passed. This method will accept the null value, but this will lead to
invalid states.
constraints - the new constraint listpublic boolean addConstraint(LinearConstraint c)
setConstraints.
c - the linear constraint to be added
true, if the constraint was succesfully added,
otherwise falsepublic boolean addConstraints(java.util.ArrayList<LinearConstraint> c)
setConstraints.
c - the linear constraint to be added
true, if the constraint was succesfully added,
otherwise falsepublic boolean isFeasable(double[] x)
x.
isFeasable in interface ConstrainedProblemthe - vector which is to be checked
true, if the vector x fulfills all
constraints, otherwise falsepublic java.util.ArrayList<Constraint> getConstraints()
getConstraints in interface ConstrainedProblempublic double evaluate(double[] x)
x.
evaluate in interface Problemx - the position, where the target function is to be evaluated
public java.lang.String getName()
getName in interface Problempublic java.lang.StringBuffer convertToCPLEX()
public java.util.HashMap<java.lang.String,java.lang.Integer> getIndexmap()
public void setIndexmap(java.util.HashMap<java.lang.String,java.lang.Integer> indexmap)
public static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||