Skip to content

Commit

Permalink
Hopefully this is the right time, but I guess we'll have to see the r…
Browse files Browse the repository at this point in the history
…esults of the tests done at commit time
  • Loading branch information
FMGS666 committed Oct 18, 2023
1 parent 3254807 commit d8dd1a5
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ code-experiments/test/integration-test/test_biobj
code-experiments/test/integration-test/test_coco
code-experiments/test/integration-test/test_instance_extraction
code-experiments/test/regression-test/data/*
code-experiments/test/regression-test/bbob_noisy_regression_test/data_legacy/
code-experiments/test/regression-test/bbob_noisy_regression_test/data_legacy/*.json
code-experiments/test/regression-test/bbob_noisy_regression_test/results

code-postprocessing/build/
code-postprocessing/dist/
Expand Down
7 changes: 3 additions & 4 deletions code-experiments/build/python/coco_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,9 @@ def process_test_cases(fd, suite_name, test_vectors):
y = problem(test_vector[:problem.number_of_variables])
if not about_equal(y, expected_y, 4e-6):
number_of_failures += 1
if number_of_failures < 100:
print("%8i %8i FAILED expected=%.8e observed=%.8e" % (problem_index, test_vector_id, expected_y, y))
elif number_of_failures == 100:
print("... further failed tests suppressed ...")
print(f"{problem.id}:{test_vector_id} FAILED expected={expected_y} observed={y}")
#elif number_of_failures == 100:
# print("... further failed tests suppressed ...")
print("%i of %i tests passed (failure rate %.2f%%)" % (number_of_testcases - number_of_failures, number_of_testcases, (100.0 * number_of_failures) / number_of_testcases))
if number_of_failures > 0:
sys.exit(-1)
Expand Down
4 changes: 3 additions & 1 deletion code-experiments/src/f_ellipsoid.c
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,8 @@ static coco_problem_t *f_ellipsoid_rotated_bbob_problem_allocate(const size_t fu
double *b = coco_allocate_vector(dimension);
double **rot1;

double conditioning = args -> f_ellipsoid_args -> conditioning;/*
printf("f_ellipsoid.c:conditioning=%f\n", conditioning);*/
xopt = coco_allocate_vector(dimension);
bbob2009_compute_xopt(xopt, rseed, dimension);
fopt = bbob2009_compute_fopt(function, instance);
Expand All @@ -146,7 +148,7 @@ static coco_problem_t *f_ellipsoid_rotated_bbob_problem_allocate(const size_t fu
bbob2009_compute_rotation(rot1, rseed + 1000000, dimension);
bbob2009_copy_rotation_matrix(rot1, M, b, dimension);
bbob2009_free_matrix(rot1, dimension);
problem = f_ellipsoid_allocate(dimension, args -> f_ellipsoid_args -> conditioning);
problem = f_ellipsoid_allocate(dimension, conditioning);
problem = transform_vars_oscillate(problem);
problem = transform_vars_affine(problem, M, b, dimension);
problem = transform_vars_shift(problem, xopt, 0);
Expand Down
4 changes: 3 additions & 1 deletion code-experiments/src/f_step_ellipsoid.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* TODO: It would be nice to have a generic step ellipsoid function to complement this one.
*/
#include <assert.h>
#include <stdio.h>

#include "coco.h"
#include "coco_problem.c"
Expand Down Expand Up @@ -143,7 +144,8 @@ static coco_problem_t *f_step_ellipsoid_bbob_problem_allocate(const size_t funct
data->xopt = coco_allocate_vector(dimension);
data->rot1 = bbob2009_allocate_matrix(dimension, dimension);
data->rot2 = bbob2009_allocate_matrix(dimension, dimension);
const double penalty_scale = args->f_step_ellipsoid_args->penalty_scale;
double penalty_scale = args->f_step_ellipsoid_args->penalty_scale;/*
printf("f_step_ellipsoid.c:penalty_scale=%f\n", penalty_scale);*/
data->fopt = bbob2009_compute_fopt(function, instance);
data->penalty_scale = penalty_scale;
bbob2009_compute_xopt(data->xopt, rseed, dimension);
Expand Down
12 changes: 7 additions & 5 deletions code-experiments/src/suite_bbob.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,14 @@ static coco_problem_t *coco_get_bbob_problem(const size_t function,
f_args_t *args = NULL;
args = coco_problem_allocate_f_args(args);

args->f_ellipsoid_args-> conditioning = 1.0e6;
args->f_ellipsoid_args->conditioning = 1.0e6;
args->f_step_ellipsoid_args->penalty_scale = 1.0;
args->f_griewank_rosenbrock_args ->facftrue = 10.0;
args->f_gallagher_args->penalty_scale = 1.0;


/*
printf("\n\nsuite_bbob.c:args->f_ellipsoid_args->conditioning=%f\n",args->f_ellipsoid_args->conditioning );
printf("suite_bbob.c:args->f_step_ellipsoid_args->penalty_scale=%f\n", args->f_step_ellipsoid_args->penalty_scale);
*/
const char *problem_id_template = "bbob_f%03lu_i%02lu_d%02lu";
const char *problem_name_template = "BBOB suite problem f%lu instance %lu in %luD";

Expand All @@ -133,7 +135,7 @@ static coco_problem_t *coco_get_bbob_problem(const size_t function,
problem = f_attractive_sector_bbob_problem_allocate(function, dimension, instance, rseed,
problem_id_template, problem_name_template);
} else if (function == 7) {
problem = f_ellipsoid_rotated_bbob_problem_allocate(function, dimension, instance, rseed, args,
problem = f_step_ellipsoid_bbob_problem_allocate(function, dimension, instance, rseed, args,
problem_id_template, problem_name_template);
} else if (function == 8) {
problem = f_rosenbrock_bbob_problem_allocate(function, dimension, instance, rseed,
Expand All @@ -142,7 +144,7 @@ static coco_problem_t *coco_get_bbob_problem(const size_t function,
problem = f_rosenbrock_rotated_bbob_problem_allocate(function, dimension, instance, rseed,
problem_id_template, problem_name_template);
} else if (function == 10) {
problem = f_step_ellipsoid_bbob_problem_allocate(function, dimension, instance, rseed, args,
problem = f_ellipsoid_rotated_bbob_problem_allocate(function, dimension, instance, rseed, args,
problem_id_template, problem_name_template);
} else if (function == 11) {
problem = f_discus_bbob_problem_allocate(function, dimension, instance, rseed,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,5 @@ def regression_test_bbob_noisy(filename):
print("All tests passed, execution terminating with exit code {}".format(failed_test_counter))

if __name__ == "__main__":
data_file_path = "./code-experiments/test/regression-test/bbob_noisy_regression_test/data_legacy/bbob_noisy_regression_data_10.json"
data_file_path = "./code-experiments/test/regression-test/bbob_noisy_regression_test/data_legacy/bbob_noisy_regression_data_5.json"
evaluation_dictionary_list = regression_test_bbob_noisy(data_file_path)
Empty file.

0 comments on commit d8dd1a5

Please sign in to comment.