linear_constraint.c File Reference Detailed DescriptionImplementaton of the function operating on TLinearConstraint.
Definition in file linear_constraint.c.
Function Documentation
Creates a new, empty linear constraint.
Definition at line 17 of file linear_constraint.c. References TLinearConstraint::ind, INIT_NUM_TERMS_LC, TLinearConstraint::max, NEW, ResetLinearConstraint(), and TLinearConstraint::val. Referenced by CleanLinearConstraint(), CSRemoveVarsWithCtRange(), FixVariableInEquation(), GetFirstOrderApproximationToEquation(), GetOriginalVarRelation(), InitMapping(), IsSimplificable(), LinearEquation2LinearConstraint(), LoadMapping(), ReduceRange(), ScaleLinearConstraint(), SetEquationInfo(), SimplexGetColConstraint(), SimplexGetOptimizationFunction(), SimplexGetRowConstraint(), and SimplifyCuikSystem().
Deletes the information stored in a linear constrain, but does not frees the memory. It is more efficient to use ResetLinearConstraint instead of DeleteLinearConstraint plus InitLinearConstraint again.
Definition at line 25 of file linear_constraint.c. References TLinearConstraint::error, TLinearConstraint::n, and NewInterval(). Referenced by InitLinearConstraint(), and ReduceRange().
Creates a new linear constraint from another one.
Definition at line 31 of file linear_constraint.c. References CopyInterval(), TLinearConstraint::error, TLinearConstraint::ind, TLinearConstraint::max, TLinearConstraint::n, NEW, and TLinearConstraint::val. Referenced by CleanLinearConstraint(), CopyEquationInfo(), CopyMapping(), CSRemoveLCVars(), GetOriginalVarRelation(), ScaleLinearConstraint(), SetOriginalVarRelation(), and SimplexAddNewConstraint().
Test if the linear constraint actually constraint anything. This happens when the error of the linear constraint is not [-INF,+INF]. Unbounded constraints typically appear in equations including tangents o secants. Only ounded linear constraints are added to the simplex.
Definition at line 44 of file linear_constraint.c. References TLinearConstraint::error, INF, LowerLimit(), and UpperLimit(). Referenced by SimplexAddNewConstraint().
Returns the number of variables involved in a linear constraint.
Definition at line 49 of file linear_constraint.c. References TLinearConstraint::n. Referenced by AddSimplifiedJacobianEquations(), CSRemoveLCVars(), EquationFromLinearConstraint(), EquationFromLinearConstraintProduct(), ReplaceVariableInEquation(), SimplexAddNewConstraint(), SimplexAddNewConstraintRaw(), SimplexGetOptimalValue(), SimplexSetOptimizationFunction(), and SimplifyCuikSystem().
Returns the coefficients (i.e., the scale factors) in a linear constraint.
Definition at line 54 of file linear_constraint.c. References TLinearConstraint::val. Referenced by SimplexAddNewConstraintRaw(), and SimplexSetOptimizationFunction().
Returns the coefficient (i.e., the scale factor) for a particular variable in a linear constraint. Note that the index of the variable refers to its position in the linear constraint and it is not the global identifier of the variable.
Definition at line 59 of file linear_constraint.c. References Error(), and TLinearConstraint::val. Referenced by CSRemoveLCVars(), EquationFromLinearConstraint(), EquationFromLinearConstraintProduct(), ReplaceVariableInEquation(), SimplexAddNewConstraintRaw(), SimplexGetOptimalValue(), SimplexSetOptimizationFunction(), and SimplifyCuikSystem().
Returns the variables in a linear constraint.
Definition at line 70 of file linear_constraint.c. References TLinearConstraint::ind. Referenced by SimplexAddNewConstraintRaw().
Returns the identifier of the i-th variable involved in the linear constraint.
Definition at line 75 of file linear_constraint.c. References Error(), TLinearConstraint::ind, and NO_UINT. Referenced by AddSimplifiedJacobianEquations(), CSRemoveLCVars(), EquationFromLinearConstraint(), EquationFromLinearConstraintProduct(), ReplaceVariableInEquation(), SimplexAddNewConstraintRaw(), SimplexGetOptimalValue(), SimplexSetOptimizationFunction(), and SimplifyCuikSystem().
Returns the right-hand side interval for the linear constraint.
Definition at line 86 of file linear_constraint.c. References CopyInterval(), and TLinearConstraint::error. Referenced by CropEquation(), CSRemoveLCVars(), EquationFromLinearConstraint(), EquationFromLinearConstraintProduct(), ReplaceVariableInEquation(), SimplexAddNewConstraint(), SimplexAddNewConstraintRaw(), SimplifyCuikSystem(), UpdateOriginalFromSimple(), and UpdateOriginalPointFromSimple().
Returns the size of the right-hand side interval for the linear constraint.
Definition at line 91 of file linear_constraint.c. References TLinearConstraint::error, and IntervalSize(). Referenced by SimplexAddNewConstraint().
Sets a new righ-hand side error of the linear constraint.
Definition at line 96 of file linear_constraint.c. References CopyInterval(), and TLinearConstraint::error. Referenced by CropEquation(), GetFirstOrderApproximationToEquation(), SetEquationInfo(), SimplexAddNewConstraint(), SimplexGetColConstraint(), and SimplexGetRowConstraint().
Shifts the righ-hand side error of the linear constraint by the given value (changing the sign to move it to the righ-hand side).
Definition at line 101 of file linear_constraint.c. References TLinearConstraint::error, and IntervalOffset(). Referenced by CSRemoveLCVars(), CSRemoveVarsWithCtRange(), FixVariableInEquation(), IsSimplificable(), LinearEquation2LinearConstraint(), and SimplifyCuikSystem().
Adds a scaled variable to the linear constraint. If the varaible was already present in the constraint, we just add the scale factors.
Definition at line 106 of file linear_constraint.c. References FALSE, TLinearConstraint::ind, TLinearConstraint::max, MEM_DUP, MEM_EXPAND, TLinearConstraint::n, and TLinearConstraint::val. Referenced by AddLinearConstraints(), CleanLinearConstraint(), CSRemoveLCVars(), GetFirstOrderApproximationToEquation(), InitMapping(), IsSimplificable(), LinearEquation2LinearConstraint(), ReduceRange(), ScaleLinearConstraint(), SetEquationInfo(), SimplexGetColConstraint(), SimplexGetOptimizationFunction(), SimplexGetRowConstraint(), and SimplifyCuikSystem().
Removes a variable from a linear constraint.
Definition at line 136 of file linear_constraint.c. References FALSE, TLinearConstraint::ind, TLinearConstraint::n, and TLinearConstraint::val. Referenced by CSRemoveLCVars().
Checks if a variable is included in a linear constraint.
Definition at line 166 of file linear_constraint.c. References FALSE, and TLinearConstraint::ind. Referenced by CSRemoveLCVars().
Changes the sign of a linear constraint.
Definition at line 182 of file linear_constraint.c. References TLinearConstraint::error, IntervalInvert(), TLinearConstraint::n, and TLinearConstraint::val. Referenced by IsSimplificable().
Scales a linear constraint.
Definition at line 192 of file linear_constraint.c. References AddTerm2LinearConstraint(), CopyLinearConstraint(), DeleteLinearConstraint(), TLinearConstraint::error, TLinearConstraint::ind, InitLinearConstraint(), IntervalScale(), TLinearConstraint::n, and TLinearConstraint::val. Referenced by CSRemoveLCVars(), and IsSimplificable().
Adds two a linear constraints.
Definition at line 209 of file linear_constraint.c. References AddTerm2LinearConstraint(), TLinearConstraint::error, TLinearConstraint::ind, IntervalAdd(), TLinearConstraint::n, and TLinearConstraint::val. Referenced by CSRemoveLCVars().
Variables in the linear constraint with very narrow range or scaled by tiny scale factors can be removed and added to the error term. This enhances the numerical robustness of the system. This can lead to tiny error ranges. If the When using GLPK it is compulsatory to use
Definition at line 232 of file linear_constraint.c. References AddTerm2LinearConstraint(), CopyInterval(), CopyLinearConstraint(), DeleteLinearConstraint(), TLinearConstraint::error, TLinearConstraint::ind, InitLinearConstraint(), IntervalAdd(), IntervalScale(), IntervalSize(), TLinearConstraint::n, and TLinearConstraint::val. Referenced by SimplexAddNewConstraint().
Linear constraints involving only one variable can be directly used to reduce the variable range. We compute the range for the variable as
Only linear equations with just one variable are feasible to be used to directly reduce variable ranges. Linear constraints that can be directly applied do not need to be added to the simplex.
Definition at line 263 of file linear_constraint.c. References TLinearConstraint::error, FALSE, TLinearConstraint::ind, Intersection(), IntervalDivision(), IntervalProduct(), TLinearConstraint::n, NewInterval(), TRUE, TLinearConstraint::val, and ZERO. Referenced by SimplexAddNewConstraint().
We have that a linear constraint can be manipulated as Sum_i k_i x_i - k_j x_j + k_j x_j = error, k_j x_j= error - Sum_(i!=k) k_i x_i, x_j = (error + Sum_(i!=k) - k_i x_i))/ k_j, that can be evaluated using interval arithmetics. Thus, a linear constraint can be used to compute a new range for all the variables in the constraint that can be intersected with the given range, possibly producing a range reduction. This can be seen as a generalization of SimplifyLinearConstraint for the case where the linear constraint involves more than one variable.
Definition at line 297 of file linear_constraint.c. References CopyInterval(), EMPTY_BOX, TLinearConstraint::error, FALSE, GetBoxIntervals(), GetVariableTypeN(), TLinearConstraint::ind, INF, Intersection(), IntervalAdd(), IntervalDivision(), IntervalProduct(), IntervalSize(), TLinearConstraint::n, NewInterval(), NOT_REDUCED_BOX, PrintInterval(), PrintLinearConstraint(), REDUCED_BOX, TRUE, TLinearConstraint::val, and ZERO. Referenced by CropEquation(), and CSRemoveLCVars().
We compare the linear constraints first checking if they involve the same sub-set of variables, and then computing the cosinus of the angle between them (i.e., between the vectors defining the hyperplane of the constraint). The output scaleOne2Two gives the constant so that lc1*scaleOne2Two=lc2
Definition at line 456 of file linear_constraint.c. References FALSE, TLinearConstraint::ind, TLinearConstraint::n, TRUE, TLinearConstraint::val, and ZERO.
Evaluates a linear combination for a given point NOTE: The right-hand side of the linear constraint (represented as a error interval) is not taken into account in the evaluation.
Definition at line 519 of file linear_constraint.c. References TLinearConstraint::ind, TLinearConstraint::n, and TLinearConstraint::val. Referenced by UpdateOriginalPointFromSimple().
Evaluates a linear constaint for a given ranges of the variables using interval arithmetics.
Definition at line 531 of file linear_constraint.c. References TLinearConstraint::ind, IntervalAdd(), IntervalProduct(), TLinearConstraint::n, NewInterval(), TLinearConstraint::val, and ZERO. Referenced by UpdateOriginalFromSimple().
Writes a linear constraint into a given stream, that can be stdout.
Definition at line 548 of file linear_constraint.c. References TLinearConstraint::error, TLinearConstraint::ind, IntervalCenter(), IntervalInvert(), IntervalSize(), TLinearConstraint::n, PrintInterval(), TLinearConstraint::val, and ZERO. Referenced by CropLinearConstraint(), CSRemoveLCVars(), PrintMapping(), SimplexAddNewConstraint(), and SimplexAddNewConstraintRaw().
Saves the linear constraint into a file.
Definition at line 600 of file linear_constraint.c. References TLinearConstraint::error, TLinearConstraint::ind, LowerLimit(), TLinearConstraint::max, TLinearConstraint::n, UpperLimit(), and TLinearConstraint::val. Referenced by SaveMapping().
Defines a linear constraint from a file.
Definition at line 612 of file linear_constraint.c. References TLinearConstraint::error, TLinearConstraint::ind, TLinearConstraint::max, TLinearConstraint::n, NEW, NewInterval(), and TLinearConstraint::val. Referenced by LoadMapping().
Deletes the information stored in a linear constraint and frees the allocated memory.
Definition at line 632 of file linear_constraint.c. References DeleteInterval(), TLinearConstraint::error, TLinearConstraint::ind, and TLinearConstraint::val. Referenced by AddSimplifiedJacobianEquations(), CleanLinearConstraint(), CropEquation(), CSRemoveLCVars(), CSRemoveVarsWithCtRange(), DeleteEquationInfo(), DeleteMapping(), FixVariableInEquation(), LinearizeGeneralEquationInt(), ReduceRange(), RewriteEquation2Simp(), ScaleLinearConstraint(), SetOriginalVarRelation(), SimplexAddNewConstraint(), SimplexGetOptimalValue(), and SimplifyCuikSystem(). |
Follow us!