Advanced Utilities


Classes

struct  coco::coconut_random_f
class  coco::wnc_hook_base
 Base class for the work node computation hooks. More...
class  coco::sparsity_visitor
 Preorder visitor which calculates sparsity structures. More...

Defines

#define coconut_random   random
#define coconut_seed(A)   srandom(A)
#define COCONUT_RAND_MAX   RAND_MAX
#define COCONUT_RRAND_MIN   -1.e08
#define COCONUT_RRAND_MAX   +1.e08
#define coconut_init_random()   coconut_seed(INIT_SEED)
#define COCONUT_RRAND_MIN_BETA   0.01
#define COCONUT_RRAND_MIN_ALPHA   0.5
#define COCONUT_RRAND_MAX_ALPHA   0.99

Typedefs

typedef long int coco::rand_t
typedef std::pair< unsigned
int, unsigned int > 
coco::ipair
 Row-column index pair.
typedef std::set< ipair > coco::splist
 Sparsity information.

Functions

double coco::d_random ()
double coco::r_random (double l, double u, double beta=10.0, double alpha=0.9)
double coco::r_random (const interval &_i, double beta=10.0, double alpha=0.9)
interval coco::i_random (double l, double r, double beta=10.0, double alpha=0.9)
interval coco::i_random (const interval &_i, double beta=10.0, double alpha=0.9)
interval coco::i_random ()
void coco::get_leaves_vector (const search_graph &__sgraph, std::vector< si_ri_pair > &v, search_inspector *sfoc=NULL)
 Sparsity calculation (Hessian and Jacobian).
void coco::sparsity (const model &DAG, std::vector< unsigned int > &H_ridx, std::vector< unsigned int > &H_cidx, std::vector< unsigned int > &J_funidx, std::vector< unsigned int > &J_varidx, bool J_with_obj, bool J_obj_is_first, bool org_only, bool H_upper_only, sp_indexing indexing, bool fun_one_based, bool var_one_based)
 Sparsity calculation (Hessian and Jacobian).
void coco::sparsity (const model &DAG, std::vector< unsigned int > &H_ridx, std::vector< unsigned int > &H_cidx, bool org_only, bool H_upper_only, sp_indexing indexing, bool var_one_based)
 Sparsity calculation (Hessian).
void coco::sparsity (const model &DAG, std::vector< unsigned int > &J_funidx, std::vector< unsigned int > &J_varidx, bool J_with_obj, bool J_obj_is_first, bool org_only, sp_indexing indexing, bool fun_one_based, bool var_one_based)
 Sparsity calculation (Jacobian).
void coco::sparsity (const model &DAG, unsigned int &nnz_H, unsigned int *&H_ridx, unsigned int *&H_cidx, unsigned int &nnz_J, unsigned int *&J_funidx, unsigned int *&J_varidx, bool J_with_obj, bool J_obj_is_first, bool org_only, bool H_upper_only, sp_indexing indexing, bool fun_one_based, bool var_one_based)
 Sparsity calculation (Hessian and Jacobian).
void coco::sparsity (const model &DAG, int &nnz_H, int *&H_ridx, int *&H_cidx, int &nnz_J, int *&J_funidx, int *&J_varidx, bool J_with_obj, bool J_obj_is_first, bool org_only, bool H_upper_only, sp_indexing indexing, bool fun_one_based, bool var_one_based)
 Sparsity calculation (Hessian and Jacobian).
void coco::sparsity (const model &DAG, unsigned int &nnz_H, unsigned int *&H_ridx, unsigned int *&H_cidx, bool org_only, bool H_upper_only, sp_indexing indexing, bool var_one_based)
 Sparsity calculation (Hessian).
void coco::sparsity (const model &DAG, int &nnz_H, int *&H_ridx, int *&H_cidx, bool org_only, bool H_upper_only, sp_indexing indexing, bool var_one_based)
 Sparsity calculation (Hessian).
void coco::sparsity (const model &DAG, unsigned int &nnz_J, unsigned int *&J_funidx, unsigned int *&J_varidx, bool J_with_obj, bool J_obj_is_first, bool org_only, sp_indexing indexing, bool fun_one_based, bool var_one_based)
 Sparsity calculation (Jacobian).
void coco::sparsity (const model &DAG, int &nnz_J, int *&J_funidx, int *&J_varidx, bool J_with_obj, bool J_obj_is_first, bool org_only, sp_indexing indexing, bool fun_one_based, bool var_one_based)
 Sparsity calculation (Jacobian).

Detailed Description

The classes, types, and functions in this section provide additional utilities, which can be used to support the solution process.

Define Documentation

 
#define coconut_init_random (  )     coconut_seed(INIT_SEED)

This function initializes the random number generator

Definition at line 85 of file coconut_random.h.

#define COCONUT_RAND_MAX   RAND_MAX

This constant is the maximum number returned by coconut_random.

Definition at line 63 of file coconut_random.h.

#define coconut_random   random

The function coconut_random returns a random integer number between 0 and COCONUT_RAND_MAX.

Definition at line 48 of file coconut_random.h.

#define COCONUT_RRAND_MAX   +1.e08

This constant defines the maximal double number returned by r_random.

Definition at line 74 of file coconut_random.h.

#define COCONUT_RRAND_MAX_ALPHA   0.99

This constant defines the largest allowed value of the parameter alpha in r_random.

Definition at line 120 of file coconut_random.h.

#define COCONUT_RRAND_MIN   -1.e08

This constant defines the minimal double number returned by r_random.

Definition at line 69 of file coconut_random.h.

#define COCONUT_RRAND_MIN_ALPHA   0.5

This constant defines the smallest allowed value of the parameter alpha in r_random.

Definition at line 115 of file coconut_random.h.

#define COCONUT_RRAND_MIN_BETA   0.01

This constant defines the smallest allowed value of the parameter beta in r_random.

Definition at line 110 of file coconut_random.h.

#define coconut_seed (  )     srandom(A)

The function coconut_seed sets its unsigned int argument as the seed for a new sequence of pseudo-random numbers returned by coconut_random.

Definition at line 58 of file coconut_random.h.


Typedef Documentation

typedef std::pair<unsigned int, unsigned int> coco::ipair

This type holds a row-column index pair for a sparse matrix.

Definition at line 48 of file sparsity.cc.

typedef long int coco::rand_t

This is the type returned by the coconut_random function.

Definition at line 90 of file coconut_random.h.

typedef std::set<ipair> coco::splist

This type holds a list of row-column index pairs for a sparse matrix, the matrix' sparsity structure.

Definition at line 54 of file sparsity.cc.


Function Documentation

double coco::d_random (  )  [inline]

The function d_random returns a random double number in [0,1[.

Definition at line 95 of file coconut_random.h.

void coco::get_leaves_vector ( const search_graph &  __sgraph,
std::vector< si_ri_pair > &  v,
search_inspector *  sfoc 
)

Definition at line 42 of file search_graph_funcs.cc.

interval coco::i_random (  )  [inline]

The function i_random returns a random interval subset of [0,1].

Definition at line 240 of file coconut_random.h.

interval coco::i_random ( const interval &  _i,
double  beta = 10.0,
double  alpha = 0.9 
) [inline]

The function i_random returns a random interval subset of _i. The role of the parameters beta and alpha is the same as in the workhorse function r_random(double,double,double,double).

Definition at line 231 of file coconut_random.h.

interval coco::i_random ( double  l,
double  r,
double  beta = 10.0,
double  alpha = 0.9 
) [inline]

The function i_random returns a random interval subset of [l,r]. The role of the parameters beta and alpha is the same as in the workhorse function r_random(double,double,double,double).

Definition at line 219 of file coconut_random.h.

double coco::r_random ( const interval &  _i,
double  beta = 10.0,
double  alpha = 0.9 
) [inline]

The function r_random returns a random double number in the interval _i. Actually, there are never numbers generated, which are outside the interval [COCONUT_RRAND_MIN,COCONUT_RRAND_MAX]. The role of the parameters beta and alpha is the same as in the workhorse function r_random(double,double,double,double).

Definition at line 208 of file coconut_random.h.

double coco::r_random ( double  l,
double  u,
double  beta = 10.0,
double  alpha = 0.9 
) [inline]

The function r_random returns a random double number in the interval {[l,r]}. Actually, there are never numbers generated, which are outside the interval [COCONUT_RRAND_MIN,COCONUT_RRAND_MAX]. The numbers are generated along the graph of the function h(t) = (-alpha*beta + t) / ((1/alpha-2)*beta + t), if t > beta, = alpha*t/beta, if t [-beta,beta], = (alpha*beta + t) / ((1/alpha-2)*beta - t), if t < -beta, where alpha is a positive parameter close to, but smaller than 1 (COCONUT_RRAND_MIN_ALPHA <= alpha <= COCONUT_RRAND_MAX_ALPHA < 1), and beta is a positive parameter (beta >= COCONUT_RRAND_MIN_BETA > 0). h is a smooth probability distribution function in [0,inf], and behaves similarly in [-inf,0] because of h(-t)=-h(t). The parameter beta specifies that in the interval [-beta,beta] the point is chosen from uniform distribution. Outside this interval, h(t)->1 from below when t->inf, and h(t)->-1 from above when t->-inf. The parameter alpha specifies how fast |h(t)|-1 decays while |t|->inf. Also, since h(beta) = alpha, alpha specifies that if a random point is generated in [-inf,inf] (or [0,inf] or [-inf,0], resp.), then it falls in [-beta,beta] with probability alpha .

Definition at line 168 of file coconut_random.h.

void coco::sparsity ( const model &  DAG,
int &  nnz_H,
int *&  H_ridx,
int *&  H_cidx,
bool  org_only,
bool  H_upper_only,
sp_indexing  indexing,
bool  var_one_based 
)

This function computes the sparsity structure of the Hessian of the Lagrangean. Its parameters are:

  • DAG: The expression DAG (input),
  • nnz_H: The number of nonzero entries in the Hessian (output),
  • H_ridx: The row index vector of the Hessian of the Lagrangean (output, the array is allocated using new by the function),
  • H_cidx: The column index vector of the Hessianof the Lagrangean (output, the array is allocated using new by the function),
  • org_only: This bool determines whether constraints and variables from the (symbolic!) KJ-conditions are left out (input),
  • H_upper_only: This bool specifies whether of the (symmetric!) Hessian only the row-column pairs above the diagonal shall be given (input),
  • indexing: This enum specifies the requested indexing structure (input),
  • var_one_based: This boolean determines whether all indices depending on variables start with 1 or with 0 (input).

Definition at line 727 of file sparsity.cc.

void coco::sparsity ( const model &  DAG,
int &  nnz_J,
int *&  J_funidx,
int *&  J_varidx,
bool  J_with_obj,
bool  J_obj_is_first,
bool  org_only,
sp_indexing  indexing,
bool  fun_one_based,
bool  var_one_based 
)

This function computes the sparsity structures of the Jacobian of the constraints. Its parameters are:

  • DAG: The expression DAG (input),
  • nnz_J: The number of nonzero entries in the Jacobian (output),
  • J_funidx: The function index vector of the Jacobian of the constraints (output, the array is allocated using new by the function),
  • J_varidx: The variable index vector of the Jacobian of the constraints (output, the array is allocated using new by the function),
  • J_with_obj: This bool determines whether the objective function is included in the Jacobian (input),
  • J_obj_is_first: This bool determines whether the objective function is has the first function index (rather than the last) (input),
  • org_only: This bool determines whether constraints and variables from the (symbolic!) KJ-conditions are left out (input),
  • indexing: This enum specifies the requested indexing structure (input),
  • fun_one_based: This boolean determines whether the function index in the Jacobian starts with 1 or with 0 (input),
  • var_one_based: This boolean determines whether all indices depending on variables start with 1 or with 0 (input).

Definition at line 760 of file sparsity.cc.

void coco::sparsity ( const model &  DAG,
int &  nnz_H,
int *&  H_ridx,
int *&  H_cidx,
int &  nnz_J,
int *&  J_funidx,
int *&  J_varidx,
bool  J_with_obj,
bool  J_obj_is_first,
bool  org_only,
bool  H_upper_only,
sp_indexing  indexing,
bool  fun_one_based,
bool  var_one_based 
)

This function computes the sparsity structures of the Hessian of the Lagrangean and the Jacobian of the constraints. Its parameters are:

  • DAG: The expression DAG (input),
  • nnz_H: The number of nonzero entries in the Hessian (output),
  • H_ridx: The row index vector of the Hessian of the Lagrangean (output, the array is allocated using new by the function),
  • H_cidx: The column index vector of the Hessianof the Lagrangean (output, the array is allocated using new by the function),
  • nnz_J: The number of nonzero entries in the Jacobian (output),
  • J_funidx: The function index vector of the Jacobian of the constraints (output, the array is allocated using new by the function),
  • J_varidx: The variable index vector of the Jacobian of the constraints (output, the array is allocated using new by the function),
  • J_with_obj: This bool determines whether the objective function is included in the Jacobian (input),
  • J_obj_is_first: This bool determines whether the objective function is has the first function index (rather than the last) (input),
  • org_only: This bool determines whether constraints and variables from the (symbolic!) KJ-conditions are left out (input),
  • H_upper_only: This bool specifies whether of the (symmetric!) Hessian only the row-column pairs above the diagonal shall be given (input),
  • indexing: This enum specifies the requested indexing structure (input),
  • fun_one_based: This boolean determines whether the function index in the Jacobian starts with 1 or with 0 (input),
  • var_one_based: This boolean determines whether all indices depending on variables start with 1 or with 0 (input).

Definition at line 692 of file sparsity.cc.

void coco::sparsity ( const model &  DAG,
unsigned int &  nnz_J,
unsigned int *&  J_funidx,
unsigned int *&  J_varidx,
bool  J_with_obj,
bool  J_obj_is_first,
bool  org_only,
sp_indexing  indexing,
bool  fun_one_based,
bool  var_one_based 
)

This function computes the sparsity structures of the Jacobian of the constraints. Its parameters are:

  • DAG: The expression DAG (input),
  • nnz_J: The number of nonzero entries in the Jacobian (output),
  • J_funidx: The function index vector of the Jacobian of the constraints (output, the array is allocated using new by the function),
  • J_varidx: The variable index vector of the Jacobian of the constraints (output, the array is allocated using new by the function),
  • J_with_obj: This bool determines whether the objective function is included in the Jacobian (input),
  • J_obj_is_first: This bool determines whether the objective function is has the first function index (rather than the last) (input),
  • org_only: This bool determines whether constraints and variables from the (symbolic!) KJ-conditions are left out (input),
  • indexing: This enum specifies the requested indexing structure (input),
  • fun_one_based: This boolean determines whether the function index in the Jacobian starts with 1 or with 0 (input),
  • var_one_based: This boolean determines whether all indices depending on variables start with 1 or with 0 (input).

Definition at line 736 of file sparsity.cc.

void coco::sparsity ( const model &  DAG,
unsigned int &  nnz_H,
unsigned int *&  H_ridx,
unsigned int *&  H_cidx,
bool  org_only,
bool  H_upper_only,
sp_indexing  indexing,
bool  var_one_based 
)

This function computes the sparsity structure of the Hessian of the Lagrangean. Its parameters are:

  • DAG: The expression DAG (input),
  • nnz_H: The number of nonzero entries in the Hessian (output),
  • H_ridx: The row index vector of the Hessian of the Lagrangean (output, the array is allocated using new by the function),
  • H_cidx: The column index vector of the Hessianof the Lagrangean (output, the array is allocated using new by the function),
  • org_only: This bool determines whether constraints and variables from the (symbolic!) KJ-conditions are left out (input),
  • H_upper_only: This bool specifies whether of the (symmetric!) Hessian only the row-column pairs above the diagonal shall be given (input),
  • indexing: This enum specifies the requested indexing structure (input),
  • var_one_based: This boolean determines whether all indices depending on variables start with 1 or with 0 (input).

void coco::sparsity ( const model &  DAG,
unsigned int &  nnz_H,
unsigned int *&  H_ridx,
unsigned int *&  H_cidx,
unsigned int &  nnz_J,
unsigned int *&  J_funidx,
unsigned int *&  J_varidx,
bool  J_with_obj,
bool  J_obj_is_first,
bool  org_only,
bool  H_upper_only,
sp_indexing  indexing,
bool  fun_one_based,
bool  var_one_based 
)

This function computes the sparsity structures of the Hessian of the Lagrangean and the Jacobian of the constraints. Its parameters are:

  • DAG: The expression DAG (input),
  • nnz_H: The number of nonzero entries in the Hessian (output),
  • H_ridx: The row index vector of the Hessian of the Lagrangean (output, the array is allocated using new by the function),
  • H_cidx: The column index vector of the Hessianof the Lagrangean (output, the array is allocated using new by the function),
  • nnz_J: The number of nonzero entries in the Jacobian (output),
  • J_funidx: The function index vector of the Jacobian of the constraints (output, the array is allocated using new by the function),
  • J_varidx: The variable index vector of the Jacobian of the constraints (output, the array is allocated using new by the function),
  • J_with_obj: This bool determines whether the objective function is included in the Jacobian (input),
  • J_obj_is_first: This bool determines whether the objective function is has the first function index (rather than the last) (input),
  • org_only: This bool determines whether constraints and variables from the (symbolic!) KJ-conditions are left out (input),
  • H_upper_only: This bool specifies whether of the (symmetric!) Hessian only the row-column pairs above the diagonal shall be given (input),
  • indexing: This enum specifies the requested indexing structure (input),
  • fun_one_based: This boolean determines whether the function index in the Jacobian starts with 1 or with 0 (input),
  • var_one_based: This boolean determines whether all indices depending on variables start with 1 or with 0 (input).

Definition at line 660 of file sparsity.cc.

void coco::sparsity ( const model &  DAG,
std::vector< unsigned int > &  J_funidx,
std::vector< unsigned int > &  J_varidx,
bool  J_with_obj,
bool  J_obj_is_first,
bool  org_only,
sp_indexing  indexing,
bool  fun_one_based,
bool  var_one_based 
)

This function computes the sparsity structure of the Jacobian of the constraints. Its parameters are:

  • DAG: The expression DAG (input),
  • J_funidx: The function index vector of the Jacobian of the constraints (output),
  • J_varidx: The variable index vector of the Jacobian of the constraints (output),
  • J_with_obj: This bool determines whether the objective function is included in the Jacobian (input),
  • J_obj_is_first: This bool determines whether the objective function is has the first function index (rather than the last) (input),
  • org_only: This bool determines whether constraints and variables from the (symbolic!) KJ-conditions are left out (input),
  • indexing: This enum specifies the requested indexing structure (input),
  • fun_one_based: This boolean determines whether the function index in the Jacobian starts with 1 or with 0 (input),
  • var_one_based: This boolean determines whether all indices depending on variables start with 1 or with 0 (input).

Definition at line 649 of file sparsity.cc.

void coco::sparsity ( const model &  DAG,
std::vector< unsigned int > &  H_ridx,
std::vector< unsigned int > &  H_cidx,
bool  org_only,
bool  H_upper_only,
sp_indexing  indexing,
bool  var_one_based 
)

This function computes the sparsity structure of the Hessian of the Lagrangean. Its parameters are:

  • DAG: The expression DAG (input),
  • H_ridx: The row index vector of the Hessian of the Lagrangean (output),
  • H_cidx: The column index vector of the Hessianof the Lagrangean (output),
  • org_only: This bool determines whether constraints and variables from the (symbolic!) KJ-conditions are left out (input),
  • H_upper_only: This bool specifies whether of the (symmetric!) Hessian only the row-column pairs above the diagonal shall be given (input),
  • indexing: This enum specifies the requested indexing structure (input),
  • var_one_based: This boolean determines whether all indices depending on variables start with 1 or with 0 (input).

Definition at line 639 of file sparsity.cc.

void coco::sparsity ( const model &  DAG,
std::vector< unsigned int > &  H_ridx,
std::vector< unsigned int > &  H_cidx,
std::vector< unsigned int > &  J_funidx,
std::vector< unsigned int > &  J_varidx,
bool  J_with_obj,
bool  J_obj_is_first,
bool  org_only,
bool  H_upper_only,
sp_indexing  indexing,
bool  fun_one_based,
bool  var_one_based 
)

This function computes the sparsity structures of the Hessian of the Lagrangean and the Jacobian of the constraints. Its parameters are:

  • DAG: The expression DAG (input),
  • H_ridx: The row index vector of the Hessian of the Lagrangean (output),
  • H_cidx: The column index vector of the Hessianof the Lagrangean (output),
  • J_funidx: The function index vector of the Jacobian of the constraints (output),
  • J_varidx: The variable index vector of the Jacobian of the constraints (output),
  • J_with_obj: This bool determines whether the objective function is included in the Jacobian (input),
  • J_obj_is_first: This bool determines whether the objective function is has the first function index (rather than the last) (input),
  • org_only: This bool determines whether constraints and variables from the (symbolic!) KJ-conditions are left out (input),
  • H_upper_only: This bool specifies whether of the (symmetric!) Hessian only the row-column pairs above the diagonal shall be given (input),
  • indexing: This enum specifies the requested indexing structure (input),
  • fun_one_based: This boolean determines whether the function index in the Jacobian starts with 1 or with 0 (input),
  • var_one_based: This boolean determines whether all indices depending on variables start with 1 or with 0 (input).

Definition at line 626 of file sparsity.cc.


Generated on Tue Feb 9 14:47:16 2010 for COCONUT API by  doxygen 1.5.8