Open BobYa1 opened 4 years ago
In the current test suite implementation you can not change dimension easily (it is of course possible, but I don't know how). However, there is the bbob-largescale
test suite with dimension 20 to 640 as shown above. Just using this testbed may be good enough?
Hi
Np that is not enough. I am looking for ability to add any dimension I want. It is ok for me to have six dimensions, but I want to change them. Anybody have any idea how to do it in a hard way?
Thanks
Actually, you should be able to run experiments on the bbob
problems with different dimensions than the default ones. You just need to change the dimensions in the file https://github.com/numbbo/coco/blob/master/code-experiments/src/suite_bbob.c (or https://github.com/numbbo/coco/blob/master/code-experiments/src/suite_largescale.c if you are interested in higher dimensions).
Just input the dimensions you want here: const size_t dimensions[] = { 2, 3, 5, 10, 20, 40 };
If the number of dimensions is different than 6, you also need to update the value here suite = coco_suite_allocate("bbob", 24, 6, dimensions, "year: 2018");
- the 6 should be changed to the new number of dimensions.
After the changes, you could run python do.py run-c
to check if that worked.
However, this will only allow to run the experiments with different dimensions, I'm pretty sure post-processing the results would need some adjustment before it could be used. But I'm not the right person to give advice on that front...
The probably only change in the postprocessing needed to postprocess other dimensions than the default has to be made in the testbedsettings.py
file. Search for the corresponding Testbed class (there is one per test suite, for example GECCOBBOBTestbed
for the bbob
test suite). In each Testbed class, there are a few variables that are related to the displayed dimensions and the fact that the default reference algorithm is only defined for the default dimensions. If you change all those to your needs, it might run already "out of the box" [not tested!]:
import cocopp
cocopp.testbedsettings.GECCOBBOBTestbed.settings['dimensions_to_display'] = (10,15,20,25,30,40)
cocopp.testbedsettings.GECCOBBOBTestbed.settings['goto_dimension'] = 30
cocopp.testbedsettings.GECCOBBOBTestbed.settings['reference_algorithm_filename'] = '' # remove reference algorithm because it is only defined for default dimensions
cocopp.main('youralgorithmfolder/')
Not sure how much this is compatible with the existing algorithm data sets, but it might even work---displaying all data for the dimensions that are the same in both test suites (yours and the default one if you run the experiments on a changed suite of the same default name such as bbob
).
We would be very interested to hear how easy it is to get an experiment running (and postprocessed) with other than the default dimensions, so please let us know. Of course also if you have difficulties with all the above.
Hi Thanks. I am using BBOB suite only to generate functions data without the optimization experiments. I will try your solution and will post if it worked. What should I get with python do.py run-c?
Actually, you should be able to run experiments on the
bbob
problems with different dimensions than the default ones. You just need to change the dimensions in the file https://github.com/numbbo/coco/blob/master/code-experiments/src/suite_bbob.c (or https://github.com/numbbo/coco/blob/master/code-experiments/src/suite_largescale.c if you are interested in higher dimensions).Just input the dimensions you want here:
const size_t dimensions[] = { 2, 3, 5, 10, 20, 40 };
If the number of dimensions is different than 6, you also need to update the value here
suite = coco_suite_allocate("bbob", 24, 6, dimensions, "year: 2018");
- the 6 should be changed to the new number of dimensions.After the changes, you could run
python do.py run-c
to check if that worked.However, this will only allow to run the experiments with different dimensions, I'm pretty sure post-processing the results would need some adjustment before it could be used. But I'm not the right person to give advice on that front...
The command python do.py run-c
will amalgamate the C source code into a single .c
and a .h
file (and run some quick tests). If you changed the C sources as explained by @ttusar above, this is needed to make the actual changes usable by the example experiment. If you are planning to use other languages such as python for your experiments, the corresponding command (in this case python do.py run-python
) should be run instead.
Hi
Thanks. I will try it and let you know. python do.py run-python command should be run in the same directory as the changed c files?
The probably only change in the postprocessing needed to postprocess other dimensions than the default has to be made in the
testbedsettings.py
file. Search for the corresponding Testbed class (there is one per test suite, for exampleGECCOBBOBTestbed
for thebbob
test suite). In each Testbed class, there are a few variables that are related to the displayed dimensions and the fact that the default reference algorithm is only defined for the default dimensions. If you change all those to your needs, it might run already "out of the box" [not tested!]:import cocopp cocopp.testbedsettings.GECCOBBOBTestbed.settings['dimensions_to_display'] = (10,15,20,25,30,40) cocopp.testbedsettings.GECCOBBOBTestbed.settings['goto_dimension'] = 30 cocopp.testbedsettings.GECCOBBOBTestbed.settings['reference_algorithm_filename'] = '' # remove reference algorithm because it is only defined for default dimensions cocopp.main('youralgorithmfolder/')
Not sure how much this is compatible with the existing algorithm data sets, but it might even work---displaying all data for the dimensions that are the same in both test suites (yours and the default one if you run the experiments on a changed suite of the same default name such as
bbob
).We would be very interested to hear how easy it is to get an experiment running (and postprocessed) with other than the default dimensions, so please let us know. Of course also if you have difficulties with all the above.
The python do.py run-python
should be run where the do,py
file is (in the uppermost folder of the distribution).
Hello
This is the output: Is it correct? The code runs perfectly for me.
Thank you for help
(base) D:\PostDoc\Migal\BBOB\Progs\COCO\coco-masterOr\coco-master>python do.py run-python AML ['code-experiments/src/coco_random.c', 'code-experiments/src/coco_suite.c', 'code-experiments/src/coco_observer.c', 'code-experiments/src/coco_archive.c', 'code-experiments/src/coco_runtime_c.c'] -> code-experiments/build/python/cython/coco.c EXPAND code-experiments/build/python/cython/coco.c.in to code-experiments/build/python/cython/coco.c EXPAND code-experiments/src/coco.h to code-experiments/build/python/cython/coco.h COPY code-experiments/src/bbob2009_testcases.txt -> code-experiments/build/python/bbob2009_testcases.txt COPY code-experiments/src/bbob2009_testcases2.txt -> code-experiments/build/python/bbob2009_testcases2.txt COPY code-experiments/build/python/README.md -> code-experiments/build/python/README.txt EXPAND code-experiments/build/python/setup.py.in to code-experiments/build/python/setup.py PYTHON setup.py install in code-experiments\build\python PYTHON example_experiment.py bbob in code-experiments\build\python
(base) D:\PostDoc\Migal\BBOB\Progs\COCO\coco-masterOr\coco-master>python do.py run-c AML ['code-experiments/src/coco_random.c', 'code-experiments/src/coco_suite.c', 'code-experiments/src/coco_observer.c', 'code-experiments/src/coco_archive.c', 'code-experiments/src/coco_runtime_c.c'] -> code-experiments/build/c/coco.c EXPAND code-experiments/build/c/coco.c.in to code-experiments/build/c/coco.c EXPAND code-experiments/src/coco.h to code-experiments/build/c/coco.h COPY code-experiments/build/c/coco.c -> code-experiments/examples/bbob2009-c-cmaes/coco.c EXPAND code-experiments/build/c/coco.h to code-experiments/examples/bbob2009-c-cmaes/coco.h WRITE code-experiments/build/c/REVISION WRITE code-experiments/build/c/VERSION MAKE clean in code-experiments/build/c CHDIR D:\PostDoc\Migal\BBOB\Progs\COCO\coco-masterOr\coco-master\code-experiments\build\c COPY Makefile_win_gcc.in -> Makefile IF EXIST "coco.o" DEL /F coco.o IF EXIST "example_experiment.o" DEL /F example_experiment.o IF EXIST "example_experiment.exe" DEL /F example_experiment.exe
MAKE all in code-experiments/build/c CHDIR D:\PostDoc\Migal\BBOB\Progs\COCO\coco-masterOr\coco-master\code-experiments\build\c COPY Makefile_win_gcc.in -> Makefile ERROR: return value=2 C:\Program Files\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin\cc.exe -c -o example_experiment.o example_experiment.c C:\Program Files\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin\cc.exe -c -g -ggdb -std=c89 -pedantic -Wall -Wextra -Wstrict-prototypes -Wshadow -Wno-sign-compare -Wconversion -o coco.o coco.c code-experiments/src/transform_vars_permutation_helpers.c: In function 'coco_compute_truncated_uniform_swap_permutation': code-experiments/src/transform_vars_permutation_helpers.c:130:64: warning: conversion to 'size_t {aka long long unsigned int}' from 'long int' may change the sign of the result [-Wsign-conversion] code-experiments/src/transform_vars_permutation_helpers.c:130:59: warning: conversion to 'long int' from 'size_t {aka long long unsigned int}' may alter its value [-Wconversion] code-experiments/src/suite_bbob.c: In function 'suite_bbob_initialize': code-experiments/src/suite_bbob.c:42:79: error: C++ style comments are not allowed in ISO C90 code-experiments/src/suite_bbob.c:42:79: error: (this will be reported only once per input file) code-experiments/src/suite_cons_bbob_problems.c: In function 'feasible_direction_set_length': code-experiments/src/suite_cons_bbob_problems.c:145:26: warning: conversion to 'double' from 'size_t {aka long long unsigned int}' may alter its value [-Wconversion] make: *** [Makefile:33: coco.o] Error 1
Traceback (most recent call last):
File "do.py", line 1025, in
This is the output: Is it correct?
An error never looks like correct behavior to me. What do you have in code-experiments/src/suite_bbob.c:42:79
?
The problem seems to be that you are using comments in the format // comment
, which is not supported by C. Please use the /* comment */
formatting instead.
An error never looks like correct behavior to me. What do you have in code-experiments/src/suite_bbob.c:42:79
? -> It was incorrect comment // len(dim) =12
This is the output: Is it correct?
An error never looks like correct behavior to me. What do you have in
code-experiments/src/suite_bbob.c:42:79
?
My code now:
suite_bbob.c
static coco_suite_t *suite_bbob_initialize(void) {
coco_suite_t *suite;
const size_t dimensions[] = { 1, 2, 3, 5, 8, 10, 15, 20, 25, 30, 35, 40 }; /* len(dim) =12 */
/*BY added dim = [1, 8 , 15 ,25, 30, 35].20052020 */
/* const size_t dimensions[] = { 2, 3, 5, 10, 20, 40 }; //BY commented */
/* IMPORTANT: Make sure to change the default instance for every new workshop! */
suite = coco_suite_allocate("bbob", 24, 12, dimensions, "year: 2018");
/*BY added dim = [1, 8 , 15 ,25, 30, 35].20052020. len(dim) =12 */
/*suite = coco_suite_allocate("bbob", 24, 6, dimensions, "year: 2018"); //BY commented */
return suite;
}
The output now:
(base) D:\PostDoc\Migal\BBOB\Progs\COCO\coco-masterOr\coco-master>python do.py run-python AML ['code-experiments/src/coco_random.c', 'code-experiments/src/coco_suite.c', 'code-experiments/src/coco_observer.c', 'code-experiments/src/coco_archive.c', 'code-experiments/src/coco_runtime_c.c'] -> code-experiments/build/python/cython/coco.c EXPAND code-experiments/build/python/cython/coco.c.in to code-experiments/build/python/cython/coco.c EXPAND code-experiments/src/coco.h to code-experiments/build/python/cython/coco.h COPY code-experiments/src/bbob2009_testcases.txt -> code-experiments/build/python/bbob2009_testcases.txt COPY code-experiments/src/bbob2009_testcases2.txt -> code-experiments/build/python/bbob2009_testcases2.txt COPY code-experiments/build/python/README.md -> code-experiments/build/python/README.txt EXPAND code-experiments/build/python/setup.py.in to code-experiments/build/python/setup.py PYTHON setup.py install in code-experiments\build\python PYTHON example_experiment.py bbob in code-experiments\build\python
(base) D:\PostDoc\Migal\BBOB\Progs\COCO\coco-masterOr\coco-master>python do.py run-c AML ['code-experiments/src/coco_random.c', 'code-experiments/src/coco_suite.c', 'code-experiments/src/coco_observer.c', 'code-experiments/src/coco_archive.c', 'code-experiments/src/coco_runtime_c.c'] -> code-experiments/build/c/coco.c EXPAND code-experiments/build/c/coco.c.in to code-experiments/build/c/coco.c EXPAND code-experiments/src/coco.h to code-experiments/build/c/coco.h COPY code-experiments/build/c/coco.c -> code-experiments/examples/bbob2009-c-cmaes/coco.c EXPAND code-experiments/build/c/coco.h to code-experiments/examples/bbob2009-c-cmaes/coco.h WRITE code-experiments/build/c/REVISION WRITE code-experiments/build/c/VERSION MAKE clean in code-experiments/build/c CHDIR D:\PostDoc\Migal\BBOB\Progs\COCO\coco-masterOr\coco-master\code-experiments\build\c COPY Makefile_win_gcc.in -> Makefile IF EXIST "coco.o" DEL /F coco.o IF EXIST "example_experiment.o" DEL /F example_experiment.o IF EXIST "example_experiment.exe" DEL /F example_experiment.exe
MAKE all in code-experiments/build/c CHDIR D:\PostDoc\Migal\BBOB\Progs\COCO\coco-masterOr\coco-master\code-experiments\build\c COPY Makefile_win_gcc.in -> Makefile C:\Program Files\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin\cc.exe -c -o example_experiment.o example_experiment.c C:\Program Files\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin\cc.exe -c -g -ggdb -std=c89 -pedantic -Wall -Wextra -Wstrict-prototypes -Wshadow -Wno-sign-compare -Wconversion -o coco.o coco.c code-experiments/src/transform_vars_permutation_helpers.c: In function 'coco_compute_truncated_uniform_swap_permutation': code-experiments/src/transform_vars_permutation_helpers.c:130:64: warning: conversion to 'size_t {aka long long unsigned int}' from 'long int' may change the sign of the result [-Wsign-conversion] code-experiments/src/transform_vars_permutation_helpers.c:130:59: warning: conversion to 'long int' from 'size_t {aka long long unsigned int}' may alter its value [-Wconversion] code-experiments/src/suite_cons_bbob_problems.c: In function 'feasible_direction_set_length': code-experiments/src/suite_cons_bbob_problems.c:145:26: warning: conversion to 'double' from 'size_t {aka long long unsigned int}' may alter its value [-Wconversion] C:\Program Files\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin\cc.exe -g -ggdb -std=c89 -pedantic -Wall -Wextra -Wstrict-prototypes -Wshadow -Wno-sign-compare -Wconversion -o example_experiment coco.o example_experiment.o -lm
RUN ./example_experiment in code-experiments/build/c ERROR: return value=3 Running the example experiment... (might take time, be patient) COCO INFO: Results will be output to folder exdata\RS_on_bbob
COCO INFO: 20.05.20 14:03:10, d=1, running: f01...............f02...............f03...............f04...............Assertion failed!
Program: D:\PostDoc\Migal\BBOB\Progs\COCO\coco-masterOr\coco-master\code-experiments\build\c\example_experiment.exe File: code-experiments/src/f_linear_slope.c, Line 57
Expression: y[0] + 1e-13 >= problem->best_value[0]
Pay attention I am not doing experiments. I am only interested in generating functions.
I get a similar problem even before (on function f3). I think it has to do with using dimension 1. I tried rerunning your dimensions without 1 and that works.
How is it possible to solve it for dim=1?
I get a similar problem even before (on function f3). I think it has to do with using dimension 1. I tried rerunning your dimensions without 1 and that works.
After change. No dim=1:
static coco_suite_t *suite_bbob_initialize(void) {
coco_suite_t suite; const size_t dimensions[] = { 2, 3, 5, 8, 10, 15, 20, 25, 30, 31, 35, 40 }; / len(dim) =12 / / const size_t dimensions[] = { 1, 2, 3, 5, 8, 10, 15, 20, 25, 30, 35, 40 }; len(dim) =12 / /BY added dim = [1, 8 , 15 ,25, 30, 35].20052020 / / const size_t dimensions[] = { 2, 3, 5, 10, 20, 40 }; //BY commented / / IMPORTANT: Make sure to change the default instance for every new workshop! / suite = coco_suite_allocate("bbob", 24, 12, dimensions, "year: 2018"); /BY added dim = [1, 8 , 15 ,25, 30, 35].20052020. len(dim) =12 / /suite = coco_suite_allocate("bbob", 24, 6, dimensions, "year: 2018"); //BY commented */ return suite; }
(base) D:\PostDoc\Migal\BBOB\Progs\COCO\coco-masterOr\coco-master>python do.py run-c AML ['code-experiments/src/coco_random.c', 'code-experiments/src/coco_suite.c', 'code-experiments/src/coco_observer.c', 'code-experiments/src/coco_archive.c', 'code-experiments/src/coco_runtime_c.c'] -> code-experiments/build/c/coco.c EXPAND code-experiments/build/c/coco.c.in to code-experiments/build/c/coco.c EXPAND code-experiments/src/coco.h to code-experiments/build/c/coco.h COPY code-experiments/build/c/coco.c -> code-experiments/examples/bbob2009-c-cmaes/coco.c EXPAND code-experiments/build/c/coco.h to code-experiments/examples/bbob2009-c-cmaes/coco.h WRITE code-experiments/build/c/REVISION WRITE code-experiments/build/c/VERSION MAKE clean in code-experiments/build/c CHDIR D:\PostDoc\Migal\BBOB\Progs\COCO\coco-masterOr\coco-master\code-experiments\build\c COPY Makefile_win_gcc.in -> Makefile IF EXIST "coco.o" DEL /F coco.o IF EXIST "example_experiment.o" DEL /F example_experiment.o IF EXIST "example_experiment.exe" DEL /F example_experiment.exe
MAKE all in code-experiments/build/c CHDIR D:\PostDoc\Migal\BBOB\Progs\COCO\coco-masterOr\coco-master\code-experiments\build\c COPY Makefile_win_gcc.in -> Makefile C:\Program Files\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin\cc.exe -c -o example_experiment.o example_experiment.c C:\Program Files\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin\cc.exe -c -g -ggdb -std=c89 -pedantic -Wall -Wextra -Wstrict-prototypes -Wshadow -Wno-sign-compare -Wconversion -o coco.o coco.c code-experiments/src/transform_vars_permutation_helpers.c: In function 'coco_compute_truncated_uniform_swap_permutation': code-experiments/src/transform_vars_permutation_helpers.c:130:64: warning: conversion to 'size_t {aka long long unsigned int}' from 'long int' may change the sign of the result [-Wsign-conversion] code-experiments/src/transform_vars_permutation_helpers.c:130:59: warning: conversion to 'long int' from 'size_t {aka long long unsigned int}' may alter its value [-Wconversion] code-experiments/src/suite_cons_bbob_problems.c: In function 'feasible_direction_set_length': code-experiments/src/suite_cons_bbob_problems.c:145:26: warning: conversion to 'double' from 'size_t {aka long long unsigned int}' may alter its value [-Wconversion] C:\Program Files\mingw-w64\x86_64-7.3.0-posix-seh-rt_v5-rev0\mingw64\bin\cc.exe -g -ggdb -std=c89 -pedantic -Wall -Wextra -Wstrict-prototypes -Wshadow -Wno-sign-compare -Wconversion -o example_experiment coco.o example_experiment.o -lm
RUN ./example_experiment in code-experiments/build/c
This means that it's working. I'm afraid I'm not able to help wrt the failure for d=1. @nikohansen (or @brockho) should know more...
Thank you very much. Intresting that my code is runing also with dim=1 without errors.
This means that it's working. I'm afraid I'm not able to help wrt the failure for d=1. @nikohansen (or @brockho) should know more...
I might be missing something, but if you get
COCO INFO: 20.05.20 14:03:10, d=1, running: f01...............f02...............f03...............f04...............Assertion failed!
This means it's not working for d=1.
When you get to
RUN ./example_experiment in code-experiments/build/c
That means that it is working.
@nikohansen (or @brockho) should know more...
I could only make random guesses, like, sometimes we divide by d-1 in the function definitions which looks not very promising for d=1. I am almost impressed that the code bails on an assertion and not division by zero.
Thanks
@nikohansen (or @brockho) should know more...
I could only make random guesses, like, sometimes we divide by d-1 in the function definitions which looks not very promising for d=1. I am almost impressed that the code bails on an assertion and not division by zero.
Hello
Any ideas about this error?
(base) C:\Users\borisy\Documents\PostDoc\Migal\BBOB\Progs\COCO\coco-masterOr\coco-master>python do.py run-c AML ['code-experiments/src/coco_random.c', 'code-experiments/src/coco_suite.c', 'code-experiments/src/coco_observer.c', 'code-experiments/src/coco_archive.c', 'code-experiments/src/coco_runtime_c.c'] -> code-experiments/build/c/coco.c EXPAND code-experiments/build/c/coco.c.in to code-experiments/build/c/coco.c EXPAND code-experiments/src/coco.h to code-experiments/build/c/coco.h COPY code-experiments/build/c/coco.c -> code-experiments/examples/bbob2009-c-cmaes/coco.c EXPAND code-experiments/build/c/coco.h to code-experiments/examples/bbob2009-c-cmaes/coco.h WRITE code-experiments/build/c/REVISION WRITE code-experiments/build/c/VERSION MAKE clean in code-experiments/build/c CHDIR C:\Users\borisy\Documents\PostDoc\Migal\BBOB\Progs\COCO\coco-masterOr\coco-master\code-experiments\build\c COPY Makefile_win_gcc.in -> Makefile IF EXIST "coco.o" DEL /F coco.o IF EXIST "example_experiment.o" DEL /F example_experiment.o IF EXIST "example_experiment.exe" DEL /F example_experiment.exe
MAKE all in code-experiments/build/c CHDIR C:\Users\borisy\Documents\PostDoc\Migal\BBOB\Progs\COCO\coco-masterOr\coco-master\code-experiments\build\c COPY Makefile_win_gcc.in -> Makefile ERROR: return value=2 C:\mingw-w64\mingw64\bin -c -o example_experiment.o example_experiment.c process_begin: CreateProcess(NULL, C:\mingw-w64\mingw64\bin -c -o example_experiment.o example_experiment.c, ...) failed. make (e=5): Access is denied.
make: *** [
Traceback (most recent call last):
File "do.py", line 1025, in
python do.py run-python Runs fine
C:\mingw-w64\mingw64\bin -c -o example_experiment.o example_experiment.c
process_begin: CreateProcess(NULL, C:\mingw-w64\mingw64\bin -c -o example_experiment.o example_experiment.c, ...) failed.
make (e=5): Access is denied.
some file access problem?
Hello
In bbob there are standard set of dimensions for input X data - [2, 3, 5, 10, 20, 40]. I would like to add additional dimensions. How can I do it?
I found this in coco.c. Tried to change it, but it didnt help. How can I do it?
static coco_suite_t *suite_largescale_initialize(void) {
coco_suite_t *suite; const size_t dimensions[] = { 20, 40, 80, 160, 320, 640}; suite = coco_suite_allocate("bbob-largescale", 24, 6, dimensions, "instances: 1-15"); return suite; }