c_linear.c File Reference

Implements the linear constraints for the suite of constrained problems. More...

#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include "coco.h"
#include "coco_internal.h"

Data Structures

struct  linear_constraint_data_t
 Data type for the linear constraints. More...
 

Functions

static void c_sum_variables_evaluate (coco_problem_t *self, const double *x, double *y)
 Evaluates the linear constraint with all-ones gradient at the point 'x' and stores the result into 'y'. More...
 
static void c_linear_single_evaluate (coco_problem_t *self, const double *x, double *y)
 Evaluates the linear constraint at the point 'x' and stores the result in 'y'. More...
 
static coco_problem_tc_guarantee_feasible_point (coco_problem_t *problem, const double *feasible_direction)
 Guarantees that "feasible_direction" is feasible w.r.t. the constraint in "problem" and records it as the initial feasible solution to this coco_problem. More...
 
static void c_linear_gradient_free (void *thing)
 Frees the data object. More...
 
static coco_problem_tc_sum_variables_allocate (const size_t number_of_variables)
 Allocates a linear constraint coco_problem_t with all-ones gradient. More...
 
static coco_problem_tc_linear_transform (coco_problem_t *inner_problem, const double *gradient)
 Transforms a linear constraint with all-ones gradient into a linear constraint whose gradient is passed as argument. More...
 
static coco_problem_tc_linear_single_cons_bbob_problem_allocate (const size_t function, const size_t dimension, const size_t instance, const size_t constraint_number, const double factor1, const char *problem_id_template, const char *problem_name_template, double *gradient, const double *feasible_direction)
 Builds a coco_problem_t containing one single linear constraint. More...
 
static coco_problem_tc_linear_cons_bbob_problem_allocate (const size_t function, const size_t dimension, const size_t instance, const size_t number_of_linear_constraints, const char *problem_id_template, const char *problem_name_template, const double *feasible_direction)
 Builds a coco_problem_t containing all the linear constraints by stacking them all. More...
 

Detailed Description

Implements the linear constraints for the suite of constrained problems.

Function Documentation

static coco_problem_t * c_guarantee_feasible_point ( coco_problem_t problem,
const double *  feasible_point 
)
static

Guarantees that "feasible_direction" is feasible w.r.t. the constraint in "problem" and records it as the initial feasible solution to this coco_problem.

static coco_problem_t * c_linear_cons_bbob_problem_allocate ( const size_t  function,
const size_t  dimension,
const size_t  instance,
const size_t  number_of_linear_constraints,
const char *  problem_id_template,
const char *  problem_name_template,
const double *  feasible_direction 
)
static

Builds a coco_problem_t containing all the linear constraints by stacking them all.

The constraints' gradients are randomly generated with distribution 10**U[0,1] * N_i(0, I) * 10**U_i[0,2], where U[a, b] is uniform in [a,b] and only U_i is drawn for each constraint individually. The exception is the first constraint, whose gradient is given by 10**U[0,1] * (-feasible_direction) * 10**U_i[0,2].

Each constraint is built by calling the function c_linear_single_cons_bbob_problem_allocate(), which returns a coco_problem_t object that defines the constraint. The resulting coco_problem_t objects are then stacked together into one single coco_problem_t object that is returned by the function.

static void c_linear_gradient_free ( void *  thing)
static

Frees the data object.

static coco_problem_t * c_linear_single_cons_bbob_problem_allocate ( const size_t  function,
const size_t  dimension,
const size_t  instance,
const size_t  constraint_number,
const double  factor1,
const char *  problem_id_template,
const char *  problem_name_template,
double *  gradient,
const double *  feasible_direction 
)
static

Builds a coco_problem_t containing one single linear constraint.

This function is called by c_linear_cons_bbob_problem_allocate(), the central function that stacks all the constraints built by c_linear_single_cons_bbob_problem_allocate() into one single coco_problem_t object.

static void c_linear_single_evaluate ( coco_problem_t self,
const double *  x,
double *  y 
)
static

Evaluates the linear constraint at the point 'x' and stores the result in 'y'.

static coco_problem_t * c_linear_transform ( coco_problem_t inner_problem,
const double *  gradient 
)
static

Transforms a linear constraint with all-ones gradient into a linear constraint whose gradient is passed as argument.

static coco_problem_t * c_sum_variables_allocate ( const size_t  number_of_variables)
static

Allocates a linear constraint coco_problem_t with all-ones gradient.

static void c_sum_variables_evaluate ( coco_problem_t self,
const double *  x,
double *  y 
)
static

Evaluates the linear constraint with all-ones gradient at the point 'x' and stores the result into 'y'.