Skip to content

Commit

Permalink
Merge pull request #1914 from numbbo/devel-test2
Browse files Browse the repository at this point in the history
Devel test2
  • Loading branch information
ttusar authored Aug 7, 2019
2 parents 8ea0988 + 7d59032 commit 5eaf505
Show file tree
Hide file tree
Showing 12 changed files with 3,259 additions and 2,319 deletions.
5,508 changes: 3,223 additions & 2,285 deletions code-experiments/build/python/cython/interface.c

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions code-experiments/build/python/cython/interface.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,10 @@ also report back a missing name to https://github.com/numbbo/coco/issues
problem = s.next_problem()
if problem is None:
return # StopIteration is deprecated
raise StopIteration
# raise StopIteration
except NoSuchProblemException:
return # StopIteration is deprecated
raise StopIteration
# raise StopIteration
yield problem
except:
raise
Expand Down
2 changes: 2 additions & 0 deletions code-experiments/src/coco_archive.c
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,8 @@ coco_archive_t *coco_archive(const char *suite_name,
coco_free_memory(suite_options);
coco_suite_free(suite);

(void) update; /* To silence compiler warnings */

return archive;
}

Expand Down
8 changes: 4 additions & 4 deletions code-experiments/src/coco_suite.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,13 +517,13 @@ static size_t *coco_suite_get_instance_indices(const coco_suite_t *suite, const
*/
static int coco_suite_is_next_item_found(const size_t *items, const size_t number_of_items, long *current_item_id) {

if ((*current_item_id) != number_of_items - 1) {
if ((*current_item_id) != (long) number_of_items - 1) {
/* Not the last item, iterate through items */
do {
(*current_item_id)++;
} while (((*current_item_id) < number_of_items - 1) && (items[*current_item_id] == 0));
} while (((*current_item_id) < (long) number_of_items - 1) && (items[*current_item_id] == 0));

assert((*current_item_id) < number_of_items);
assert((*current_item_id) < (long) number_of_items);
if (items[*current_item_id] != 0) {
/* Next item is found, return true */
return 1;
Expand All @@ -534,7 +534,7 @@ static int coco_suite_is_next_item_found(const size_t *items, const size_t numbe
*current_item_id = -1;
do {
(*current_item_id)++;
} while ((*current_item_id < number_of_items - 1) && (items[*current_item_id] == 0));
} while ((*current_item_id < (long) number_of_items - 1) && (items[*current_item_id] == 0));
if (items[*current_item_id] == 0)
coco_error("coco_suite_is_next_item_found(): the chosen suite has no valid (positive) items");
return 0;
Expand Down
8 changes: 4 additions & 4 deletions code-experiments/src/f_gallagher.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ static coco_problem_t *f_gallagher_bbob_problem_allocate(const size_t function,
double *arrCondition;
double fitvalues[2] = { 1.1, 9.1 };
/* Parameters for generating local optima. In the old code, they are different in f21 and f22 */
double b, c;
double b = 0, c = 0;
/* Random permutation */
f_gallagher_permutation_t *rperm;
double *random_numbers;
Expand Down Expand Up @@ -320,7 +320,7 @@ static double f_gallagher_core(const double *x, size_t number_of_variables, f_ga
double result = 0;
double y, w_i;
size_t i,j;
double maxf;
double maxf = DBL_MAX;
double *x_local;
x_local = coco_allocate_vector(number_of_variables);

Expand Down Expand Up @@ -413,8 +413,8 @@ static coco_problem_t *f_gallagher_permblockdiag_bbob_problem_allocate(const siz
double *tmp_uniform, *tmp_uniform2, *best_param_before_rotation, *best_param_after_rotation;
const size_t peaks_21 = 21;
const size_t peaks_101 = 101;
double a = 0.8, b, c;
double first_condition;
double a = 0.8, b = 0, c = 0;
double first_condition = 0;
double alpha_i, *alpha_i_vals;
size_t *P_alpha_i, *P_Lambda;
/* first_condition satisfies the old code and the doc but seems wrong in that it is, with very high
Expand Down
4 changes: 2 additions & 2 deletions code-experiments/src/logger_bbob.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ static void logger_bbob_openIndexFile(logger_bbob_data_t *logger,
const char *suite_name) {
/* to add the instance number TODO: this should be done outside to avoid redoing this for the .*dat files */
char used_dataFile_path[COCO_PATH_MAX + 2] = { 0 };
int errnum, newLine; /* newLine is at 1 if we need a new line in the info file */
int errnum, newLine = 0; /* newLine is at 1 if we need a new line in the info file */
char *function_id_char; /* TODO: consider adding them to logger */
char file_name[COCO_PATH_MAX + 2] = { 0 };
char file_path[COCO_PATH_MAX + 2] = { 0 };
Expand Down Expand Up @@ -432,7 +432,7 @@ static void logger_bbob_initialize(logger_bbob_data_t *logger, coco_problem_t *i
static void logger_bbob_evaluate(coco_problem_t *problem, const double *x, double *y) {
size_t i;
double y_logged, max_fvalue, sum_cons;
double *cons;
double *cons = NULL;
logger_bbob_data_t *logger = (logger_bbob_data_t *) coco_problem_transformed_get_data(problem);
coco_problem_t *inner_problem = coco_problem_transformed_get_inner_problem(problem);
const int is_feasible = problem->number_of_constraints <= 0
Expand Down
4 changes: 2 additions & 2 deletions code-experiments/src/logger_biobj.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,8 +518,8 @@ static logger_biobj_indicator_t *logger_biobj_indicator(const logger_biobj_data_
if (logger->log_nondom_mode == LOG_NONDOM_READ)
fprintf(indicator->info_file, " (reconstructed)");
}
if ((observer_data->previous_function != problem->suite_dep_function)
|| (observer_data->previous_dimension != problem->number_of_variables)) {
if ((observer_data->previous_function != (long) problem->suite_dep_function)
|| (observer_data->previous_dimension != (long) problem->number_of_variables)) {
fprintf(indicator->info_file, "\nfunction = %2lu, ", (unsigned long) problem->suite_dep_function);
fprintf(indicator->info_file, "dim = %2lu, ", (unsigned long) problem->number_of_variables);
fprintf(indicator->info_file, "%s", file_name);
Expand Down
2 changes: 1 addition & 1 deletion code-experiments/src/logger_rw.c
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ static void logger_rw_evaluate(coco_problem_t *problem, const double *x, double

logger_rw_data_t *logger;
coco_problem_t *inner_problem;
double *constraints;
double *constraints = NULL;
size_t i;
int log_this_time = 1;
time_t start, end;
Expand Down
6 changes: 3 additions & 3 deletions code-experiments/src/suite_bbob_legacy_code.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ static void bbob2009_unif(double *r, size_t N, long inseed) {
rgrand[i] = aktseed;
}
aktrand = rgrand[0];
for (i = 0; i < N; i++) {
for (i = 0; i < (long) N; i++) {
tmp = (int) floor((double) aktseed / (double) 127773);
aktseed = 16807 * (aktseed - tmp * 127773) - 2836 * tmp;
if (aktseed < 0)
Expand Down Expand Up @@ -134,7 +134,7 @@ static void bbob2009_compute_rotation(double **B, const long seed, const size_t
/* To ensure temporary data fits into gvec */
double prod;
double gvect[2000];
long i, j, k; /* Loop over pairs of column vectors. */
size_t i, j, k; /* Loop over pairs of column vectors. */

assert(DIM * DIM < 2000);

Expand Down Expand Up @@ -176,7 +176,7 @@ static void bbob2009_copy_rotation_matrix(double **rot, double *M, double *b, co
* @brief Randomly computes the location of the global optimum.
*/
static void bbob2009_compute_xopt(double *xopt, const long seed, const size_t DIM) {
long i;
size_t i;
bbob2009_unif(xopt, DIM, seed);
for (i = 0; i < DIM; i++) {
xopt[i] = 8 * floor(1e4 * xopt[i]) / 1e4 - 4;
Expand Down
2 changes: 1 addition & 1 deletion code-experiments/src/suite_cons_bbob_problems.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ static void feasible_direction_set_length(double * feasible_direction,
const double feas_shrink = 0.75; /* scale randomly between 0.75 and 1.0 */
const double feas_bound = 5.0;

int i;
size_t i;
double r[1], maxabs, maxrel;

for (maxabs = maxrel = i = 0; i < dimension; ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ static double **coco_copy_block_matrix(const double *const *B, const size_t dime
static size_t *coco_get_block_sizes(size_t *nb_blocks, size_t dimension, const char *suite_name){
size_t *block_sizes;
size_t block_size;
int i;
size_t i;

if (strcmp(suite_name, "bbob-largescale") == 0) {
/*block_size = coco_double_to_size_t(bbob2009_fmin((double)dimension / 4, 100));*/ /*old value*/
Expand Down
28 changes: 14 additions & 14 deletions code-experiments/src/transform_vars_permutation_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,12 @@ static int f_compare_doubles_for_random_permutation(const void *a, const void *b
* Wassim: move to coco_utilities?
*/
static void coco_compute_random_permutation(size_t *P, long seed, size_t n) {
long i;
size_t i;

perm_random_data = coco_allocate_vector(n);
bbob2009_gauss(perm_random_data, n, seed);
for (i = 0; i < n; i++){
P[i] = (size_t) i;
P[i] = i;
}
qsort(P, n, sizeof(size_t), f_compare_doubles_for_random_permutation);
coco_free_memory(perm_random_data);
Expand All @@ -50,15 +50,15 @@ static void coco_compute_random_permutation(size_t *P, long seed, size_t n) {
* @brief generates a permutation by sorting a sequence and puts it in P
*/
static void coco_compute_permutation_from_sequence(size_t *P, double *seq, size_t length) {
long i;
size_t i;

perm_random_data = coco_allocate_vector(length);
for (i = 0; i < length; i++){
P[i] = (size_t) i;
perm_random_data[i] = seq[i];
}
qsort(P, length, sizeof(size_t), f_compare_doubles_for_random_permutation);
coco_free_memory(perm_random_data);
perm_random_data = coco_allocate_vector(length);
for (i = 0; i < length; i++){
P[i] = i;
perm_random_data[i] = seq[i];
}
qsort(P, length, sizeof(size_t), f_compare_doubles_for_random_permutation);
coco_free_memory(perm_random_data);
}


Expand Down Expand Up @@ -86,14 +86,14 @@ static long coco_random_unif_integer(long lower_bound, long upper_bound, long se
* if swap_range is 0, a random uniform permutation is generated
*/
static void coco_compute_truncated_uniform_swap_permutation(size_t *P, long seed, size_t n, size_t nb_swaps, size_t swap_range) {
long i, idx_swap;
size_t i, idx_swap;
size_t lower_bound, upper_bound, first_swap_var, second_swap_var, tmp;
size_t *idx_order;

if (n <= 40) {
/* Do an identity permutation for dimensions <= 40 */
for (i = 0; i < n; i++)
P[i] = (size_t) i;
P[i] = i;
return;
}

Expand All @@ -102,8 +102,8 @@ static void coco_compute_truncated_uniform_swap_permutation(size_t *P, long seed

idx_order = coco_allocate_vector_size_t(n);
for (i = 0; i < n; i++) {
P[i] = (size_t) i;
idx_order[i] = (size_t) i;
P[i] = i;
idx_order[i] = i;
}

if (swap_range > 0) {
Expand Down

0 comments on commit 5eaf505

Please sign in to comment.