code-experiments/src/transform_vars_asymmetric.c
/**
 * @brief Evaluates the transformed function.
 */
@brief Evaluates the transformed function.
@brief Evaluates the transformed function .
static void transform_vars_asymmetric_evaluate_function(coco_problem_t *problem, 
                                                        const double *x, 
                                                        double *y) {
  size_t i;
  double exponent, *cons_values;
  int is_feasible;
  transform_vars_asymmetric_data_t *data;
  coco_problem_t *inner_problem;
  if (coco_vector_contains_nan(x, coco_problem_get_dimension(problem))) {
  	coco_vector_set_to_nan(y, coco_problem_get_number_of_objectives(problem));
  	return;
  }
  data = (transform_vars_asymmetric_data_t *) coco_problem_transformed_get_data(problem);
  inner_problem = coco_problem_transformed_get_inner_problem(problem);
  for (i = 0; i < problem->number_of_variables; ++i) {
    if (x[i] > 0.0) {
      exponent = 1.0
          + ((data->beta * (double) (long) i) / ((double) (long) problem->number_of_variables - 1.0)) * sqrt(x[i]);
      data->x[i] = pow(x[i], exponent);
    } else {
      data->x[i] = x[i];
    }
  }
  coco_evaluate_function(inner_problem, data->x, y);
  if (problem->number_of_constraints > 0) {
    cons_values = coco_allocate_vector(problem->number_of_constraints);
    is_feasible = coco_is_feasible(problem, x, cons_values);
    coco_free_memory(cons_values);    
    if (is_feasible)
      assert(y[0] + 1e-13 >= problem->best_value[0]);
  }
  else assert(y[0] + 1e-13 >= problem->best_value[0]);
}
static void transform_vars_asymmetric_evaluate_function ( coco_problem_t * problem , const double * x , double * y ) { size_t i ; double exponent , * cons_values ; int is_feasible ; transform_vars_asymmetric_data_t * data ; coco_problem_t * inner_problem ; if ( coco_vector_contains_nan ( x , coco_problem_get_dimension ( problem ) ) ) { coco_vector_set_to_nan ( y , coco_problem_get_number_of_objectives ( problem ) ) ; return ; } data = ( transform_vars_asymmetric_data_t * ) coco_problem_transformed_get_data ( problem ) ; inner_problem = coco_problem_transformed_get_inner_problem ( problem ) ; for ( i = 0 ; i < problem -> number_of_variables ; ++ i ) { if ( x [ i ] > 0.0 ) { exponent = 1.0 + ( ( data -> beta * ( double ) ( long ) i ) / ( ( double ) ( long ) problem -> number_of_variables - 1.0 ) ) * sqrt ( x [ i ] ) ; data -> x [ i ] = pow ( x [ i ] , exponent ) ; } else { data -> x [ i ] = x [ i ] ; } } coco_evaluate_function ( inner_problem , data -> x , y ) ; if ( problem -> number_of_constraints > 0 ) { cons_values = coco_allocate_vector ( problem -> number_of_constraints ) ; is_feasible = coco_is_feasible ( problem , x , cons_values ) ; coco_free_memory ( cons_values ) ; if ( is_feasible ) assert ( y [ 0 ] + 1e-13 >= problem -> best_value [ 0 ] ) ; } else assert ( y [ 0 ] + 1e-13 >= problem -> best_value [ 0 ] ) ; }
@brief Evaluates the transformed function.
@brief Evaluates the transformed function .