|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectscpsolver.problems.MathematicalProgram
scpsolver.problems.StochasticProgram
public class StochasticProgram
This class represents a stochastic program, that is, a linear program that additionally includes different scenarios with given probabilities. This implementation assumes that the variables can be split into disjoint sets: a deterministic set of variables, which are not influenced by scenarios of certain probabilities (i.e. variables, which have the same values in all scenarios), and another set of variables which weights are not pre-determined. The theory of stochastic programming shows that the optimal solution of a stochastic optimization problem is not merely a weighted average of the underlying linear optimization problems, and is therefore entitled a representation of its own. On the other hand, a stochastic optimization problem can be transformed into a linear one. Although there are additional algorithms, which exploit the specific problem structure of stochastic optimization problems, the SCPSolver-suite does not take them into account yet. However, this class and the corresponding constraint classes help to easily formulate a stochastic problem and transform it automatically into its linear representation.
Field Summary |
---|
Fields inherited from class scpsolver.problems.MathematicalProgram |
---|
c, constraints, isboolean, isinteger, lowerbound, minproblem, upperbound |
Constructor Summary | |
---|---|
StochasticProgram(double[] pc,
double[] probs,
double[][] scens)
Creates a new stochastic problem with given deterministic weights, probabilities of different scenarios and variable weights in these scenarios. |
|
StochasticProgram(SparseVector c,
double[] probs,
SparseVector[] scens)
|
Method Summary | |
---|---|
boolean |
addConstraint(LinearConstraint c)
|
boolean |
addConstraint(StochasticConstraint c)
|
double |
evaluate(double[] x)
Returns the value of the function at position x . |
java.util.ArrayList<Constraint> |
getConstraints()
Returns a list of all constrains a valid solution must keep. |
LinearProgram |
getExtensiveForm()
|
java.lang.String |
getName()
Gets a string containing the type of problem that is formulated with a given instance. |
boolean |
isFeasable(double[] x)
Determines whether all constrains are fulfilled at input value x . |
void |
setLowerbound(double[] bounds)
Sets the lower bounds off all target variables. |
void |
setUpperbound(double[] bounds)
Sets the upper bounds off all target variables. |
Methods inherited from class scpsolver.problems.MathematicalProgram |
---|
getC, getDimension, getIsboolean, getIsinteger, getLowerbound, getUpperbound, hasBounds, isMinProblem, isMIP, makeDoubleArray, setC, setContinous, setInteger, setIsinteger, setMinProblem |
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 StochasticProgram(double[] pc, double[] probs, double[][] scens)
pc
- variable weights for the deterministic variablesprobs
- probabilites of the different scenariosscens
- variable weights for the non-deterministic variablespublic StochasticProgram(SparseVector c, double[] probs, SparseVector[] scens)
Method Detail |
---|
public boolean addConstraint(LinearConstraint c)
public boolean addConstraint(StochasticConstraint c)
public java.util.ArrayList<Constraint> getConstraints()
ConstrainedProblem
getConstraints
in interface ConstrainedProblem
public void setUpperbound(double[] bounds)
MathematicalProgram
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.
setUpperbound
in class MathematicalProgram
bounds
- an array containing the upper bounds of all free variablespublic void setLowerbound(double[] bounds)
MathematicalProgram
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.
setLowerbound
in class MathematicalProgram
bounds
- an array containing the lower bounds of all free variablespublic boolean isFeasable(double[] x)
ConstrainedProblem
x
.
isFeasable
will iterate over all constrains of an optimization problem
and check if all of them hold. isFeasable
will then return
true
, otherwise it will return false
.
The length of the array must be the same as the value returned by getDimension
.
isFeasable
in interface ConstrainedProblem
x
- input variable vector
true
if all constrains hold, false
otherwisepublic double evaluate(double[] x)
Problem
x
. The length of the array
must be the same as the value returned by getDimension
.
evaluate
in interface Problem
x
- input variable vector for the target function
x
public java.lang.String getName()
Problem
LinearProgram
class returns "Linear Program".
Please note, that this method will not return the actual name of a given instance. If you have two instances of linear programs, a method call will yield the same result. Therefore, two different linear programs cannot be distinguish via this method and must be kept apart somehow differently.
getName
in interface Problem
public LinearProgram getExtensiveForm()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |