cuikgradient.c File Reference

Detailed Description

dot_inline_dotgraph_47.png

Find a solution of a cuiksystem set of equations using a gradient descent method. It is based on an iterative process starting from a random point sampled in the initial box.
We have a system of equations of the form:

  • f_1(x_1....x_m)=0
  • ...
  • f_n(x_1....x_m)=0

The gradient descent method minimizes an error function defined as

  • E(x_1....x_m)=f_1(x_1....x_m)^2+....f_n(x_1....x_m)^2

Observe that the gradient of this function is

  • dif E / dif x_i = 2*f_1(x_1....x_m)*dif f_1/dif x_i + ... + 2*f_n(x_1....x_m)*dif f_n/dif x_i

Which can be expressed as

  • J_f^t * (f_1....f_n)

Where J_f^t is the transposed of the Jacobian of the initial system and (f_1....f_n) is the evaluation of this system.
Inequalities and domain boundaries are not (yet) taken into account.
The method can converge to a local minima or to a point out of the domain boundaries.

See Also
cuikgradientworld.c cuikplan.c

Definition in file cuikgradient.c.

Functions

int main (int argc, char **arg)
 Main body of the cuikgradient application. More...
 

Function Documentation

int main ( int  argc,
char **  arg 
)

Main body of the cuikgradient application.

Use:

  • cuikgradient num_samples problem_name.cuik

where

  • problem_name contains the kinematic equations.
  • num_samples is the number of times we want to apply the gradient descent process.

In this case we sample points at random in the initial box and try to converge to the manifold. If the gradient process succeeds, we print the solution point, a tiny box around it, and the error in the solution point.

The program can also be used as:

  • cuikgradient problem_name.cuik

where

  • problem_name contains the kinematic equations.

In this case we search for a solution file and we try to converge to a point for each one of the boxes in the solution file. If the solution file does not exists an error is triggered.

In any cases .cuik extension is optional.

Parameters
argcNumber of elements in the command line that starts the application (i.e., the cuikgradient command itself and its arguments).
argStrings with the arguments.
Returns
EXIT_SUCCESS (0) if the execution worked out fine and EXIT_FAILURE if not.

Definition at line 95 of file cuikgradient.c.

References CONVERGED_IN_BOX, CONVERGED_IN_GLOBAL, CONVERGED_OUTSIDE_GLOBAL, CreateFileName(), CT_REPRESENTATION, CUIK_EXT, CuikGradient(), CuikGradientInBox(), DeleteBox(), DeleteCuikSystem(), DeleteFileName(), DeleteParameters(), DIVERGED, Error(), ErrorInCSEquations(), ErrorInSolution(), GetCSSystemVars(), GetFileFullName(), GetParameter(), InitCuikSystemFromFile(), InitParametersFromFile(), JOINTS_EXT, LINKS_EXT, NEW, PARAM_EXT, PrintBoxSubset(), randomSet(), ReadBox(), REP_JOINTS, and SOL_EXT.