|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object scpsolver.problems.MathematicalProgram
public abstract class MathematicalProgram
Generalization of a mathematical optimization problem.
Field Summary | |
---|---|
protected SparseVector |
c
Vector of the coefficients of the linear target function |
protected java.util.ArrayList<Constraint> |
constraints
The list of constraints for the given problem. |
protected boolean[] |
isboolean
|
protected boolean[] |
isinteger
Controls, which variable is a double or an integer/boolean. |
protected double[] |
lowerbound
An array containing the lower bounds of the variables. |
protected boolean |
minproblem
Indicates wether the linear program is a minimize or maximize problem. |
protected double[] |
upperbound
An array containing the upper bounds of the variables. |
Constructor Summary | |
---|---|
MathematicalProgram()
Creates an empty mathematical problem. |
Method Summary | |
---|---|
double[] |
getC()
Gets the coefficient vector for a linear target function. |
int |
getDimension()
Returns the dimension of the mathematical problem, i.e. the number of free variables of the problem. |
boolean[] |
getIsboolean()
|
boolean[] |
getIsinteger()
Returns an array indicating integer variables and real variables. |
double[] |
getLowerbound()
Returns the vector containing the lower bounds for all target variables. |
double[] |
getUpperbound()
Returns the vector containing the upper bounds for all target variables. |
boolean |
hasBounds()
Checks if lower or upper bounds are set for the target variables of this problem. |
boolean |
isMinProblem()
Checks, whether the target function of this problem is to be minimized or maximized. |
boolean |
isMIP()
Checks if this model represents a mixed integer problem or real problem. |
static double[] |
makeDoubleArray(int l,
double d)
Creates an array of length l containing the value d at
every position. |
void |
setC(Matrix pc)
Sets the coefficients of the linear target function. |
void |
setContinous(int i)
Marks a variable as real number. |
void |
setInteger(int i)
Marks a variable as integer. |
void |
setIsinteger(boolean[] isinteger)
Marks target variables to be integer, i.e. variables that must take integer values for valid solutions. |
void |
setLowerbound(double[] lowerbound)
Sets the lower bounds off all target variables. |
void |
setMinProblem(boolean bool)
Determines if the target function of this problem is to be minimized or maximized. |
void |
setUpperbound(double[] upperbound)
Sets the upper bounds off all target variables. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected SparseVector c
protected java.util.ArrayList<Constraint> constraints
protected boolean[] isinteger
protected boolean[] isboolean
protected boolean minproblem
protected double[] upperbound
protected double[] lowerbound
Constructor Detail |
---|
public MathematicalProgram()
Method Detail |
---|
public void setInteger(int i)
i
- The index of the variablepublic void setContinous(int i)
i
- The index of the variable.public double[] getC()
public void setC(Matrix pc)
c
- the c to setpublic int getDimension()
public boolean isMIP()
true
, if at least one variable has to be an integer, otherwise
false
public boolean isMinProblem()
true
, if the target function is to be minimized, otherwise
false
public void setMinProblem(boolean bool)
bool
- true
, if the target function is to be minimized, otherwise
false
public boolean hasBounds()
true
, if any of the lower or upper bounds are set, otherwies
false
public double[] getLowerbound()
public void setLowerbound(double[] lowerbound)
getDimension
. Note also, that this
sets the lower bound for all target variables at once. If no lower bound for a given
variable is desired, then the array should contain the value Double.MIN_VALUE
at this postion.
lowerbound
- an array containing the lower bounds of all free variablespublic double[] getUpperbound()
public static double[] makeDoubleArray(int l, double d)
l
containing the value d
at
every position.
l
- the length of the desired arrayd
- the value at every position of the array
d
valuespublic void setUpperbound(double[] upperbound)
getDimension
. Note also, that this
sets the upper bound for all target variables at once. If no upper bound for a given
variable is desired, then the array should contain the value Double.MAX_VALUE
at this postion.
upperbound
- an array containing the upper bounds of all free variablespublic void setIsinteger(boolean[] isinteger)
true
, whereas
positions of variables which may also take real values in possible solutions are to
be marked false
.
isinteger
- an array of the length equal to the dimension with values indicating
which variables shall take integer values and which can take real valuespublic boolean[] getIsinteger()
true
, positions of real variables are marked false
.
public boolean[] getIsboolean()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |