-
Notifications
You must be signed in to change notification settings - Fork 1
/
test1.R
83 lines (63 loc) · 1.69 KB
/
test1.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
library(roxygen2)
library(devtools)
library(parallelMap)
roxygenize()
load_all()
unlink("exdata", recursive = TRUE)
cocoSetLogLevel("warning")
s = cocoOpenSuite("bbob", result.folder = "exdata/", instances = 10:20, dims = c(2, 3, 5, 10, 20), inst.inds = 1:5)
print(s)
obs = cocoInitObserver(s, algorithm.name = "NelderMead")
print(obs)
problems = cocoSuiteGetAllProblems(s)
nprobs = cocoSuiteGetNumberOfProblems(s)
catf("problems in suite: %i", nprobs)
res = cocoSuiteRunOptimizer(s, cocoWrapperOptimNelderMead, observer = obs)
print(head(names(res)))
stop(123)
# res = list()
# for (ind in problem.inds) {
# p = cocoSuiteGetProblem(s, ind)
# res[[p$id]] = cocoRunOptimizer(cocoWrapperOptimNelderMead, p)
# }
cocoCloseSuite(s)
stop(999)
stop(999)
# p = cocoSuiteGetNextProblem(s, obs)
# print(p)
# res = cocoRunOptimizer(cocoWrapperOptimNelderMead, p)
# p = cocoSuiteGetNextProblem(s, obs)
# print(p)
res = list()
while(!is.null(problem <- cocoSuiteGetNextProblem(s, obs))) {
res[[problem$id]] = cocoRunOptimizer(cocoWrapperOptimNelderMead, problem)
}
cocoCloseSuite(s)
stop(8473974)
#print(cocoSuiteGetNumberOfProblems(s))
z = cocoSuiteRunOptimizer(cocoWrapperOptimNelderMead, s, obs)
print(z)
# s = cocoOpenSuite()
# ps = cocoSuiteGetAllProblems(s)
# ps = list()
# idx = c(0)
# for (i in idx) {
# p = cocoSuiteGetNextProblem(s)
# print(p)
# # p = cocoSuiteGetProblem(s, i)
# ps[[length(ps) + 1]] = p
# }
# for (i in seq_along(ps)) {
# p = ps[[i]]
# print(p)
# y = cocoEvaluateFunction(p, p$initial.solution)
# print(y)
# }
# for (i in seq_along(ps)) {
# print(i)
# p = ps[[i]]
# print(p)
# y = cocoEvaluateFunction(p, p$initial.solution)
# print(y)
# }
#cocoCloseSuite(s)