cuiksystem.h File Reference

Detailed Description

Definition of the TCuikSystem type and the associated functions.

See Also
TCuikSystem, cuiksystem.c, readcuiksystem.l, readcuiksystem.y,

Definition in file cuiksystem.h.

Data Structures

struct  TCuikSystem
 A cuiksystem, i.e., a set of variables and equations defining a position analysis problem. More...
 

Macros

#define EQ_MIN_IN_CENTER   0
 Set to 1 to sort boxes according to the evaluation in its center. More...
 
#define NEWTON_WITHIN_RANGES   0
 Set to one to avoid Newton to scape from boxes. More...
 
#define DEPTH_FIRST_SEARCH   1
 Depth first search. More...
 
#define BREADTH_FIRST_SEARCH   2
 Breadth first search. More...
 
#define MINIMIZATION_SEARCH   3
 Search based on a minimum value of a given equation. More...
 
#define CUT_POINT   0.45+0.1*randomDouble()
 Point, relative to the size of the selected box side, where we split a box. More...
 
#define MPI_TREAT_BOX_TIMEOUT(cs)   (cs->nvariables*SIMPLEX_TIMEOUT*10)
 MPI child-process timeout. More...
 
#define DIVERGED   1
 One of the possible outputs of the Newton iteration. More...
 
#define CONVERGED_IN_BOX   2
 One of the possible outputs of the Newton iteration. More...
 
#define CONVERGED_IN_GLOBAL   4
 One of the possible outputs of the Newton iteration. More...
 
#define CONVERGED_OUTSIDE_GLOBAL   8
 One of the possible outputs of the Newton iteration. More...
 
#define CONVERGED   (CONVERGED_IN_BOX|CONVERGED_IN_GLOBAL|CONVERGED_OUTSIDE_GLOBAL)
 Union of all possible convergence cases for Newton interation. More...
 

Functions

void InitCuikSystem (TCuikSystem *cs)
 Constructor. More...
 
void InitCuikSystemFromFile (Tparameters *p, char *filename, TCuikSystem *cs)
 Constructor from a file. More...
 
void AddCuikSystemFromFile (Tparameters *p, char *filename, TCuikSystem *cs)
 Adds information from a file. More...
 
void VerifyCuikSystem (Tparameters *p, TCuikSystem *cs)
 Checks the consistency of the cuiksystem. More...
 
void CopyCuikSystem (TCuikSystem *cs_dst, TCuikSystem *cs_src)
 Copy constructor. More...
 
void CuikSystemMerge (Tparameters *p, TCuikSystem *cs1, TCuikSystem *cs2, TCuikSystem *cs)
 Produces the union of two cuik systems. More...
 
boolean CmpBoxesEquation (void *b1, void *b2, void *cs)
 Determines which box to explore first in minimization mode. More...
 
void SetCSSearchMode (unsigned int sm, Tequation *eqMin, TCuikSystem *cs)
 Sets the search mode for the cuiksystem. More...
 
void AddTerm2SearchCriterion (double w, unsigned int v, double val, TCuikSystem *cs)
 Adds penalty terms to the search criterion. More...
 
unsigned int AddVariable2CS (Tvariable *v, TCuikSystem *cs)
 Adds a variable to the system. More...
 
void AddEquation2CS (Tparameters *p, Tequation *eq, TCuikSystem *cs)
 Adds an equation to the system. More...
 
void AddMatrixEquation2CS (Tparameters *p, TMequation *eq, TCuikSystem *cs)
 Adds a matrix equation to the system. More...
 
void GetCSVariables (Tvariables *vs, TCuikSystem *cs)
 Gets the cuiksystem variables. More...
 
void GetCSVariableNames (char **varNames, TCuikSystem *cs)
 Gets points to the variable names. More...
 
unsigned int GetCSNumVariables (TCuikSystem *cs)
 Gets the number of variables already in the cuiksystem. More...
 
unsigned int GetCSNumSystemVariables (TCuikSystem *cs)
 Gets the number of system variables already in the cuiksystem. More...
 
unsigned int GetCSNumNonDummyVariables (TCuikSystem *cs)
 Gets the number of non-dummy variables already in the cuiksystem. More...
 
void GetCSVariable (unsigned int n, Tvariable *v, TCuikSystem *cs)
 Gets the a variable from a cuiksystem. More...
 
void SetCSVariableRange (unsigned int n, Tinterval *r, TCuikSystem *cs)
 Gets the range of a variable from a cuiksystem. More...
 
unsigned int GetCSVariableID (char *name, TCuikSystem *cs)
 Gets the numerical identifier of a variable given its name. More...
 
char * GetCSVariableName (unsigned int id, TCuikSystem *cs)
 Gets a variable name. More...
 
char * GetCSSystemVariableName (unsigned int id, TCuikSystem *cs)
 Gets a system variable name. More...
 
boolean IsSystemVarInSimpCS (Tparameters *p, char *v, TCuikSystem *cs)
 Identifies system variables that survive in the simplified system. More...
 
unsigned int GetCSSystemVars (boolean **sv, TCuikSystem *cs)
 Identifies the system variables. More...
 
unsigned int GetCSVarTopology (unsigned int vID, TCuikSystem *cs)
 Determines the topology of a given variable. More...
 
void GetCSEquations (Tequations *eqs, TCuikSystem *cs)
 Gets a copy of the system equations. More...
 
unsigned int GetCSNumEquations (TCuikSystem *cs)
 Gets the number of equations already in the cuiksystem. More...
 
void GetCSEquation (unsigned int n, Tequation *eq, TCuikSystem *cs)
 Gets the an equation from a cuiksystem. More...
 
boolean IsCSPolynomial (TCuikSystem *cs)
 Identifies polynomial cuiksystems. More...
 
boolean IsCSScalar (TCuikSystem *cs)
 Identifies scalar cuiksystems. More...
 
void GetCSJacobian (TJacobian *J, TCuikSystem *cs)
 Defines the Jacobian of a CuikSystem. More...
 
unsigned int GetSimpCSTopology (Tparameters *p, unsigned int **t, TCuikSystem *cs)
 Topology of the variables in the simplified system. More...
 
unsigned int GetCSTopology (Tparameters *p, unsigned int **t, TCuikSystem *cs)
 Topology of the variables in the system. More...
 
void GetSimpCSJacobian (Tparameters *p, TJacobian *J, TCuikSystem *cs)
 Defines the Jacobian of a simplified CuikSystem. More...
 
void AddJacobianEquations (Tparameters *p, boolean *selectedVars, TCuikSystem *cs)
 Adds linear a linear combination of the Jacobian to the system. More...
 
void AddSimplifiedJacobianEquations (Tparameters *p, boolean *selectedVars, TCuikSystem *cs)
 Adds a linear combination of the Jacobian to the system. More...
 
unsigned int MaxReduction (Tparameters *p, unsigned int varMask, double *r, Tbox *b, TCuikSystem *cs)
 Reduces a box as much as possible. More...
 
boolean SampleCuikSystem (Tparameters *p, char *fname, Tlist *sb, unsigned int nsamples, unsigned int ntries, unsigned int ndof, TCuikSystem *cs)
 Generates samples for a cuiksystem. More...
 
boolean SampleCuikSystemInBox (Tparameters *p, char *fname, Tlist *sb, unsigned int nsamples, unsigned int ntries, unsigned int ndof, Tbox *init_box, TCuikSystem *cs)
 Generates samples for a cuiksystem in given box. More...
 
boolean IncrementalSampleCuikSystem (Tparameters *p, char *fname, Tlist *sb, boolean *fixVars, unsigned int nsamples, unsigned int ntries, unsigned int ndof, TCuikSystem *cs)
 Generates samples for a cuiksystem. More...
 
boolean IncrementalSampleCuikSystemInBox (Tparameters *p, char *fname, Tlist *sb, boolean *fixVars, unsigned int nsamples, unsigned int ntries, unsigned int ndof, Tbox *init_box, TCuikSystem *cs)
 Generates samples for a cuiksystem in given box. More...
 
unsigned int CuikNewtonSimp (Tparameters *p, double *x, TCuikSystem *cs)
 CuikNewton on the simplified system. More...
 
unsigned int CuikNewtonInBox (Tparameters *p, Tbox *bIn, double *sol, Tbox *b_sol, TCuikSystem *cs)
 Applies Newton-Rhapson to a set of equations. More...
 
boolean CuikNewton (Tparameters *p, double *sol, Tbox *b_sol, TCuikSystem *cs)
 Applies Newton-Rhapson to a set of equations. More...
 
unsigned int CuikGradientInBox (Tparameters *p, Tbox *bIn, double *sol, Tbox *b_sol, TCuikSystem *cs)
 Applies gradient descent to a set of equations. More...
 
boolean CuikGradient (Tparameters *p, double *sol, Tbox *b_sol, TCuikSystem *cs)
 Applies gradient descent to a set of equations. More...
 
void SolveCuikSystem (Tparameters *p, boolean restart, char *fstate, Tbox *searchSpace, FILE *f_out, Tlist *sol, TCuikSystem *cs)
 Determines the solution set for a cuiksystem. More...
 
void MPI_SolveCuikSystem (Tparameters *p, boolean restart, char *fstate, Tbox *searchSpace, FILE *f_out, TCuikSystem *cs)
 Determines the solution set for a cuiksystem. Main scheduler. More...
 
void MPI_TreatBox (Tparameters *p, TCuikSystem *cs)
 Determines the solution set for a cuiksystem. Child process. More...
 
void GenerateInitialBox (Tbox *box, TCuikSystem *cs)
 Gives the search space in the form of a box. More...
 
void GenerateSimpInitialBox (Tparameters *p, Tbox *box, TCuikSystem *cs)
 Gives the search space in the form of a box for the simplified system. More...
 
boolean RegenerateSolution (Tparameters *p, Tbox *b, TCuikSystem *cs)
 Regenerates a box from the system variables. More...
 
unsigned int RegenerateSolutionPoint (Tparameters *p, double *pt, double **rp, TCuikSystem *cs)
 Regenerates a solution point from the system variables. More...
 
void RegenerateOriginalBox (Tparameters *p, Tbox *boxS, Tbox *boxO, TCuikSystem *cs)
 Generates a box in the original cuiksystem from a box of the simplified one. More...
 
unsigned int RegenerateOriginalPoint (Tparameters *p, double *s, double **o, TCuikSystem *cs)
 Generates an original point from a simplified point. More...
 
unsigned int GenerateSimplifiedPoint (Tparameters *p, double *o, double **s, TCuikSystem *cs)
 Generates a simplified point. More...
 
unsigned int SimplifyBooleanArray (Tparameters *p, boolean *bo, boolean **bs, TCuikSystem *cs)
 Transforms arrays of booleans from the original to the simplified system. More...
 
unsigned int ComputeSplitDim (Tparameters *p, Tbox *b, TCuikSystem *cs)
 Determines the best dimensions to split a given box. More...
 
boolean PointInSystemBox (Tvector *v, Tbox *b, TCuikSystem *cs)
 Determines if a given point is fully included in the system sub-box (i.e., the sub-box fot the system variables). More...
 
void EvaluateCSEquations (double *p, double *r, TCuikSystem *cs)
 Evaluates the equation set on a point. More...
 
void EvaluateSimpCSEquations (Tparameters *pr, double *p, double *r, TCuikSystem *cs)
 Evaluates the simplified equation set on a point. More...
 
void EvaluateSubSetSimpCSEquations (Tparameters *pr, boolean *se, double *p, double *r, TCuikSystem *cs)
 Evaluates a subset of the simplified equation set on a point. More...
 
double ErrorInCSEquations (double *p, TCuikSystem *cs)
 Evalates the norm of the error in a point. More...
 
double ErrorInSimpCSEquations (Tparameters *pr, double *p, TCuikSystem *cs)
 Evaluates the norm of the error in a point for the simplified equations. More...
 
double EvaluateCSCost (Tparameters *p, boolean simp, double *s, void *cs)
 Evalutes the equation to minimize in a given point. More...
 
void EvaluateCSJacobian (double *p, double ***J, TCuikSystem *cs)
 Evaluates the Jacobian of the system in a given point. More...
 
double ErrorInSolution (Tbox *b, TCuikSystem *cs)
 Maximum error for a box. More...
 
double ErrorInInequalities (Tbox *b, TCuikSystem *cs)
 Maximum inequality error for a box. More...
 
boolean InequalitiesHoldOnPoint (double *p, TCuikSystem *cs)
 Tests if all inqualities hold for a given point. More...
 
boolean SimpInequalitiesHoldOnPoint (Tparameters *pr, double *p, TCuikSystem *cs)
 Tests if all simplified inqualities hold for a given point. More...
 
double ErrorInSimpInequalitiesOnPoint (Tparameters *pr, double *p, TCuikSystem *cs)
 Computes the maximum error in all the simplified inqualities for a given point. More...
 
unsigned int ManifoldDimension (Tparameters *pr, double *p, TCuikSystem *cs)
 Computes the dimension of the solution space. More...
 
void PrintCuikSystem (Tparameters *p, FILE *f, TCuikSystem *cs)
 Prints a cuiksystem. More...
 
void PrintCuikSystemWithSimplification (Tparameters *p, FILE *f, TCuikSystem *cs)
 Prints the simplified cuiksystem. More...
 
void SaveCuikSystemSimplification (Tparameters *p, FILE *f, TCuikSystem *cs)
 Saves the simplification information associated with a cuiksystem. More...
 
void DeleteCuikSystem (TCuikSystem *cs)
 Destructor. More...
 

Macro Definition Documentation

#define EQ_MIN_IN_CENTER   0

Boxes to be reduced can be sorted according to a given equation. If this is set to 1 we evaluate this equation in the center of each box If set to 1 we evaluate the equation interval-wise and take the center of the resulting interval.

Todo:
Just select the evaluation method that is better and remove the other.

Definition at line 38 of file cuiksystem.h.

#define NEWTON_WITHIN_RANGES   0

Set to one to avoid Newton to scape from boxes.

Todo:
Remove this if box limits do not help at all

Definition at line 46 of file cuiksystem.h.

#define DEPTH_FIRST_SEARCH   1

In this mode, boxes to be reduced are sorted so that boxes with a higher level (i.e., resulting from more bisections) are treated first.

Definition at line 54 of file cuiksystem.h.

Referenced by InitCuikSystem(), MPI_SolveCuikSystem(), SetCSSearchMode(), SolveCuikSystem(), and UpdateCuikSystem().

#define BREADTH_FIRST_SEARCH   2

In this mode, boxes to be reduced are sorted so that boxes with a smaller level (i.e., resulting from less bisections) are treated first.

Definition at line 63 of file cuiksystem.h.

Referenced by MPI_SolveCuikSystem(), SetCSSearchMode(), and SolveCuikSystem().

#define MINIMIZATION_SEARCH   3

In this mode, boxes to be reduced are sorted so that we tread first boxes whose value with repect to a given equation are minimal (among all boxes pending to be treated).

In the current implementation the center of the box is used to evaluate the criterion to be minimized.

Definition at line 76 of file cuiksystem.h.

Referenced by AddTerm2SearchCriterion(), CopyCuikSystem(), EvaluateEqMin(), MPI_SolveCuikSystem(), PostProcessBox(), PrintCuikSystem(), PrintCuikSystemWithSimplification(), SetCSSearchMode(), SolveCuikSystem(), UnUpdateCuikSystem(), and UpdateCuikSystem().

#define CUT_POINT   0.45+0.1*randomDouble()

Point, relative to the size of the selected box side, where we split a box.

Definition at line 88 of file cuiksystem.h.

Referenced by PostProcessBox().

#define MPI_TREAT_BOX_TIMEOUT (   cs)    (cs->nvariables*SIMPLEX_TIMEOUT*10)

Maximum time (in seconds) we give a child-process to reduce a box. Only used when cuik is executed in a multi-processor environment.

Definition at line 100 of file cuiksystem.h.

Referenced by MPI_SolveCuikSystem().

#define DIVERGED   1

Returned by CuikNewtonInBox when the Newton iteration was repeated for more than CT_MAX_NEWTON_ITERATIONS times without reaching a stationary point.

Definition at line 111 of file cuiksystem.h.

Referenced by AddBranchToRRT(), ConnectSamples(), CuikGradientInBox(), CuikNewtonInBox(), CuikNewtonSimp(), GeodesicDistance(), and main().

#define CONVERGED_IN_BOX   2

Returned by CuikNewtonInBox when the Newton iteration converged to a point inside the given box.

Note that if the Newton converges in the current box it also converges in the initial box however the more restrictive condition (convergence in local box) is returned.

Definition at line 124 of file cuiksystem.h.

Referenced by CuikGradient(), CuikGradientInBox(), CuikNewton(), CuikNewtonInBox(), CuikNewtonSimp(), IncrementalSampleCuikSystemInBox(), main(), and PostProcessBox().

#define CONVERGED_IN_GLOBAL   4

Returned by CuikNewtonInBox when the Newton iteration converged to a point outside the given box, but inside the initial box.

Note that if the Newton converges in the current box it also converges in the initial box however the more restrictive condition (convergence in local box) is returned.

Definition at line 138 of file cuiksystem.h.

Referenced by CuikGradient(), CuikGradientInBox(), CuikNewton(), CuikNewtonInBox(), CuikNewtonSimp(), IncrementalSampleCuikSystemInBox(), main(), and PostProcessBox().

#define CONVERGED_OUTSIDE_GLOBAL   8

Returned by CuikNewtonInBox when the Newton iteration converged but to a point that is outside the initial box.

Note that this is only returned if the process converged but outside the global box.

Definition at line 150 of file cuiksystem.h.

Referenced by CuikGradientInBox(), CuikNewtonInBox(), and main().

The union of all possible convergence cases for Newton iteration. Provide to facilitate the test whether or not a call actually converged (to anywhere)

Definition at line 158 of file cuiksystem.h.

Function Documentation

void InitCuikSystemFromFile ( Tparameters p,
char *  filename,
TCuikSystem cs 
)

Creates an cuiksystem from the information on a file. Right now we do not have a manual of the syntax of the ".cuik" files so check the examples in the CuikSuite examples directory or in the benchmarks section of our web page

Parameters
pA set of parameters.
filenameThe name of the file from which to read the variables and equations.
csThe cuiksystem to initialize.

Referenced by InitCSWDFromFile(), and main().

void AddCuikSystemFromFile ( Tparameters p,
char *  filename,
TCuikSystem cs 
)

Adds information (constants/variables/equations) to a cuiksystem from another file. This is typically used to build a cuiksystem from a set of files where each file assumes we already loaded the previous ones (when adding contact equations to a cuiksystem or eigengrasp equations or singularity equations or....).

This function is exacty the same as InitCuikSystemFromFile but the system is not initialized from scratch but assumed pre-initialized.

Parameters
pA set of parameters.
filenameThe name of the file from which to read the variables and equations.
csThe cuiksystem to initialize.

Referenced by main().

void VerifyCuikSystem ( Tparameters p,
TCuikSystem cs 
)

Checks the consistency of the cuiksystem. If the system is inconsistent an error is trigered. Note that if new equations/variables are added to the cuiksystem its consistancy might no longer hold.

Parameters
pThe set of parameters.
csThe cuiksystem to verify.

Definition at line 2206 of file cuiksystem.c.

References Error(), and UpdateCuikSystem().

Referenced by main().

void CuikSystemMerge ( Tparameters p,
TCuikSystem cs1,
TCuikSystem cs2,
TCuikSystem cs 
)

Defines a new cuiksystem by union of two given cuiksystems.

CAUTION!

  • The variables for one of the input systems must be a subset (or equal) of the variable set of the other system. If this is not so the result is undefined.
Parameters
pThe set of parameters.
cs1The first cuik system merge.
cs2The second cuiksystem to merge.
csThe output merged cuiksystem.

Definition at line 2335 of file cuiksystem.c.

References AccumulateEquations(), AddVariable2CS(), TCuikSystem::consistent, TCuikSystem::constants, CopyEquation(), CopyEquations(), CopyVariables(), TCuikSystem::empty, FALSE, GetVariable(), InitCuikSystem(), MergeConstants(), MergeEquations(), TCuikSystem::nequations, TCuikSystem::notDummyVar, NVariables(), TCuikSystem::nvariables, TCuikSystem::orig2sd, TCuikSystem::orig_eqMin, TCuikSystem::orig_equations, TCuikSystem::orig_nequations, TCuikSystem::orig_notDummyVar, TCuikSystem::orig_nvariables, TCuikSystem::orig_systemVar, TCuikSystem::orig_variables, TCuikSystem::scalar, ScalarEquations(), TCuikSystem::searchMode, TCuikSystem::simp_empty, TCuikSystem::systemVar, TRUE, TCuikSystem::updated, and TCuikSystem::varType.

boolean CmpBoxesEquation ( void *  b1,
void *  b2,
void *  cs 
)

Determines which box to explore first in minimization mode. In this mode boxes are sorted according to an objective function given by an equation in the problem file. The equation is evaluated at the center of the box and the box with a minimum value is processed first.

Parameters
b1The first box.
b2The second box.
csThe TCuikSystem structure storing the equation to use when evaluating
Returns
TRUE if the first box is to be explored before than the second one when in minimization mode.
See Also
EvaluateEqMin

Definition at line 2428 of file cuiksystem.c.

References EvaluateEqMin().

Referenced by MPI_SolveCuikSystem(), and SolveCuikSystem().

void SetCSSearchMode ( unsigned int  sm,
Tequation eqMin,
TCuikSystem cs 
)

Defines the criterion to be used sorting the boxes to be treated when searching for a solution.

Possible critera are

  • Depth First
  • Breadth First
  • Minimum value for a given equation first.
Parameters
smSearch mode: DEPTH_FIRST_SEARCH, BREADTH_FIRST_SEARCH or MINIMIZATION_SEARCH.
eqMinWhen the search mode is MINIMIZATION_SEARCH, the criterion to be minimized. Otherwise it is not used.
csThe cuiksystem to update.

Definition at line 2433 of file cuiksystem.c.

References BREADTH_FIRST_SEARCH, CopyEquation(), DeleteEquation(), DEPTH_FIRST_SEARCH, Error(), MINIMIZATION_SEARCH, TCuikSystem::orig_eqMin, TCuikSystem::searchMode, UnUpdateCuikSystem(), and TCuikSystem::updated.

Referenced by AddTerm2SearchCriterion().

void AddTerm2SearchCriterion ( double  w,
unsigned int  v,
double  val,
TCuikSystem cs 
)

Adds the

$w(v-val)^2$

to the equation guiding the search.
This is useful when incrementally defining a penalty function where we aim of finding solutions in the center of the range of some variables.

This function automatically calls SetCSSearchMode to set the search mode to MINIMIZATION_SEARCH it is is not so.

Parameters
wWeight for the new constraint to add.
vVariable for the new constraint to add.
valTarged value for the new variable. Typically the center of the variable range.
csThe cuiksystem to update.

Definition at line 2456 of file cuiksystem.c.

References AccumulateEquations(), AddCt2Monomial(), AddMonomial(), AddVariable2Monomial(), DeleteEquation(), DeleteMonomial(), EQU, InitEquation(), InitMonomial(), MINIMIZATION_SEARCH, NFUN, TCuikSystem::orig_eqMin, ResetMonomial(), TCuikSystem::searchMode, SetCSSearchMode(), SetEquationCmp(), UnUpdateCuikSystem(), and TCuikSystem::updated.

Referenced by GenerateJointRangeEquations().

unsigned int AddVariable2CS ( Tvariable v,
TCuikSystem cs 
)

Adds a new variable to the system.

Parameters
vThe variable to add.
csThe cuiksystem where to add the variable.
Returns
The numerical identifier assigned to the new variable. If there is another variable with the same name, this function generates an error.

Definition at line 2532 of file cuiksystem.c.

References AddVariable(), GetVariableID(), GetVariableName(), NO_UINT, TCuikSystem::orig_variables, UnUpdateCuikSystem(), and TCuikSystem::updated.

Referenced by AddJacobianEquationsInt(), AdjustBioWorldGeometry(), CuikSystemMerge(), GenerateEquationsFromBranch(), GenerateJointEquations(), GenerateJointRangeEquations(), GenerateJointRangeSingularityEquations(), GenerateLinkConf(), GenerateLinkRotAxisX(), GenerateLinkRotFLinks(), GenerateLinkRotLinks(), GenerateLinkRotQLinks(), GenerateWorldSingularityEquations(), and GetSCpSystem().

void AddEquation2CS ( Tparameters p,
Tequation eq,
TCuikSystem cs 
)
void AddMatrixEquation2CS ( Tparameters p,
TMequation eq,
TCuikSystem cs 
)

Adds a new matrix equation to the system. The equation must use the variables already added to the system. No check is performed to determine if the matrix equation is repeated.

Parameters
pA set of parameters.
eqThe matrix equation to add.
csThe cuiksystem where to add the equation.

Definition at line 2511 of file cuiksystem.c.

References AddMatrixEquation(), Error(), FALSE, TCuikSystem::orig_equations, TCuikSystem::scalar, SimplifiedMEquation(), UnUpdateCuikSystem(), and TCuikSystem::updated.

Referenced by GenerateEquationsFromBranch().

void GetCSVariables ( Tvariables vs,
TCuikSystem cs 
)

Returns a copy of the variables stored in the cuiksystem. This can be seen as a Tvariables copy constructor, thus the output variables does not need to be initialized beforehand.

Parameters
vsPointer to the space where to copy the variables.
csThe cuiksystem from where to get the variables.
See Also
CopyVaribles

Definition at line 2550 of file cuiksystem.c.

References CopyVariables(), and TCuikSystem::orig_variables.

Referenced by GenerateWorldEquations().

void GetCSVariableNames ( char **  varNames,
TCuikSystem cs 
)

Initializes an array of pointers to variable names.

This is used to print boxes.

Parameters
varNamesThe array where to store the pointers. This array must be allocated/deallocated externally.
csThe cuiksystem to query.

Definition at line 2555 of file cuiksystem.c.

References GetVariableNames(), and TCuikSystem::orig_variables.

Referenced by AdjustBioWorldGeometry(), and GetWorldVarNames().

unsigned int GetCSNumVariables ( TCuikSystem cs)

Returns the number of variables already in the cuiksystem.

Parameters
csThe cuiksystem to query.
Returns
The number of variables already in the cuiksystem.

Definition at line 2565 of file cuiksystem.c.

References NVariables(), and TCuikSystem::orig_variables.

Referenced by DealWithCP(), GenerateWorldTWSEquations(), GetSCpSystem(), GetWorldNumVariables(), GetWorldSimpVariableMask(), IncrementalSampleCuikSystemInBox(), main(), MoveWorld(), RegenerateWorldSolutionPoint(), SampleCuikSystemInBox(), and WorldDOF2Sol().

unsigned int GetCSNumSystemVariables ( TCuikSystem cs)

Returns the number of system variables in the cuiksystem. System variables are system+secondary (see GetCSSystemVars).

Parameters
csThe cuiksystem to query.
Returns
The number of system variables already in the cuiksystem.

Definition at line 2570 of file cuiksystem.c.

References GetNumSecondaryVariables(), GetNumSystemVariables(), and TCuikSystem::orig_variables.

Referenced by GetSolutionPointFromLinkTransforms(), GetWorldNumSystemVariables(), MoveWorld(), and RegenerateWorldOriginalSystemPoint().

unsigned int GetCSNumNonDummyVariables ( TCuikSystem cs)

Returns the number of non-dummy (i.e., the sum of system, secondary and cartesian variables) variables already in the cuiksystem.

Parameters
csThe cuiksystem to query.
Returns
The number of non-dummy variables already in the cuiksystem.

Definition at line 2579 of file cuiksystem.c.

References GetNumDummyVariables(), NVariables(), and TCuikSystem::orig_variables.

Referenced by AnimateWorld().

void GetCSVariable ( unsigned int  n,
Tvariable v,
TCuikSystem cs 
)

Returns a copy of one of the variables of the cuiksystem. This can be seen as a Tvariable copy constructor, thus the output variable does not need to be initialized beforehand.

Parameters
nNumerical identifier of the variable to get.
vPlace where to store the copy of the variable.
csThe cuiksystem to query.
See Also
CopyVariable

Definition at line 2587 of file cuiksystem.c.

References CopyVariable(), GetVariable(), and TCuikSystem::orig_variables.

void SetCSVariableRange ( unsigned int  n,
Tinterval r,
TCuikSystem cs 
)

Returns a copy of the range of one of the variables of the cuiksystem. This can be seen as a Tinterval constructor, thus the output interval does not need to be initialized beforehand.

Parameters
nNumerical identifier of the variable to get.
rPlace where to store the copy of the interval.
csThe cuiksystem to query.
See Also
CopyInterval

Definition at line 2595 of file cuiksystem.c.

References GetVariable(), TCuikSystem::orig_variables, SetVariableInterval(), UnUpdateCuikSystem(), and TCuikSystem::updated.

Referenced by GetSCpSystem(), and SampleCuikSystemInBox().

char* GetCSVariableName ( unsigned int  id,
TCuikSystem cs 
)

Gets the name of a particular variable. The returned pointer should not be manipulated.

Parameters
idThe index of the variable.
csThe CuikSystem to query.
Returns
A pointer to the variable name of NULL if the variable does not exists.

Definition at line 2612 of file cuiksystem.c.

References TCuikSystem::orig_variables, and VariableName().

Referenced by GetLinkPoseSimpVars().

char* GetCSSystemVariableName ( unsigned int  id,
TCuikSystem cs 
)

Gets the name of a particular system variable. The returned pointer should not be manipulated.

Parameters
idThe index of the system variable (over all the system variables).
csThe CuikSystem to query.
Returns
A pointer to the variable name of NULL if the variable does not exists.

Definition at line 2617 of file cuiksystem.c.

References FALSE, IsSecondaryVariable(), IsSystemVariable(), NVariables(), TCuikSystem::orig_variables, TRUE, and VariableName().

Referenced by GetWorldSystemVarName().

boolean IsSystemVarInSimpCS ( Tparameters p,
char *  v,
TCuikSystem cs 
)

Identifies system variables that survive in the simplified system.

Parameters
pThe set of parameters.
vThe variable name.
csThe cuiksystem to query.
Returns
TRUE if the variable exists in the simplified system.

Definition at line 2641 of file cuiksystem.c.

References Error(), GetVariableID(), IsSecondaryVariable(), IsSystemVariable(), NO_UINT, TCuikSystem::simp_variables, and UpdateCuikSystem().

Referenced by GetLinkPoseSimpVars().

unsigned int GetCSSystemVars ( boolean **  sv,
TCuikSystem cs 
)

Creates an array of booleans with the size of the number of variables in the cuiksystem and set to TRUE the entries corresponding to system and secondary variables.

In coherence with the definition of the orig_systemVar field of TCuikSystem, here we identify system and secondary varibles. Internally, though, we differentiate between them (secondary varibles are not used when splitting boxes).

Parameters
svPointer to the pointer of booleans to be allocated and updated.
csThe cuiksystem to query.
Returns
The number of system variables in the cuiksystem.

Definition at line 2659 of file cuiksystem.c.

References IsSecondaryVariable(), IsSystemVariable(), NEW, NVariables(), and TCuikSystem::orig_variables.

Referenced by AdjustBioWorldGeometry(), GenerateWorldEquations(), GetSCpSystem(), GetWorldSystemVars(), IncrementalSampleCuikSystemInBox(), main(), NewtonInWorld(), and SampleCuikSystemInBox().

unsigned int GetCSVarTopology ( unsigned int  vID,
TCuikSystem cs 
)

Determines the topology of a given variable (of the original variable set).

Parameters
vIDIdentifier of the variable (in the original system).
csThe cuiksystem to query.
Returns
The topology of the variable with the given identifier.

Definition at line 2672 of file cuiksystem.c.

References GetVariable(), GetVariableTopology(), and TCuikSystem::orig_variables.

Referenced by GetWorldVarTopology().

void GetCSEquations ( Tequations eqs,
TCuikSystem cs 
)

Returns a copy of the system equations. This is a Tequations copy constructor.

Parameters
eqsPlace where to copy the system variables.
csThe cuiksystem to query.
See Also
CopyEquations

Definition at line 2680 of file cuiksystem.c.

References CopyEquations(), and TCuikSystem::orig_equations.

unsigned int GetCSNumEquations ( TCuikSystem cs)

Returns the number of equations already in the cuiksystem.

Parameters
csThe cuiksystem to query.
Returns
The number of equations already in the cuiksystem.

Definition at line 2709 of file cuiksystem.c.

References NEquations(), and TCuikSystem::orig_equations.

Referenced by GetSCpSystem(), IncrementalSampleCuikSystemInBox(), and SampleCuikSystemInBox().

void GetCSEquation ( unsigned int  n,
Tequation eq,
TCuikSystem cs 
)

Returns a copy of one of the equations of the cuiksystem. This can be seen as a Tequation copy constructor.

Parameters
nNumerical identifier of the equation to get.
eqPlace where to store the copy of the equation.
csThe cuiksystem to query.
See Also
CopyEquation

Definition at line 2688 of file cuiksystem.c.

References CopyEquation(), Error(), GetEquation(), TCuikSystem::orig_equations, and TCuikSystem::scalar.

boolean IsCSPolynomial ( TCuikSystem cs)

Returns TRUE if the cuiksystem is fully polynomial.

We check if the original cuiksystem is polynomial since if this system is polynomial, so are the rest of systems (simplified, simplified+dummified).

Parameters
csThe cuiksystem to query.
Returns
TRUE if the cuiksystem is fully polynomial.

Definition at line 2696 of file cuiksystem.c.

References TCuikSystem::orig_equations, and PolynomialEquations().

Referenced by IsWorldPolynomial().

boolean IsCSScalar ( TCuikSystem cs)

Returns TRUE if the cuiksystem is fully scalar.

Parameters
csThe cuiksystem to query.
Returns
TRUE if the cuiksystem is fully scalar.

Definition at line 2701 of file cuiksystem.c.

References TCuikSystem::scalar.

void GetCSJacobian ( TJacobian J,
TCuikSystem cs 
)

Defines the Jacobian of a CuikSystem considering each equation as a function.

Defines an array with as many rows as equations and as many columns as variables where each entry (i,j) is de derivative of equation i (considered as a function) with repect to variable j.

Parameters
JThe jacobian (output).
csThe cuik system from where to extract the Jacobian.

Definition at line 2714 of file cuiksystem.c.

References InitJacobian(), TCuikSystem::orig_equations, and TCuikSystem::orig_variables.

Referenced by AddJacobianEquations(), GetSCpSystem(), and GetWorldJacobian().

unsigned int GetSimpCSTopology ( Tparameters p,
unsigned int **  t,
TCuikSystem cs 
)

Creates an array with the topology information for the variables in the simplified system.

The topology gives information on the type of range for each variable (either real or spherical). This is relevant when searching for nearest neighbours (in the case of spherical topology pi is close to -pi but not in the case of real topology).

Parameters
pThe set of parameters.
tSpace for the output array.
csThe cuiksystem to query.
Returns
The number of entries in the output array (i.e., the number of variables in the simplified system).

Definition at line 2719 of file cuiksystem.c.

References Error(), GetVariablesTopology(), TCuikSystem::simp_variables, and UpdateCuikSystem().

Referenced by GetWorldSimpTopology().

unsigned int GetCSTopology ( Tparameters p,
unsigned int **  t,
TCuikSystem cs 
)

Creates an array with the topology information for the variables in the system.

The topology gives information on the type of range for each variable (either real or spherical). This is relevant when searching for nearest neighbours (in the case of spherical topology pi is close to -pi but not in the case of real topology).

Parameters
pThe set of parameters.
tSpace for the output array.
csThe cuiksystem to query.
Returns
The number of entries in the output array (i.e., the number of variables in the system).

Definition at line 2728 of file cuiksystem.c.

References GetVariablesTopology(), and TCuikSystem::orig_variables.

Referenced by GetWorldTopology().

void GetSimpCSJacobian ( Tparameters p,
TJacobian J,
TCuikSystem cs 
)

The same as GetCSJacobian but for the simplified system.

Parameters
pThe set of parameters
JThe jacobian (output).
csThe cuik system from where to extract the Jacobian.

Definition at line 2734 of file cuiksystem.c.

References Error(), InitJacobian(), TCuikSystem::simp_equations, TCuikSystem::simp_variables, and UpdateCuikSystem().

Referenced by GetWorldSimpJacobian().

void AddJacobianEquations ( Tparameters p,
boolean selectedVars,
TCuikSystem cs 
)

Adds linear a linear combination of the Jacobian to the system. Generates a new variable for each equation in the system and creates a linear combination of the Jacobian rows using the new variables. Those new variables are normalized to avoid getting redudant solutions. Only the Jacobian columns corresponding to the selectedVars is used.

This functions is used when looking for singularities.

Parameters
pThe set of parameters.
selectedVarsThe variables to take into account. NULL to use all variables.
csThe cuiksystem to modify.

Definition at line 2805 of file cuiksystem.c.

References AddJacobianEquationsInt(), CopyCuikSystem(), DeleteCuikSystem(), DeleteJacobian(), Error(), GetCSJacobian(), GetJacobianSize(), UnUpdateCuikSystem(), and UpdateCuikSystem().

Referenced by main().

void AddSimplifiedJacobianEquations ( Tparameters p,
boolean selectedVars,
TCuikSystem cs 
)

This is the same as AddJacobianEquations but the we use the Jacobian of the simplified system instead of that of the original system.

Note that the selectedVars refer to the original system and they can be missing from the original system. We try to translate variables from original to simple. Origianl variables assigned to constants are unselected and variables assigned to other variables are replaced accordingly.

Parameters
pThe set of parameters.
selectedVarsThe variables to take into account. NULL to use all variables.
csThe cuiksystem to modify.

Definition at line 2835 of file cuiksystem.c.

References AddJacobianEquationsInt(), CopyCuikSystem(), DeleteCuikSystem(), DeleteJacobian(), DeleteLinearConstraint(), Error(), FALSE, GetJacobianEquation(), GetLinearConstraintVariable(), GetNumTermsInLinearConstraint(), GetOriginalVarRelation(), GetVariableNames(), InitJacobian(), NEW, TCuikSystem::orig2s, TCuikSystem::orig_nvariables, TCuikSystem::orig_variables, TCuikSystem::orig_varNames, PrintEquation(), RewriteEquation2Orig(), TCuikSystem::scalar, TCuikSystem::simp_equations, TCuikSystem::simp_nee, TCuikSystem::simp_nvariables, TCuikSystem::simp_variables, TRUE, UnUpdateCuikSystem(), UpdateCuikSystem(), and VariableName().

Referenced by GenerateWorldTWSEquations().

unsigned int MaxReduction ( Tparameters p,
unsigned int  varMask,
double *  r,
Tbox b,
TCuikSystem cs 
)

Reduces a box using the constraints included in the cuiksystem and using the algorithms described in our papers.

Parameters
pA set of parameters.
varMaskThe type of variables to reduce (SYSTEM_VAR, CARTESIAN_VAR, DUMMY_VAR). Different types of variables can be indicated using '|'. A good option is to use ~DUMMY_VAR (this reduces for all variables except for dummy ones).
rThe reduction ration for the box.
bThe box to be reduced.
csThe cuiksystem with the constraints to use to reduce the box.

Definition at line 2955 of file cuiksystem.c.

References DeleteBox(), DUMMY_VAR, EMPTY_BOX, Error(), GetBoxSize(), TCuikSystem::orig2sd, ReduceBox(), TCuikSystem::scalar, SimpleFromOriginal(), TCuikSystem::systemVar, UpdateCuikSystem(), and UpdateOriginalFromSimple().

Referenced by IncrementalSampleCuikSystemInBox(), MaxWorldReduction(), and SampleCuikSystemInBox().

boolean SampleCuikSystem ( Tparameters p,
char *  fname,
Tlist sb,
unsigned int  nsamples,
unsigned int  ntries,
unsigned int  ndof,
TCuikSystem cs 
)

Determine points for which all the equations in the cuiksystem hold. Actually it determines tiny boxes (boxes with size below EPSILON) and the center of the box is taken as the solution point. Since, in general, EPSILON is very small (1e-6) the error of the given solutions is also tiny (order of 1e-12).
The function generates two types of output, the solution boxes (stored in a fname_samples.sol file) and the central point for each solution point (stored in a fname.samples file).
Samples are used in the planning process, to generate roadmap vertexes.
This functions generates samples in the search space defined by the variable ranges. For a function that generate samples in a particular box see SampleCuikSystemInBox.
Note that a sample includes values only for the system variables, that are the ones governing the movement for the mechanisms at hand.
The algorithm implemented for sampling proceed by fixing ndof variables at random and then solving the problem via CuikSolve.

Parameters
pA set of parameters.
fnameBase name for the output files. If NULL, the solutions are not stored in any file.
sbList of boxes where to store the solutions. If NULL, the boxes are not listed.
nsamplesThe number of samples to generate.
ntriesNumber of times we have to try to generate samples (i.e., of fixing some variables at random and solving). Use NO_UINT not to fix any limit.
ndofThe number of degrees of freedom of the mechanism under considerations. If we use NO_UINT, the function tries to determine the number of degrees of freedom from the variables and equations (ndof = Num Variables-Num Equations). However, our systems are typically overconstrained and this simple guess often fails.
csThe cuiksystem from which to drawn samples.
Returns
TRUE if the samples are actually generated before reaching the maximum number of tries.
See Also
CuikPlan SampleCuikSystemInBox

Definition at line 2988 of file cuiksystem.c.

References DeleteBox(), Error(), GenerateInitialBox(), SampleCuikSystemInBox(), and TCuikSystem::scalar.

Referenced by main().

boolean SampleCuikSystemInBox ( Tparameters p,
char *  fname,
Tlist sb,
unsigned int  nsamples,
unsigned int  ntries,
unsigned int  ndof,
Tbox init_box,
TCuikSystem cs 
)

This like function SampleCuikSystem but the samples are generated only in the given box. Morover, this function can store the (tiny) solution boxes in a list of boxes.

Parameters
pA set of parameters.
fnameBase name for the output files. If NULL, the solutions are not stored in any file.
sbList of boxes where to store the solutions. If NULL, the boxes are not listed.
nsamplesThe number of samples to generate.
ntriesNumber of times we have to try to generate samples (i.e., of fixing some variables at random and solving). Use NO_UINT not to fix any limit.
ndofThe number of degrees of freedom of the mechanism under considerations. If we use NO_UINT, the function tries to determine the number of degrees of freedom from the variables and equations (ndof = Num Variables-Num Equations). However, our systems are typically overconstrained and this simple guess often fails.
init_boxBox where to generate samples.
csThe cuiksystem from which to drawn samples.
Returns
TRUE if the samples are actually generated before reaching the maximum number of tries.
See Also
SampleCuikSystem

Definition at line 3007 of file cuiksystem.c.

References AddLastElement(), Advance(), ChangeParameter(), ComputeSplitDim(), CopyBox(), CreateFileName(), CT_EPSILON, CT_N_SOLUTIONS, CT_SMALL_SIGMA, CT_SPLIT_TYPE, DeleteBox(), DeleteFileName(), DeleteListOfBoxes(), DUMMY_VAR, EMPTY_BOX, EndOfList(), Error(), FALSE, First(), GenerateInitialBox(), GetBoxInterval(), GetCSNumEquations(), GetCSNumVariables(), GetCSSystemVars(), GetCurrent(), GetFileFullName(), GetParameter(), GetVariable(), GetVariableTypeN(), InitIterator(), InitListOfBoxes(), IntervalCenter(), LINKS_EXT, MaxReduction(), NEW, NewInterval(), NO_UINT, NVariables(), TCuikSystem::orig_equations, TCuikSystem::orig_variables, PrintBox(), randomInInterval(), TCuikSystem::scalar, SetCSVariableRange(), SetVariableInterval(), SOL_EXT, SolveCuikSystem(), SYSTEM_VAR, TRUE, UnUpdateCuikSystem(), TCuikSystem::updated, and UsedVarInEquations().

Referenced by SampleCuikSystem().

boolean IncrementalSampleCuikSystem ( Tparameters p,
char *  fname,
Tlist sb,
boolean fixVars,
unsigned int  nsamples,
unsigned int  ntries,
unsigned int  ndof,
TCuikSystem cs 
)

This function is very similar to SampleCuikSystem but degrees of freedom are progressively fixed instead of fixed all simultaneously.

Parameters
pA set of parameters.
fnameBase name for the output files. If NULL, the solutions are not stored in any file.
sbList of boxes where to store the solutions. If NULL, the boxes are not listed.
fixVarsBoolean array with the variables that can be fixed. If NULL the system variables are used.
nsamplesThe number of samples to generate.
ntriesNumber of times we have to try to generate samples (i.e., of fixing some variables at random and solving). Use NO_UINT not to fix any limit.
ndofThe number of degrees of freedom of the mechanism under considerations. If we use NO_UINT, the function tries to determine the number of degrees of freedom from the variables and equations (ndof = Num Variables-Num Equations). However, our systems are typically overconstrained and this simple guess often fails.
csThe cuiksystem from which to drawn samples.
Returns
TRUE if the samples are actually generated before reaching the maximum number of tries.

Definition at line 3265 of file cuiksystem.c.

References DeleteBox(), Error(), GenerateInitialBox(), IncrementalSampleCuikSystemInBox(), and TCuikSystem::scalar.

boolean IncrementalSampleCuikSystemInBox ( Tparameters p,
char *  fname,
Tlist sb,
boolean fixVars,
unsigned int  nsamples,
unsigned int  ntries,
unsigned int  ndof,
Tbox init_box,
TCuikSystem cs 
)

This function is very similar to SampleCuikSystemInBox but degrees of freedom are progressively fixed instead of fixed all simultaneously.

Parameters
pA set of parameters.
fnameBase name for the output files. If NULL, the solutions are not stored in any file.
sbList of boxes where to store the solutions. If NULL, the boxes are not listed.
fixVarsBoolean array with the variables that can be fixed. If NULL the system variables are used.
nsamplesThe number of samples to generate.
ntriesNumber of times we have to try to generate samples (i.e., of fixing some variables at random and solving). Use NO_UINT not to fix any limit.
ndofThe number of degrees of freedom of the mechanism under considerations. If we use NO_UINT, the function tries to determine the number of degrees of freedom from the variables and equations (ndof = Num Variables-Num Equations). However, our systems are typically overconstrained and this simple guess often fails.
init_boxBox where to generate samples.
csThe cuiksystem from which to drawn samples.
Returns
TRUE if the samples are actually generated before reaching the maximum number of tries.

Definition at line 3285 of file cuiksystem.c.

References AddLastElement(), Advance(), BoxFromVariables(), ChangeParameter(), CONVERGED_IN_BOX, CONVERGED_IN_GLOBAL, CopyBox(), CreateFileName(), CT_EPSILON, CT_MAX_NEWTON_ITERATIONS, CT_N_SOLUTIONS, CT_SMALL_SIGMA, CuikNewtonInBox(), DeleteBox(), DeleteFileName(), DeleteListOfBoxes(), DUMMY_VAR, EMPTY_BOX, EndOfList(), Error(), ErrorInSolution(), FALSE, First(), GetBoxInterval(), GetBoxSumSide(), GetCSNumEquations(), GetCSNumVariables(), GetCSSystemVars(), GetCurrent(), GetFileFullName(), GetParameter(), InitIterator(), InitListOfBoxes(), IntervalCenter(), IntervalSize(), IsInSimple(), IsSystemVariable(), LINKS_EXT, MaxReduction(), NEW, NewInterval(), NO_UINT, NVariables(), TCuikSystem::orig2sd, TCuikSystem::orig_notDummyVar, TCuikSystem::orig_variables, TCuikSystem::orig_varNames, PrintBox(), PrintBoxSubset(), randomInInterval(), randomMax(), TCuikSystem::scalar, SetBoxInterval(), SOL_EXT, SolveCuikSystem(), TRUE, UnUpdateCuikSystem(), UpdateCuikSystem(), and VariablesFromBox().

Referenced by IncrementalSampleCuikSystem().

unsigned int CuikNewtonSimp ( Tparameters p,
double *  x,
TCuikSystem cs 
)

This is simplified a version of CuikNewtonInBox since

  • It operates in the simplified system.
  • It can not include inequality constraints in the system.
  • It does not takes into account the original box.
  • It does not check the equation error at the end of the iteration (we assume convervenge if the step is small)

This used when defining a RRT: we sample points in ambient space (of the simplified system) and we want to converge to the manifold (if possible).

If you want to understand what is done in CuikNewtonInBox it is better to start by this function.

Todo:
Reduce the duplicity of code between CuikNewtonSimp and CuikNewtonInBox. This is not easy since CuikNewtonInBox includes lots of code to take into account box bondaries and inequalitites and code to convert from boxes in the original system to boxes in the simplified system at the beggining of the function and the revese change at the end of the function.
Parameters
pThe set of parameters.
xThe initial and output point. This is a point in the simplified system.
csThe cuiksystem.
Returns
DIVERGED if we could not reach a solution point or CONVERGED_IN_GLOBAL if a solution point is found.

Definition at line 3618 of file cuiksystem.c.

References ArrayPi2Pi(), CONVERGED_IN_BOX, CONVERGED_IN_GLOBAL, CT_EPSILON, CT_MAX_NEWTON_ITERATIONS, DeleteNewton(), DIVERGED, Error(), ErrorInSimpCSEquations(), EvaluateEqualityEquations(), EvaluateJacobianInVector(), FALSE, GetNewtonMatrixBuffer(), GetNewtonRHBuffer(), GetParameter(), InitNewton(), TCuikSystem::J, NewtonStep(), TCuikSystem::simp_equations, TCuikSystem::simp_nee, TCuikSystem::simp_nequations, TCuikSystem::simp_nvariables, TCuikSystem::simp_tp, TRUE, and UpdateCuikSystem().

Referenced by WorldSimpCuikNewton().

unsigned int CuikNewtonInBox ( Tparameters p,
Tbox bIn,
double *  sol,
Tbox b_sol,
TCuikSystem cs 
)

Find a solution of a cuiksystem set of equations using the Newton-Rhapson method.

The initial point is sampled form the given box.

Parameters
pA set of parameters.
bInThe box from where sample the initial point.
solThe space where to store solution of the cuik system as a point. This must be allocated by the caller.
b_solThe solution as a punctual box. If the Newton diverged this will be a copy of the input box. The space is allocated inside this function.
csThe cuiksystem to solve.
Returns
DIVERGED, CONVERGED_IN_BOX, CONVERGED_IN_GLOBAL, CONVERGED_OUTSIDE_GLOBAL.
See Also
CuikNewton

Definition at line 3714 of file cuiksystem.c.

References ArrayPi2Pi(), CONVERGED_IN_BOX, CONVERGED_IN_GLOBAL, CONVERGED_OUTSIDE_GLOBAL, CopyBox(), CT_EPSILON, CT_MAX_NEWTON_ITERATIONS, DeleteBox(), DeleteNewton(), DIVERGED, Error(), ErrorInInequalities(), EvaluateEqualityEquations(), EvaluateJacobianInVector(), FALSE, GenerateInitialBox(), GetBoxInterval(), GetBoxNIntervals(), GetNewtonMatrixBuffer(), GetNewtonRHBuffer(), GetNumDummyVariables(), GetParameter(), InitBoxFromPoint(), InitNewton(), IntervalCenter(), IntervalSize(), TCuikSystem::J, NEW, NewInterval(), NewtonSetMatrix(), NewtonSetRH(), NewtonStep(), Norm(), TCuikSystem::orig2s, TCuikSystem::orig_notDummyVar, TCuikSystem::orig_nvariables, TCuikSystem::orig_systemVar, TCuikSystem::orig_variables, PointInBox(), randomInInterval(), RegenerateSolution(), SetBoxInterval(), SetBoxSubset(), TCuikSystem::simp_equations, TCuikSystem::simp_nee, TCuikSystem::simp_nequations, TCuikSystem::simp_nvariables, TCuikSystem::simp_tp, SimpleFromOriginal(), UpdateCuikSystem(), and UpdateOriginalFromSimple().

Referenced by CuikNewton(), IncrementalSampleCuikSystemInBox(), main(), and PostProcessBox().

boolean CuikNewton ( Tparameters p,
double *  sol,
Tbox b_sol,
TCuikSystem cs 
)

Find a solution of a cuiksystem set of equations using the Newton-Rhapson method.

This function is only a wrapper of CuikNewtonInBox using the initial box (i.e., the one defined form the variable ranges) to sample the initial point.

Parameters
pA set of parameters.
solSpace where to store the solution as a point. This must be allocated by the caller.
b_solThe solution as a punctual box. If the Newton diverged this will be a copy of the input box. This box is allocated inside the function.
csThe cuiksystem to solve.
Returns
TRUE if the Newton-Raphson process converged to a solution in the initial box.
See Also
CuikNewtonInBox, GenerateInitialBox.

Definition at line 3947 of file cuiksystem.c.

References CONVERGED_IN_BOX, CONVERGED_IN_GLOBAL, CuikNewtonInBox(), DeleteBox(), and GenerateInitialBox().

Referenced by main(), and NewtonInWorld().

unsigned int CuikGradientInBox ( Tparameters p,
Tbox bIn,
double *  sol,
Tbox b_sol,
TCuikSystem cs 
)

Find a solution of a cuiksystem set of equations using the gradient descent method.

The initial point is sampled form the given box.

Parameters
pA set of parameters.
bInThe box from where sample the initial point.
solThe space where to store solution of the cuik system as a point. This must be allocated by the caller.
b_solThe solution as a punctual box. If the Newton diverged this will be a copy of the input box. The space is allocated inside this function.
csThe cuiksystem to solve.
Returns
DIVERGED, CONVERGED_IN_BOX, CONVERGED_IN_GLOBAL, CONVERGED_OUTSIDE_GLOBAL.
See Also
CuikGradient

Definition at line 3961 of file cuiksystem.c.

References ArrayPi2Pi(), CONVERGED_IN_BOX, CONVERGED_IN_GLOBAL, CONVERGED_OUTSIDE_GLOBAL, CopyBox(), Crop2Box(), CT_EPSILON, DeleteBox(), DistanceToInterval(), DIVERGED, Error(), ErrorInInequalities(), EvaluateEqualitySparseEquations(), EvaluateJacobianInVector(), FALSE, GenerateInitialBox(), GetBoxInterval(), GetBoxIntervals(), GetBoxNIntervals(), GetNumDummyVariables(), GetParameter(), InitBoxFromPoint(), IntervalCenter(), TCuikSystem::J, NEW, NewInterval(), NEWZ, Norm(), TCuikSystem::orig2s, TCuikSystem::orig_notDummyVar, TCuikSystem::orig_nvariables, TCuikSystem::orig_systemVar, TCuikSystem::orig_variables, PointInBox(), randomInInterval(), RC2INDEX, RegenerateSolution(), SetBoxInterval(), SetBoxSubset(), TCuikSystem::simp_equations, TCuikSystem::simp_nee, TCuikSystem::simp_nequations, TCuikSystem::simp_nvariables, TCuikSystem::simp_tp, SimpleFromOriginal(), SumVectorScale(), TMatrixVectorProduct(), TRUE, UpdateCuikSystem(), and UpdateOriginalFromSimple().

Referenced by CuikGradient(), and main().

boolean CuikGradient ( Tparameters p,
double *  sol,
Tbox b_sol,
TCuikSystem cs 
)

Find a solution of a cuiksystem set of equations using gradient descent method.

This function is only a wrapper of CuikGradientInBox using the initial box (i.e., the one defined form the variable ranges) to sample the initial point.

Parameters
pA set of parameters.
solSpace where to store the solution as a point. This must be allocated by the caller.
b_solThe solution as a punctual box. If the Newton diverged this will be a copy of the input box. This box is allocated inside the function.
csThe cuiksystem to solve.
Returns
TRUE if the gradient descent process converged to a solution in the initial box.
See Also
CuikGradientInBox, GenerateInitialBox.

Definition at line 4171 of file cuiksystem.c.

References CONVERGED_IN_BOX, CONVERGED_IN_GLOBAL, CuikGradientInBox(), DeleteBox(), and GenerateInitialBox().

Referenced by main().

void SolveCuikSystem ( Tparameters p,
boolean  restart,
char *  fstate,
Tbox searchSpace,
FILE *  f_out,
Tlist sol,
TCuikSystem cs 
)

This is the entry function for the Cuik solver. It takes as input a cuiksystem and returns a set of boxes bounding the solution set. If the solutions are isolated (zero-dimensional) the output is a set of isolated boxes. If the solution is continuous the output is a set of boxes bounding the solution space. Be aware that isolating solution sets with high dimensionality can be expensive. To this end it is recommended to use the parallel version of cuik

Parameters
pA set of parameters.
restartTRUE is the process has be re-started from a previous execution that was, for some reason, crashed.
fstateName of the file from which to read the state (if restart is TRUE) and where to save the state from time to time (concretely every STATE_PERIOD boxes).
searchSpaceBox defining the search space where to look for the solutions. If null, the global search space is used (the one defined from the user-given variable ranges).
f_outFile where to store the solution boxes and the related information such as the parameters, the compilation flags and the statistics of the solving process (time, number of processed boxes,...). If NULL the boxes are not stored in the file (in this case sols must not be NULL).
solList of boxes where to store the solutions. If NULL, the boxes are not listed.
csThe cuiksystem to solve.
See Also
MPI_SolveCuikSystem

Definition at line 4192 of file cuiksystem.c.

References AddBox2HeapOfBoxes(), AddList2Heap(), BoxFromVariables(), BREADTH_FIRST_SEARCH, CmpBoxBreadthFirst(), CmpBoxDepthFirst(), CmpBoxesEquation(), CT_N_SOLUTIONS, CT_STATE_PERIOD, DeleteBox(), DeleteHeap(), DeleteListOfBoxes(), DEPTH_FIRST_SEARCH, DUMMY_VAR, Error(), EvaluateEqMin(), ExtractMinElement(), FALSE, GetBoxLevel(), GetBoxSize(), GetBoxVolume(), GetNSolutionBoxes(), GetParameter(), Heap2List(), HeapEmpty(), HeapOfBoxesVolume(), InitBox(), InitHeapOfBoxes(), InitStatistics(), LoadCSState(), MINIMIZATION_SEARCH, NewBoxProcessed(), NewMaxLevel(), TCuikSystem::orig2sd, PostProcessBox(), PrintBox(), PrintStatistics(), ReduceBox(), REDUCED_BOX_WITH_SOLUTION, SaveCSState(), TCuikSystem::scalar, TCuikSystem::searchMode, TCuikSystem::simp_empty, TCuikSystem::simp_nvariables, SimpleFromOriginal(), TCuikSystem::st, TCuikSystem::systemVar, UpdateCuikSystem(), and TCuikSystem::variables.

Referenced by DealWithCP(), IncrementalSampleCuikSystemInBox(), main(), and SampleCuikSystemInBox().

void MPI_SolveCuikSystem ( Tparameters p,
boolean  restart,
char *  fstate,
Tbox searchSpace,
FILE *  f_out,
TCuikSystem cs 
)

This is the parallel version of SolveCuikSystem. Actually this function is the main scheduler, i.e., the one in charge of managing the boxes to be processes to send them to the child processors. to collec the result, and to deal with them accordingly (bisect, consider solutions, discard if they are empty,...).
The main difference with SolveCuikSystem is that solutions are not included in any list but only stored in a file.

Parameters
pA set of parameters.
restartTRUE is the process has be re-started from a previous execution that was, for some reason, crashed.
fstateName of the file from which to read the state (if restart is TRUE) and where to save the state from time to time (concretely every STATE_PERIOD boxes).
searchSpaceBox defining the search space where to look for the solutions. If null, the global search space is used (the one defined from the user-given variable ranges).
f_outFile where to store the solution boxes and the related information such as the parameters, the compilation flags and the statistics of the solving process (time, number of processed boxes,...).
csThe cuiksystem to solve.
See Also
SolveCuikSystem

Definition at line 4369 of file cuiksystem.c.

References AddBox2HeapOfBoxes(), AddFirstElement(), AddList2Heap(), AddNBoxReductions(), Box2Buffer(), BoxFromVariables(), BREADTH_FIRST_SEARCH, Buffer2Box(), CmpBoxBreadthFirst(), CmpBoxDepthFirst(), CmpBoxesEquation(), CT_N_SOLUTIONS, CT_STATE_PERIOD, DeleteBox(), DeleteHeap(), DeleteListOfBoxes(), DeleteStatistics(), DEPTH_FIRST_SEARCH, Error(), ERROR_IN_PROCESS, ExtractMinElement(), FALSE, GetBoxBufferSize(), GetBoxLevel(), GetBoxSize(), GetBoxVolume(), GetNSolutionBoxes(), GetParameter(), Heap2List(), HeapEmpty(), HeapOfBoxesVolume(), HeapSize(), InitBox(), InitHeapOfBoxes(), InitStatistics(), LoadCSState(), MINIMIZATION_SEARCH, MPI_TREAT_BOX_TIMEOUT, NEW, NewBoxProcessed(), NewLostBox(), NewMaxLevel(), TCuikSystem::nvariables, TCuikSystem::orig2sd, PostProcessBox(), PrintBox(), PrintStatistics(), REDUCED_BOX, SaveCSState(), TCuikSystem::scalar, TCuikSystem::searchMode, SimpleFromOriginal(), TCuikSystem::st, TCuikSystem::systemVar, TRUE, UpdateCuikSystem(), and TCuikSystem::variables.

Referenced by main().

void MPI_TreatBox ( Tparameters p,
TCuikSystem cs 
)

This is the function executed by the child processors when solving a problem in a multi-processor environment.

Parameters
pA set of parameters.
csThe cuiksystem to solve.
See Also
MPI_SolveCuikSystem

Definition at line 4756 of file cuiksystem.c.

References Box2Buffer(), Buffer2Box(), DeleteBox(), DUMMY_VAR, Error(), FALSE, GetBoxBufferSize(), GetNBoxReductions(), InitBox(), NEW, TCuikSystem::nvariables, PrintBox(), ReduceBox(), ResetNBoxReductions(), TCuikSystem::scalar, TCuikSystem::st, TRUE, and UpdateCuikSystem().

Referenced by main().

void GenerateInitialBox ( Tbox box,
TCuikSystem cs 
)

Determines the search space for the solutions of a cuiksystem in the form of a box defined from the variable ranges.
This can be seen as a box constructor.

Parameters
boxThe output box with the variable ranges.
csThe cuiksystem.

Definition at line 4849 of file cuiksystem.c.

References BoxFromVariables(), and TCuikSystem::orig_variables.

Referenced by CuikGradient(), CuikGradientInBox(), CuikNewton(), CuikNewtonInBox(), GetWorldInitialBox(), IncrementalSampleCuikSystem(), SampleCuikSystem(), and SampleCuikSystemInBox().

void GenerateSimpInitialBox ( Tparameters p,
Tbox box,
TCuikSystem cs 
)

The same as GenerateInitialBox but for the simplified system.

Parameters
pThe set of parameters.
boxThe output box with the variable ranges.
csThe cuiksystem.

Definition at line 4854 of file cuiksystem.c.

References BoxFromVariables(), Error(), TCuikSystem::simp_variables, and UpdateCuikSystem().

Referenced by GetWorldSimpInitialBox().

boolean RegenerateSolution ( Tparameters p,
Tbox b,
TCuikSystem cs 
)

Generates values for all variables in the box (including dummies and cartesian ones) from the values of the system variables.

In general, solutions only include system variables and for many operations the cartesian/dummy ones are also needed (for plotting, for refining a solution,...). This functions reverses the removal of the non-system variables in a box.

Observe that the box must be given in the original system and with values only for the system variables. This is different of what happens with RegenerateOriginalBox where the input box has values for all variables in the simplified system.

Parameters
pThe set of parameters.
bThe box to regenerate. It must have the correct dimensionality (i.e., the number of variables in the cuiksystem including the system and dummy ones) but with values only for the system variables. At the end of the call the values for dummy/cartesian variables will be also defined.
csThe cuiksystem.
Returns
TRUE if the regeneration process can be compleated without problems and FALSE if during the reconstruction we realize that the input box is and empty box.

Definition at line 4862 of file cuiksystem.c.

References CARTESIAN_VAR, CropEquation(), CT_EPSILON, CT_RHO, DeleteBox(), DUMMY_VAR, EMPTY_BOX, FALSE, GetParameter(), INF, InitBox(), IsCartesianVariable(), IsCoordEquation(), IsDummyEquation(), IsDummyVariable(), NewInterval(), TCuikSystem::orig_equations, TCuikSystem::orig_nvariables, TCuikSystem::orig_variables, SetBoxInterval(), TRUE, and UpdateCuikSystem().

Referenced by CuikGradientInBox(), CuikNewtonInBox(), and RegenerateSolutionPoint().

unsigned int RegenerateSolutionPoint ( Tparameters p,
double *  pt,
double **  rp,
TCuikSystem cs 
)

Defines a solution point including the dummy and cartesian variables from an array with only values for the system variables.

This function is based on RegenerateSolution.

Parameters
pThe set of parameters.
ptValues for the system variables.
rpReconstructed solution with values for all variables. The space for this array is allocated in this function.
csThe cuiksystem
Returns
The number of entries of the output array rp.

Definition at line 4926 of file cuiksystem.c.

References DeleteBox(), Error(), GetBoxInterval(), InitBoxFromPoint(), IntervalCenter(), NEW, TCuikSystem::orig_nvariables, TCuikSystem::orig_systemVar, RegenerateSolution(), and UpdateCuikSystem().

Referenced by ManifoldDimension().

void RegenerateOriginalBox ( Tparameters p,
Tbox boxS,
Tbox boxO,
TCuikSystem cs 
)

Generates a box in the original cuiksystem from a box of the simplified one.

You can generate a simplified cuiksystem using cuiksimplify and then solve it. To obtain the solution boxes in the un-simplified (or original) system using the cuikunsimplify application that basically relies on this function.

Parameters
pThe set of parameters.
boxSThe input box in the simplified and dummified system.
boxOThe output box in the original system. The box is created insided this function.
csThe cuiksystem to which boxes are supposed to refer to. If this is not so the behavior is undefined.

Definition at line 4967 of file cuiksystem.c.

References BoxFromVariables(), Error(), TCuikSystem::orig2s, TCuikSystem::orig_variables, UpdateCuikSystem(), and UpdateOriginalFromSimple().

Referenced by main().

unsigned int RegenerateOriginalPoint ( Tparameters p,
double *  s,
double **  o,
TCuikSystem cs 
)

Defines a point in the original system from a point in the simplified system.

It is like RegenerateOriginalBox but on points and not on boxes and taking points from the simplified system and not the simplified+dummified.

This is basically used from cuikatlas that operates on the simplified system.

Parameters
pThe set of parameters.
sThe point in the simplified system.
oThe output on in the original system. Space allocated internally.
csThe cuiksystem.
Returns
The size of the output array (number of variables in the original system).

Definition at line 4978 of file cuiksystem.c.

References Error(), TCuikSystem::orig2s, TCuikSystem::orig_nvariables, TCuikSystem::orig_variables, PointFromVariables(), UpdateCuikSystem(), and UpdateOriginalPointFromSimple().

Referenced by GetLinkTransformsFromSolutionPoint(), RegenerateWorldOriginalPoint(), WorldForceField(), and WorldPotentialEnergy().

unsigned int GenerateSimplifiedPoint ( Tparameters p,
double *  o,
double **  s,
TCuikSystem cs 
)

Generates a simplified point from an original one. This is the inverse mapping of RegenerateOriginalPoint.

Parameters
pThe set of parameters.
oThe point in the original system.
sThe output in the simplified system. Space allocated internally.
csThe cuiksystem.
Returns
The size of the output array (number of variables in the simplified system).

Definition at line 4992 of file cuiksystem.c.

References Error(), TCuikSystem::orig2s, TCuikSystem::simp_nvariables, SimplePointFromOriginal(), and UpdateCuikSystem().

Referenced by ManifoldDimension(), WorldForceField(), WorldGenerateSimplifiedPoint(), and WorldGenerateSimplifiedPointFromSystem().

unsigned int SimplifyBooleanArray ( Tparameters p,
boolean bo,
boolean **  bs,
TCuikSystem cs 
)

Transforms an array of booleans that selects a subset of the variables in the original system to a subset of variables in the simplified system. Only the entries for the variables of the original system also used in the simplified system are preserved.

Parameters
pThe set of parameters.
boThe array of booleans in the original system.
bsThe array of boolans in the simplified system. The space for this array is allocated internally and must be deallocated by the caller.
csThe cuiksystem.
Returns
The number of entries in the output array (i.e., the number of variables in the simplified cuiksystem).

Definition at line 5002 of file cuiksystem.c.

References Error(), IsInSimple(), NEW, TCuikSystem::orig2s, TCuikSystem::orig_nvariables, TCuikSystem::simp_nvariables, and UpdateCuikSystem().

Referenced by WorldSimpKinematicVars().

unsigned int ComputeSplitDim ( Tparameters p,
Tbox b,
TCuikSystem cs 
)

Determines the dimension for which it is more advisable to split a box. The criterion to determine the split dimension can be selected through the parameters.

Parameters
pA set of parameters.
bThe box to be split.
csThe cuiksystem.
Returns
The dimension along to which the box is to be bisected.

Definition at line 5036 of file cuiksystem.c.

References ComputeSplitDimInt(), DeleteBox(), Error(), GetVarIDInOriginal(), NO_UINT, TCuikSystem::orig2sd, TCuikSystem::scalar, SimpleFromOriginal(), and UpdateCuikSystem().

Referenced by SampleCuikSystemInBox().

boolean PointInSystemBox ( Tvector v,
Tbox b,
TCuikSystem cs 
)

Determines if a given point is fully included in the system sub-box (i.e., the sub-box fot the system variables). The point is typically one obtained via sampling.

Parameters
vA vector of doubles with one entry for each one of the system variables.
bThe box with the ranges for the variables (including the system ones).
csThe cuiksystem.
Returns
TRUE if the point is fully included in the system sub-box.
See Also
SampleCuikSystemInBox SampleCuikSystem

Definition at line 5060 of file cuiksystem.c.

References Error(), GetBoxInterval(), GetBoxNIntervals(), GetVectorElement(), IsDummyVariable(), IsInside(), NVariables(), TCuikSystem::orig_variables, and TRUE.

void EvaluateCSEquations ( double *  p,
double *  r,
TCuikSystem cs 
)

Evaluates the equation set on a point.

Only equalities are evaluated and thus only space for as many ouputs as equalities is needed in r.

Parameters
pThe evaluation point.
rThe array with the evaluation of each equation. The space for this array should be allocated externally.
csThe cuiksystem to query.

Definition at line 5087 of file cuiksystem.c.

References EvaluateEqualityEquations(), FALSE, and TCuikSystem::orig_equations.

Referenced by WorldEvaluateEquations().

void EvaluateSimpCSEquations ( Tparameters pr,
double *  p,
double *  r,
TCuikSystem cs 
)

The same as EvaluateCSEquations but on the simplified system.

The direct access to the simplified equations is needed to obtain an efficient cuikatlas (and associated utilities). If defined on the original systems they will include too many (trivial) equations and fixed variables.

Note that in this case the input point p must be defined on the simplified space.

Parameters
prThe set of parameters.
pThe evaluation point.
rThe array with the evaluation of each equation. The space for this array should be allocated externally.
csThe cuiksystem to query.

Definition at line 5092 of file cuiksystem.c.

References Error(), EvaluateEqualityEquations(), FALSE, TCuikSystem::simp_equations, and UpdateCuikSystem().

Referenced by WorldEvaluateSimpEquations().

void EvaluateSubSetSimpCSEquations ( Tparameters pr,
boolean se,
double *  p,
double *  r,
TCuikSystem cs 
)

The same as EvaluateSimpCSEquations but on a subset of equations.

This is used to evaluate the independent subset of equations during the atlas construction.

Parameters
prThe set of parameters.
seThe array of booleans selecting the equations to evaluate.
pThe evaluation point.
rThe array with the evaluation of each equation. The space for this array should be allocated externally.
csThe cuiksystem to query.

Definition at line 5100 of file cuiksystem.c.

References Error(), EvaluateSubSetEqualityEquations(), TCuikSystem::simp_equations, and UpdateCuikSystem().

Referenced by WorldEvaluateSubSetSimpEquations().

double ErrorInCSEquations ( double *  p,
TCuikSystem cs 
)

Evaluates the equations on a point and returns the norm of the error. Recall that solution points should have zero error. This is similar to ErrorInSolution but works on points and not on boxes and takes into account all equations and not only system ones.

Parameters
pThe point on which to evaluate the equations (including values for all variables).
csThe cuiksystem with the equations to evaluate.
Returns
The norm of the error for the given point.

Definition at line 5120 of file cuiksystem.c.

References EvaluateEqualityEquations(), FALSE, NEqualityEquations(), NEW, Norm(), and TCuikSystem::orig_equations.

Referenced by main(), and WorldErrorInEquations().

double ErrorInSimpCSEquations ( Tparameters pr,
double *  p,
TCuikSystem cs 
)

The same as ErrorInCSEquations but in the simplified set of equations.

The direct access to the simplified equations is needed to obtain an efficient cuikatlas (and associated utilities). If defined on the original systems they will include too many (trivial) equations and fixed variables.

Note that in this case the input point p must be defined on the simplified space.

Parameters
prThe set of parameters.
pThe point on which to evaluate the equations (including values for all variables in the simplified system).
csThe cuiksystem with the equations to evaluate.
Returns
The norm of the error for the given point.

Definition at line 5140 of file cuiksystem.c.

References Error(), EvaluateEqualityEquations(), FALSE, NEqualityEquations(), NEW, Norm(), TCuikSystem::simp_equations, and UpdateCuikSystem().

Referenced by CuikNewtonSimp(), ManifoldDimension(), and WorldErrorInSimpEquations().

double EvaluateCSCost ( Tparameters p,
boolean  simp,
double *  s,
void *  cs 
)

This interface is provided to use it form T-RRT. The same interface is used for other cost function.

Parameters
pThe set of parameters.
simpTRUE if the solution point is given in the simplified sytem.
sThe solution point
csThe cuiksystem with the equation to evaluate.

Definition at line 5162 of file cuiksystem.c.

References EvaluateWholeEquation().

Referenced by EvaluateWorldCost().

void EvaluateCSJacobian ( double *  p,
double ***  J,
TCuikSystem cs 
)

Returns the matrix resulting from evaluationg the Jacobian of the system in a given point.

The Jacobian is defined on the original cuiksystem (without simplification nor dummyfications).

Parameters
pThe evaluation point.
JThe Jacobian matrix to be defined.
csThe cuiksystem
See Also
GetCSJacobian, DeleteCSJacobian.

Definition at line 5108 of file cuiksystem.c.

References AllocateJacobianEvaluation(), DeleteJacobian(), EvaluateJacobian(), InitJacobian(), TCuikSystem::orig_equations, and TCuikSystem::orig_variables.

Referenced by EvaluateWorldJacobian().

double ErrorInSolution ( Tbox b,
TCuikSystem cs 
)

Computes the error for the solution represented by a box. The error is computed taking the central point of the box and replacing the values in the equation set.

Only system equality equations are taken into account in the error.

Parameters
bThe solution box.
csThe cuiksystem.
Returns
Maximum error for the equations for the central point of the box.

Definition at line 5180 of file cuiksystem.c.

References Error(), EvaluateEqualityEquations(), GetBoxInterval(), GetBoxNIntervals(), IntervalCenter(), NEqualityEquations(), NEW, Norm(), NVariables(), TCuikSystem::orig_equations, TCuikSystem::orig_variables, and TRUE.

Referenced by IncrementalSampleCuikSystemInBox(), main(), and PostProcessBox().

double ErrorInInequalities ( Tbox b,
TCuikSystem cs 
)

Computes the error for the solution represented by a box as far as inequalities is concerned. The error is computed taking the central point of the box and replacing the values in the equation set.

This can be seen as a complement of ErrorInSolution when inequalities are also to be taken into account.

Parameters
bThe solution box.
csThe cuiksystem.
Returns
Maximum error for the inequality equations for the central point of the box.

Definition at line 5219 of file cuiksystem.c.

References Error(), EvaluateInequalityEquations(), GetBoxInterval(), GetBoxNIntervals(), IntervalCenter(), MaxVector(), NEW, NInequalityEquations(), NVariables(), TCuikSystem::orig_equations, TCuikSystem::orig_nvariables, and TCuikSystem::orig_variables.

Referenced by CuikGradientInBox(), and CuikNewtonInBox().

boolean InequalitiesHoldOnPoint ( double *  p,
TCuikSystem cs 
)

Checks if all inqualities hold for a given point. For many processes (i.e., continuation, etc) only the equalities are taken into account. Thus, we need a function to check if the inequalities hold.

Parameters
pThe point.
csThe cuiksystem to check.
Returns
TRUE if all the inequalities hold for the given point.

Definition at line 5248 of file cuiksystem.c.

References EvaluateInequalityEquations(), MaxVector(), NEW, NInequalityEquations(), TCuikSystem::orig_equations, and TRUE.

Referenced by WorldInequalitiesHold().

boolean SimpInequalitiesHoldOnPoint ( Tparameters pr,
double *  p,
TCuikSystem cs 
)

Checks if all inqualities hold for a given point for the simplified system.

Parameters
prthe set of parameters.
pThe point (in the simplified system).
csThe cuiksystem to check.
Returns
TRUE if all the inequalities hold for the given point.
See Also
InequalitiesHoldOnPoint

Definition at line 5268 of file cuiksystem.c.

References Error(), EvaluateInequalityEquations(), MaxVector(), NEW, NInequalityEquations(), TCuikSystem::simp_equations, TRUE, and UpdateCuikSystem().

Referenced by WorldSimpInequalitiesHold().

double ErrorInSimpInequalitiesOnPoint ( Tparameters pr,
double *  p,
TCuikSystem cs 
)

Determines the maximum error in the inequalities in the simplified system.

Parameters
prthe set of parameters.
pThe point (in the simplified system).
csThe cuiksystem to check.
Returns
The error in the inequalities in the simplified system.
See Also
SimpInequalitiesHoldOnPoint

Definition at line 5291 of file cuiksystem.c.

References Error(), EvaluateInequalityEquations(), MaxVector(), NEW, NInequalityEquations(), TCuikSystem::simp_equations, and UpdateCuikSystem().

Referenced by WorldErrorInSimpInequalities().

unsigned int ManifoldDimension ( Tparameters pr,
double *  p,
TCuikSystem cs 
)

Computes the dimension of the solution space assuming that the given point 'p' is a regular point.

Parameters
prThe set of parameters.
pThe regular solution point. Given in the original format (not in the simplified one).
csThe cuiksystem to query.
Returns
The dimension of the solution manifold.

Definition at line 5312 of file cuiksystem.c.

References CT_EPSILON, Error(), ErrorInSimpCSEquations(), EvaluateTransposedJacobianInVector(), FindRank(), GenerateSimplifiedPoint(), GetJacobianSize(), GetParameter(), TCuikSystem::J, NEW, RegenerateSolutionPoint(), TCuikSystem::simp_nequations, and UpdateCuikSystem().

Referenced by WorldManifoldDimension().

void PrintCuikSystem ( Tparameters p,
FILE *  f,
TCuikSystem cs 
)

Writes the cuiksystem in a file that can be stdout.

Parameters
pA set of parameters.
fThe stream where to write the cuiksystem.
csThe cuiksystem.

Definition at line 5359 of file cuiksystem.c.

References GetVariableNames(), MINIMIZATION_SEARCH, NEW, NVariables(), TCuikSystem::orig_eqMin, TCuikSystem::orig_equations, TCuikSystem::orig_variables, PrintEquations(), PrintMonomials(), PrintVariables(), and TCuikSystem::searchMode.

Referenced by AdjustBioWorldGeometry(), main(), and PrintWorldCS().

void PrintCuikSystemWithSimplification ( Tparameters p,
FILE *  f,
TCuikSystem cs 
)

Writes the simplified cuiksystem in a file that can be stdout. If the DEBUG mode is above 1 it first print the original system and then the simplified one (in the same file)

Parameters
pA set of parameters.
fThe stream where to write the simplified cuiksystem.
csThe cuiksystem.
See Also
PrintCuikSystem

Definition at line 5384 of file cuiksystem.c.

References CT_SIMPLIFICATION_LEVEL, TCuikSystem::eqMin, TCuikSystem::equations, GetNumSecondaryVariables(), GetNumSystemVariables(), GetParameter(), GetVariableNames(), MINIMIZATION_SEARCH, NEW, NVariables(), TCuikSystem::orig2sd, TCuikSystem::orig_eqMin, TCuikSystem::orig_equations, TCuikSystem::orig_nvariables, TCuikSystem::orig_variables, PrintEquations(), PrintMapping(), PrintMonomials(), PrintVariables(), TCuikSystem::searchMode, TCuikSystem::simp_nvariables, TCuikSystem::simp_variables, UpdateCuikSystem(), and TCuikSystem::variables.

Referenced by DealWithCP(), and main().

void SaveCuikSystemSimplification ( Tparameters p,
FILE *  f,
TCuikSystem cs 
)

Saves the simplification information associated with a cuiksystem.

Parameters
pA set of parameters.
fThe stream where to write the simplification information.
csThe cuiksystem.

Definition at line 5439 of file cuiksystem.c.

References TCuikSystem::orig2sd, SaveMapping(), and UpdateCuikSystem().