equations.h File Reference Detailed DescriptionDefinition of the Tequations type and the associated functions.
Definition in file equations.h.
Macro Definition Documentation
Initial room for equations in an equation set. It will be enlarged if necessary.
Definition at line 30 of file equations.h. Referenced by InitEquations(). Function Documentation
Initializes a set of equations.
Definition at line 733 of file equations.c. References Tequations::c, Tequations::d, Tequations::e, Tequations::eqEQU, Tequations::equation, INIT_NUM_EQUATIONS, Tequations::m, Tequations::mequation, Tequations::mm, Tequations::n, Tequations::neq, NEW, Tequations::nm, Tequations::nsEQU, Tequations::polynomial, Tequations::s, Tequations::scalar, and TRUE. Referenced by DeriveEqualityEquations(), DummifyCuikSystem(), GaussianElimination(), GenerateWorldEquations(), InitCuikSystem(), RemoveEquationsWithVar(), and ReplaceVariableInEquations().
Initializes a set of equations from another set.
Definition at line 768 of file equations.c. References Tequations::c, CopyEquationInfo(), CopyMEquation(), Tequations::d, Tequations::e, Tequations::eqEQU, Tequations::equation, Tequations::m, Tequations::mequation, Tequations::mm, Tequations::n, Tequations::neq, NEW, Tequations::nm, Tequations::nsEQU, Tequations::polynomial, Tequations::s, and Tequations::scalar. Referenced by CopyCuikSystem(), CopyJacobian(), CuikSystemMerge(), DummifyCuikSystem(), GaussianElimination(), GetCSEquations(), RemoveEquationsWithVar(), ReplaceVariableInEquations(), and SimplifyCuikSystem().
Adds a set of equations to another.
Definition at line 815 of file equations.c. References AddEquation(), AddMatrixEquation(), Tequations::eqEQU, Tequations::equation, GetOriginalEquation(), Tequations::m, Tequations::mequation, Tequations::mm, and Tequations::nsEQU. Referenced by CuikSystemMerge().
Checks if a variable is used in non-dummy equations of the set of equations.
Definition at line 835 of file equations.c. References DUMMY_EQ, Tequations::equation, FALSE, GetEquationType(), GetEquationVariables(), GetOriginalEquation(), Tequations::mequation, VarIncluded(), and VarIncludedinMEquation(). Referenced by CSRemoveUnusedVars().
Checks if a variable is used in the set of equations.
Definition at line 860 of file equations.c. References Tequations::equation, FALSE, GetEquationVariables(), GetOriginalEquation(), Tequations::mequation, VarIncluded(), and VarIncludedinMEquation(). Referenced by CSRemoveUnusedVars(), and SampleCuikSystemInBox().
Removes all equations that include a given variable. This is one of the steps to remove a variable from a problem. Therefore, equations that do not include the given variable are also affected by this function: we have to shift all the variable indexes higher than the given one. The use of this function without using function RemoveVariable right immediately after it leaves the cuiksystem in a incoherent state.
Definition at line 882 of file equations.c. References AddEquation(), CopyEquations(), DeleteEquations(), Tequations::equation, Error(), FALSE, FixVariableInEquation(), GetEquationVariables(), GetOriginalEquation(), InitEquations(), Tequations::mequation, Tequations::n, Tequations::nm, ShiftVariablesInMEquation(), VarIncluded(), and VarIncludedinMEquation(). Referenced by CSRemoveUnusedVars().
Replaces a variable by linear combination of variables (including an offset). The use of this function without using function RemoveVariable right immediately after it leaves the cuiksystem in a incoherent state.
Definition at line 925 of file equations.c. References AddEquation(), CopyEquations(), DeleteEquations(), Tequations::equation, Error(), FALSE, GetOriginalEquation(), InitEquations(), ReplaceVariableInEquation(), Tequations::scalar, and TRUE. Referenced by CSRemoveLCVars(), and CSRemoveVarsWithCtRange().
Operates linearly pairs of equations (scale one of the and then sum them) with the objective of getting a simpler equation (i.e., one with less monomials). The rationale is that equations with less monomials produce simpler problems and, in some cases, they can trigger simplifications that are not evident at first sight. The use of this function without using function RemoveVariable right immediately after it leaves the cuiksystem in a incoherent state.
Definition at line 963 of file equations.c. References AccumulateEquations(), AddEquation(), CopyEquation(), CopyEquations(), DeleteEquation(), DeleteEquations(), DUMMY_EQ, EQU, Tequations::equation, Error(), FALSE, FindMonomial(), GetEquationCmp(), GetEquationNumVariables(), GetEquationType(), GetMonomial(), GetMonomialCt(), GetNumMonomials(), GetOriginalEquation(), InitEquations(), NEquations(), NO_UINT, PrintEquation(), Tequations::scalar, and TRUE. Referenced by SimplifyCuikSystem().
Number of equations in the set.
Definition at line 1075 of file equations.c. References Tequations::neq. Referenced by CSRemoveLCVars(), DummifyCuikSystem(), GaussianElimination(), GetCSNumEquations(), and UpdateCuikSystem().
Number of system equations in the set.
Definition at line 1080 of file equations.c. References Tequations::s.
Number of coordenalization equations in the set.
Definition at line 1085 of file equations.c. References Tequations::c.
Number of dummy equations in the set.
Definition at line 1090 of file equations.c. References Tequations::d.
Number of equality equations in the set.
Definition at line 1095 of file equations.c. References Tequations::e. Referenced by ErrorInCSEquations(), ErrorInSimpCSEquations(), ErrorInSolution(), InitJacobian(), and UpdateCuikSystem().
Number of inequality equations in the set.
Definition at line 1100 of file equations.c. References Tequations::e, and Tequations::neq. Referenced by ErrorInInequalities(), ErrorInSimpInequalitiesOnPoint(), InequalitiesHoldOnPoint(), and SimpInequalitiesHoldOnPoint().
Identify polynomial system of equations.
Definition at line 1105 of file equations.c. References Tequations::polynomial. Referenced by IsCSPolynomial(), and SimplifyCuikSystem().
Identifies scalar systems (systems with no matrix equations).
Definition at line 1110 of file equations.c. References Tequations::scalar. Referenced by CuikSystemMerge().
Identify system equations.
Definition at line 1115 of file equations.c. References Tequations::equation, Error(), GetEquationType(), GetOriginalEquation(), Tequations::neq, SYSTEM_EQ, and TRUE. Referenced by PrintEquations().
Identify coordenalization equations.
Definition at line 1126 of file equations.c. References COORD_EQ, Tequations::equation, Error(), GetEquationType(), GetOriginalEquation(), and Tequations::neq. Referenced by PrintEquations(), and RegenerateSolution().
Identify dummy equations.
Definition at line 1135 of file equations.c. References DUMMY_EQ, Tequations::equation, Error(), GetEquationType(), GetOriginalEquation(), and Tequations::neq. Referenced by PrintEquations(), and RegenerateSolution().
Gets the type of a particular equation.
Definition at line 1144 of file equations.c. References Tequations::equation, Error(), GetEquationType(), GetOriginalEquation(), Tequations::neq, NOTYPE_EQ, and SYSTEM_EQ.
Checks if a given equation is already in the set.
Definition at line 1160 of file equations.c. References CmpEquations(), Tequations::equation, FALSE, and GetOriginalEquation(). Referenced by AddEquation().
Adds an equation to the set and computes its associated information. Empty equations (equations with no monomials) or repeated equations are not added to the set. Moreover, equations are sorted from simplest to more complex.
Definition at line 1629 of file equations.c. References AddEquationInt(), CmpEquations(), Tequations::equation, Error(), GetEquationCmp(), GetEquationType(), GetNumMonomials(), GetOriginalEquation(), HasEquation(), Tequations::n, NOCMP, NormalizeEquation(), and NOTYPE_EQ. Referenced by AddEquation2CS(), DummifyAndAddEquation(), GaussianElimination(), MergeEquations(), RemoveEquationsWithVar(), and ReplaceVariableInEquations().
Adds an equation to the set and computes its associated information. This is like AddEquation but all equations are considered (even the empty or repeated ones) and equations are not sorted. This must be used in equation sets where the order of the equations must be preserved. This happens for some equations sets defined in the Tworld.
Definition at line 1656 of file equations.c. References AddEquationInt(), Error(), GetEquationCmp(), GetEquationType(), NOCMP, and NOTYPE_EQ. Referenced by GenerateWorldEquations().
Adds a matrix equation to the set and computes its associated information.
Definition at line 1665 of file equations.c. References CopyMEquation(), Tequations::e, Tequations::eqEQU, FALSE, HasRotations(), MEM_DUP, Tequations::mequation, Tequations::mm, Tequations::neq, NEW, Tequations::nm, Tequations::nsEQU, NumberScalarEquations(), Tequations::polynomial, Tequations::s, and Tequations::scalar. Referenced by AddMatrixEquation2CS(), DeriveEqualityEquations(), GenerateWorldEquations(), and MergeEquations().
Returns a pointer to the n-th equation stored in the set.
Definition at line 1697 of file equations.c. References Tequations::equation, Error(), GetOriginalEquation(), and Tequations::scalar. Referenced by CSRemoveLCVars(), DummifyCuikSystem(), GenerateWorldSingularityEquations(), GetCSEquation(), and GetJacobianEquation().
Gets a box (as an array of parameters is of size m) and uses the equation number ne to reduce the ranges of the variables involved in the equation as much as possible.
Definition at line 1175 of file equations.c. References BILINEAL_MONOMIAL_EQUATION, BoxSaddleClipping(), BoxSphereClipping(), CIRCLE_EQUATION, CopyBox(), CopyInterval(), CropLinearConstraint(), DeleteBox(), DeleteLinearConstraint(), EMPTY_BOX, TequationInfo::EqType, EQU, Tequations::equation, Error(), EvaluateEquationInt(), FALSE, GENERAL_EQUATION, GetBoxIntervals(), GetBoxNIntervals(), GetEquationBounds(), GetEquationCmp(), GetEquationValue(), GetEquationVariables(), GetFirstOrderApproximationToEquation(), GetLinearConstraintError(), GetMonomial(), GetMonomialCt(), GetMonomialVariables(), GetNumMonomials(), GetOriginalEquation(), GetVariableN(), GetVariableTypeN(), INF, Intersect(), IntervalCenter(), IntervalSize(), TequationInfo::lc, LINEAR_EQUATION, LowerLimit(), TequationInfo::n, Tequations::n, Tequations::neq, NEW, NewInterval(), NOT_REDUCED_BOX, PARABOLA_EQUATION, PolynomialEquation(), PrintEquation(), PrintInterval(), RectangleCircleClipping(), RectangleParabolaClipping(), REDUCED_BOX, SADDLE_EQUATION, SetLinearConstraintError(), SimplexExpandBounds(), SPHERE_EQUATION, TRUE, UpperLimit(), VariableSetSize(), and ZERO. Referenced by AddEquation2Simplex(), ReduceBoxEquationWise(), and RegenerateSolution().
Adds linear constraints representing the selected equation (i.e., a linear relaxation of the equation) to a simplex tableau. Linear constraints are directly added to the simplex using the information cached in the TequationInfo structure. Non linear equations are linearized using the information stored in the Jacobian and Hessian fields in the corresponding TequationInfo too. Different equations are linearized in a different way
By using small lr2tm_q and lr2tm_s we generate linear relaxations that tightly bound the functions and this reduces the number of iterations to found the solution. The drawnback is that we we add more constraints to the simplex and this slows downs each iteration. Equations that define particular variables (cartesian or dummy ones) are only added to the simplex if the variable is used in any of the other constraints already in the simplex. Otherwise we will add useless constraints. This filter is implemented with the array of booleans usedVar. This array is updated as we add equations to the simplex and is checked to see if defined variables are used before adding the corresponding equation to the simplex. For this to be operative, equations are ordered so that system equations are added first to the simplex, then cartesian equations and, finally, dummyfications equations. There is no need to equations that involves almost constant variables to the simplex. Thus, before adding an EQU equation to the simplex, we evaluate the equations using interval arithmetics and if the result is almost constant(this occurs if the variables involved in the equation are have tiny ranges) we just check if the equation holds or not. If not, the system has no solution. The same applies to inequalities that already hold. An inequality (LEQ, GEQ equations) that trivially holds do not add any constrain to the simplex and, consequently we do not add it to the Tableau.
Definition at line 2185 of file equations.c. References ANY_TYPE_VAR, BILINEAL_MONOMIAL_EQUATION, CIRCLE_EQUATION, CleanInfEquation(), CropEquation(), DeleteEquation(), DeleteEquationInfo(), EMPTY_BOX, TequationInfo::EqType, EQU, Tequations::equation, Error(), EvaluateEquationInt(), FALSE, GENERAL_EQUATION, GEQ, GetBoxIntervals(), GetBoxMinSizeVarSet(), GetEquationCmp(), GetEquationValue(), GetEquationVariables(), GetOriginalEquation(), INF, IntervalOffset(), IntervalSize(), IsInside(), TequationInfo::lc, LEQ, LINEAR_EQUATION, LinearizeBilinealMonomialEquation(), LinearizeCircleEquation(), LinearizeGeneralEquation(), LinearizeParabolaEquation(), LinearizeSaddleEquation(), LinearizeSphereEquation(), LowerLimit(), NEW, PARABOLA_EQUATION, PrintEquation(), PrintInterval(), SADDLE_EQUATION, Tequations::scalar, SetEquationInfo(), SimplexAddNewConstraint(), SPHERE_EQUATION, TRUE, and UpperLimit(). Referenced by ReduceBox().
When the SPLIT_ERROR parameter is set to TRUE, we select the split variable for a box from the linearization error induced by the variables. This function updates the error induced by the variables in a given equation.
Definition at line 2430 of file equations.c. References TequationInfo::EqType, TequationInfo::equation, Tequations::equation, Error(), ErrorDueToVariable(), GetBoxIntervals(), GetBoxNIntervals(), GetEquationVariables(), GetVariableN(), IntervalCenter(), LINEAR_EQUATION, TequationInfo::n, NEW, and Tequations::scalar. Referenced by ComputeSplitDimInt().
Evaluates all equality equations in the set. This includes the equality scalar equations and all matrix equations.
Definition at line 2477 of file equations.c. References EQU, Tequations::equation, EvaluateMEquation(), EvaluateWholeEquation(), GetEquationCmp(), GetEquationType(), GetOriginalEquation(), Tequations::mequation, Tequations::n, Tequations::nm, and SYSTEM_EQ. Referenced by CuikNewtonInBox(), CuikNewtonSimp(), ErrorInCSEquations(), ErrorInSimpCSEquations(), ErrorInSolution(), EvaluateCSEquations(), EvaluateHessian(), EvaluateJacobian(), EvaluateSimpCSEquations(), GetLinkTransformsFromSolution(), and PrintWorldAxes().
Evaluates a subset of the equality equations in the set. This includes the equality scalar equations and some of the matrix equations.
Definition at line 2505 of file equations.c. References EQU, Tequations::equation, EvaluateMEquation(), EvaluateWholeEquation(), GetEquationCmp(), GetOriginalEquation(), MAX_EQ_MATRIX, Tequations::mequation, Tequations::n, and Tequations::nm. Referenced by EvaluateSubSetSimpCSEquations().
In sparse systems, many equations are empty. This function is a variant of EvaluateEqualityEquations specialy efficient for this kind of systems.
Definition at line 2563 of file equations.c. References CacheScalarEQUInfo(), Tequations::eqEQU, EvaluateMEquation(), EvaluateWholeEquation(), Tequations::mequation, Tequations::n, Tequations::nm, and Tequations::nsEQU. Referenced by EvaluateJacobianInVector(), and EvaluateTransposedJacobianInVector().
In sparse systems, many equations are empty. This function is a variant of EvaluateSubSetEqualityEquations specialy efficient for this kind of systems.
Definition at line 2586 of file equations.c. References CacheScalarEQUInfo(), Tequations::eqEQU, EvaluateMEquation(), EvaluateWholeEquation(), MAX_EQ_MATRIX, Tequations::mequation, Tequations::n, Tequations::nm, and Tequations::nsEQU. Referenced by EvaluateJacobianSubSetInVector(), and EvaluateTransposedJacobianSubSetInVector().
This is a funcition with a very particular purpose. It evaluates a matrix equation M, and it returns M*v[i] for a set of 3D vectors, v[i]. See EvaluateJacobianXVectors for more details on why this is necessary. This function triggeres an error if the equation set includes scalar equations.
Definition at line 2624 of file equations.c. References Error(), EvaluateMEquationXVectors(), Tequations::mequation, Tequations::n, and Tequations::nm. Referenced by EvaluateJacobianXVectors().
Evaluates all inequalities and returns and array with the error in each of them. The error is 0 if the inequality hold.
Definition at line 2643 of file equations.c. References EQU, Tequations::equation, EvaluateEquation(), GEQ, GetEquationCmp(), GetEquationValue(), GetOriginalEquation(), and Tequations::n. Referenced by ErrorInInequalities(), ErrorInSimpInequalitiesOnPoint(), InequalitiesHoldOnPoint(), and SimpInequalitiesHoldOnPoint().
Derives an equation set with respect to a given variable. The derivative is only computed for equality equations.
Definition at line 2668 of file equations.c. References AddEquationInt(), AddMatrixEquation(), DeleteEquation(), DeleteMEquation(), DeriveEquation(), DeriveMEquation(), EQU, Tequations::equation, GetEquationCmp(), GetOriginalEquation(), InitEquations(), Tequations::mequation, Tequations::n, and Tequations::nm. Referenced by InitHessian(), and InitJacobian().
Writes a set of equations into a stream.
Definition at line 2694 of file equations.c. References Tequations::c, Tequations::d, Tequations::equation, GetOriginalEquation(), IsCoordEquation(), IsDummyEquation(), IsSystemEquation(), Tequations::mequation, Tequations::n, Tequations::nm, PrintEquation(), PrintMEquation(), and Tequations::s. Referenced by CSRemoveLCVars(), CSRemoveVarsWithCtRange(), PrintCuikSystem(), PrintCuikSystemWithSimplification(), PrintJacobian(), and SimplifyCuikSystem().
Deletes the information stored in the set of equations and frees the allocated memory space.
Definition at line 2750 of file equations.c. References DeleteEquationInfo(), DeleteMEquation(), Tequations::eqEQU, Tequations::equation, Tequations::mequation, Tequations::n, Tequations::nm, and Tequations::nsEQU. Referenced by DeleteCuikSystem(), DeleteHessian(), DeleteJacobian(), DeleteWorldCS(), DummifyCuikSystem(), GaussianElimination(), RemoveEquationsWithVar(), ReplaceVariableInEquations(), and UnUpdateCuikSystem(). |
Follow us!