-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathmaximize.R
More file actions
48 lines (36 loc) · 1.63 KB
/
maximize.R
File metadata and controls
48 lines (36 loc) · 1.63 KB
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
maximize<-function(par){
#maximize is MSE specific and uses the optimize method. It uses objective function (that counts the number of satisfied inequalities).";
lower <- par["lower"][[1]]
upper <- par["upper"][[1]]
NP <- par["NP"][[1]]
itermax <- par["itermax"][[1]]
trace <- par["trace"][[1]]
reltol <- par["reltol"][[1]]
CR <- par["CR"][[1]]
F <- par["F"][[1]]
RandomSeed <- par["RandomSeed"][[1]]
set.seed(RandomSeed)
outDEoptim<-DEoptim(objective, lower, upper, control=list(NP=NP, itermax=itermax,trace=trace,reltol=reltol,
CR=CR,F=F))
bestmem<-outDEoptim$optim$bestmem
bestval<--outDEoptim$optim$bestval
return(list("bestmem"=bestmem,"bestval"=bestval))
}
maximize2<-function(par){
#maximize is MSE specific and uses the optimize method. It uses objective function (that counts the number of satisfied inequalities).";
lower <- par["lower"][[1]]
upper <- par["upper"][[1]]
NP <- par["NP"][[1]]
itermax <- par["itermax"][[1]]
trace <- par["trace"][[1]]
reltol <- par["reltol"][[1]]
CR <- par["CR"][[1]]
F <- par["F"][[1]]
RandomSeed <- par["RandomSeed"][[1]]
set.seed(RandomSeed)
outDEoptim<-DEoptim(objective2, lower, upper, control=list(NP=NP, itermax=itermax,trace=trace,reltol=reltol,
CR=CR,F=F))
bestmem<-outDEoptim$optim$bestmem
bestval<--outDEoptim$optim$bestval
return(list("bestmem"=bestmem,"bestval"=bestval))
}