simplex.h File Reference Detailed DescriptionDefinition of the TSimplex type and the associated functions. This interface is common to the different simplex engines. To add a new simplex engine you have to re-implement these functions for the new engine.
Clp is the preferred option.
Definition in file simplex.h.
Macro Definition Documentation
Maximum time (in seconds) we give the simplex process to return a solution when minimizing/mazimizing for a single variable. This figure is scaled by the number of columns in the simplex. Definition at line 63 of file simplex.h. Referenced by SimplexCreate(). Function Documentation
Creates a simplex structure with a given number of columns (i.e., variables) but with no rows (i.e., constraints).
Definition at line 22 of file simplex_clp.c. References Error(), TSimplex::fakeRows, INF, TSimplex::inf, TSimplex::lower, TSimplex::lp, NEW, TSimplex::obj, SIMPLEX_TIMEOUT, and TSimplex::upper. Referenced by ReduceBox().
Removes the rows (i.e., constraints) from the simplex structure.
Definition at line 96 of file simplex_clp.c. References TSimplex::lp. Referenced by ReduceBox(), and ReduceRange().
Gets the number of columns (i.e., variables) of the simplex structure.
Definition at line 102 of file simplex_clp.c. References TSimplex::lp. Referenced by SimplexGetOptimalValue(), SimplexGetOptimizationFunction(), SimplexGetRowConstraint(), and SimplexSetOptimizationFunction().
Gets the number of rows (i.e., constraints) of the simplex structure.
Definition at line 107 of file simplex_clp.c. References TSimplex::fakeRows, and TSimplex::lp. Referenced by ReduceBox(), SimplexAddNewConstraintRaw(), SimplexColEmpty(), SimplexDelete(), SimplexGetColConstraint(), SimplexGetColDual(), SimplexGetColPrimal(), SimplexGetOptimalValue(), SimplexGetOptimizationFunction(), and SimplexGetRowConstraint(). Sets the bounds for a given column (i.e., variable).
Definition at line 113 of file simplex_clp.c. References INF, TSimplex::inf, TSimplex::lower, LowerLimit(), TSimplex::lp, TSimplex::upper, and UpperLimit(). Referenced by SetSimplexBounds(). Gets the bounds for a given column (i.e., variable).
Definition at line 123 of file simplex_clp.c. References INF, TSimplex::inf, TSimplex::lp, and NewInterval(). Referenced by SimplexGetColConstraint().
Gets a column from the simplex in the form of a linear constraint.
Definition at line 133 of file simplex_clp.c. References AddTerm2LinearConstraint(), InitLinearConstraint(), TSimplex::lp, NEW, SetLinearConstraintError(), SimplexGetColBounds(), and SimplexNRows(). Referenced by SimplexGetOptimalValue(). Gets a column constraint from the simplex.
Definition at line 159 of file simplex_clp.c. References TSimplex::lp, NEW, and SimplexNRows(). Referenced by ReduceBox().
Gets a column primal value after solving the simplex.
Definition at line 168 of file simplex_clp.c. References TSimplex::lp, and SimplexNRows().
Gets a column dual value after solving the simplex.
Definition at line 177 of file simplex_clp.c. References TSimplex::lp, and SimplexNRows(). Sets the bounds for a given row (i.e., constraint).
Definition at line 187 of file simplex_clp.c. References Error(), INF, TSimplex::inf, IntervalSize(), LowerLimit(), TSimplex::lp, and UpperLimit(). Referenced by SimplexAddNewConstraintRaw(). Gets the bounds for a given row (i.e., constraint).
Definition at line 193 of file simplex_clp.c. References TSimplex::fakeRows, INF, TSimplex::inf, TSimplex::lp, and NewInterval(). Referenced by SimplexGetOptimalValue(), and SimplexGetRowConstraint().
Gets a row constraint from the simplex.
Definition at line 203 of file simplex_clp.c. References AddTerm2LinearConstraint(), TSimplex::fakeRows, InitLinearConstraint(), TSimplex::lp, NEW, SetLinearConstraintError(), SimplexGetRowBounds(), SimplexNColumns(), and SimplexNRows().
Gets a row primal value after solving the simplex.
Definition at line 241 of file simplex_clp.c. References TSimplex::fakeRows, and TSimplex::lp.
Gets a row dual value after solving the simplex.
Definition at line 250 of file simplex_clp.c. References TSimplex::fakeRows, and TSimplex::lp. Referenced by SimplexGetOptimalValue().
Adds a row (i.e., a constraint) to the simplex. This function adds the row without any process of the constraint. The input linear constraint must have the bound properly expanded (see SimplexExpandBounds) before using this function.
Definition at line 259 of file simplex_clp.c. References Error(), GetLinearConstraintCoefficient(), GetLinearConstraintCoefficients(), GetLinearConstraintError(), GetLinearConstraintVariable(), GetLinearConstraintVariables(), GetNumTermsInLinearConstraint(), LowerLimit(), TSimplex::lp, NEW, PrintInterval(), PrintLinearConstraint(), SimplexNRows(), SimplexSetRowBounds(), TRUE, and UpperLimit(). Referenced by SimplexAddNewConstraint().
Sets a new objective function. We always minimize the objective functions. To maximize just invert the linear constraint before setting it as an optimal function.
Definition at line 286 of file simplex_clp.c. References GetLinearConstraintCoefficient(), GetLinearConstraintCoefficients(), GetLinearConstraintVariable(), GetNumTermsInLinearConstraint(), TSimplex::lp, NEW, TSimplex::obj, and SimplexNColumns(). Referenced by ReduceRange().
Gets the current objective function.
Definition at line 312 of file simplex_clp.c. References AddTerm2LinearConstraint(), InitLinearConstraint(), TSimplex::lp, NEW, SimplexNColumns(), and SimplexNRows(). Referenced by SimplexGetOptimalValue().
Gets the optimal value after optimizing the problem. This function returns the value as given by the simplex engine in use. See SimplexGetOptimalValue for a procedure that adjusts this raw value to get a numerically safe optimal (i.e., it compensates for floating points rounding errors).
Definition at line 327 of file simplex_clp.c. References TSimplex::lp. Referenced by ReduceRange(), and SimplexGetOptimalValue().
Determines an optimal value given a set of constraints and an objective function.
Definition at line 332 of file simplex_clp.c. References EMPTY_BOX, ERROR_IN_PROCESS, TSimplex::fakeRows, TSimplex::lp, REDUCED_BOX, and UNBOUNDED_BOX. Referenced by ReduceRange().
Deletes the TSimplex structure and frees the allocated memory.
Definition at line 367 of file simplex_clp.c. References TSimplex::lower, TSimplex::lp, TSimplex::obj, SimplexNRows(), and TSimplex::upper. Referenced by ReduceBox().
Expands an interval according to the equation type.
This is an auxiliary function used when defining the bounds for a given simplex constraint. The implementation of this function is common to all simplex engines. The definition of the constant INF is the one that differs between simplex engines.
Definition at line 19 of file simplex.c. References GEQ, INF, LEQ, LowerLimit(), NewInterval(), and UpperLimit(). Referenced by CropEquation(), SetEquationInfo(), and SimplexAddNewConstraint(). Uses the ranges in a box to set the valid ranges for the primary variables of the simplex (i.e., the ranges for the column variables).
Definition at line 40 of file simplex.c. References GetBoxIntervals(), GetBoxNIntervals(), INF, IntervalSize(), PrintInterval(), and SimplexSetColBounds(). Referenced by ReduceRange().
Adds a row (i.e., a constraint) after pre-processing it:
Definition at line 67 of file simplex.c. References BoundedLinearConstraint(), CleanLinearConstraint(), CopyLinearConstraint(), DeleteLinearConstraint(), EQU, GEQ, GetLinearConstraintError(), GetLinearConstraintErrorSize(), GetNumTermsInLinearConstraint(), IntervalCenter(), IntervalSize(), LEQ, NewInterval(), PrintLinearConstraint(), randomDouble(), SetLinearConstraintError(), SimplexAddNewConstraintRaw(), SimplexExpandBounds(), SimplifyLinearConstraint(), TRUE, and ZERO. Referenced by AddEquation2Simplex(), and LinearizeGeneralEquationInt(). Returns the optimal value determined by the simplex corrected to compensate for possible rounding effects. The procedure implemented in this function is described in
Definition at line 215 of file simplex.c. References DeleteLinearConstraint(), GetBoxInterval(), GetLinearConstraintCoefficient(), GetLinearConstraintVariable(), GetNumTermsInLinearConstraint(), INF, IntervalAdd(), IntervalProduct(), LowerLimit(), NEW, NewInterval(), ROUNDDOWN, ROUNDNEAR, ROUNDUP, SimplexGetColConstraint(), SimplexGetOptimalValueRaw(), SimplexGetOptimizationFunction(), SimplexGetRowBounds(), SimplexGetRowDual(), SimplexNColumns(), SimplexNRows(), and UpperLimit(). Referenced by ReduceRange().
Reduces a variable range using the given simplex. The reduction basically consists in minimizing and maximizing with an objective function that only takes into account the selected variable.
Definition at line 329 of file simplex.c. References AddTerm2LinearConstraint(), CopyInterval(), DeleteLinearConstraint(), EMPTY_BOX, EmptyInterval(), Error(), ERROR_IN_PROCESS, FALSE, GetBoxInterval(), INF, InitLinearConstraint(), IntervalSize(), LowerLimit(), PrintInterval(), REDUCED_BOX, ResetLinearConstraint(), ResetSimplex(), SetSimplexBounds(), SimplexGetOptimalValue(), SimplexGetOptimalValueRaw(), SimplexSetOptimizationFunction(), SimplexSolve(), TRUE, UNBOUNDED_BOX, UpdateLowerLimit(), UpdateUpperLimit(), and UpperLimit(). Referenced by ReduceBox(). |
Follow us!