Comments (8)
Just by looking at the constraints it looks like they are too narrow (and partly don't make sense)
Forbidden: x2 >x1 | x3 > x4
In other words: x2 should always be smaller or equal then x1 AND x3 always has to be smaller then x4.
Having this in mind it does not make sense to have a higher lower bound for x2 then for x1.
Probably there is no feasible point found in the initial design.
from mlrmbo.
I tried removing the constraints all together, but now I get a different error:
library(mlrMBO)
obj.fn = makeMultiObjectiveFunction(
name = "My test function",
fn = function(x1, x2, x3, x4) {
var_1 <- sin(x1 + x2)
var_2 <- cos(x1 - x2)
var_3 <- x1 + x4
var_4 <- x3 + x4 -7
goal_1 = sum(var_1 + var_2 + var_3 + var_4)
goal_2 = var_1 + var_2 - var_3 + var_4
goal_3 = var_1 + var_2 - var_3 + 2*var_4
return(c(goal_1, goal_2, goal_3))
},
n.objectives = 3L,
#define acceptable ranges
par.set = makeParamSet(
makeNumericParam("x1", lower = 20, upper = 40),
makeNumericParam("x2", lower = 30, upper = 45),
makeNumericParam("x3", lower = 10, upper = 20),
makeNumericParam("x4", lower = 10, upper = 50)
),
minimize=rep(TRUE,3)
)
#create control gird
control=makeMBOControl(propose.points=1, final.method="best.predicted", final.evals=10)
control=setMBOControlTermination(control, iters=10)
control=setMBOControlInfill(control, crit=makeMBOInfillCritEI())
#perform optimization
lrn=makeMBOLearner(control, obj.fun)
res = mbo(obj.fun, design = NULL, learner = lrn, control = ctrl, show.info = TRUE)
Error:
Error in checkClass(x, classes, ordered, null.ok) :
object 'obj.fun' not found
Is there any way to fix this?
Thanks
from mlrmbo.
You named your function obj.fn
and not obj.fun
from mlrmbo.
Thank you for the correction - I found another typo : "ctrl" vs "control". I fixed both of these errors but now I have a new error.
from mlrmbo.
library(mlrMBO)
obj.fn = makeMultiObjectiveFunction(
name = "My test function",
fn = function(x1, x2, x3, x4) {
var_1 <- sin(x1 + x2)
var_2 <- cos(x1 - x2)
var_3 <- x1 + x4
var_4 <- x3 + x4 -7
goal_1 = sum(var_1 + var_2 + var_3 + var_4)
goal_2 = var_1 + var_2 - var_3 + var_4
goal_3 = var_1 + var_2 - var_3 + 2*var_4
return(c(goal_1, goal_2, goal_3))
},
n.objectives = 3L,
#define acceptable ranges
par.set = makeParamSet(
makeNumericParam("x1", lower = 20, upper = 40),
makeNumericParam("x2", lower = 30, upper = 45),
makeNumericParam("x3", lower = 10, upper = 20),
makeNumericParam("x4", lower = 10, upper = 50)
#define constraints
, forbidden = expression(x2 >x1 | x3 > x4)
),
minimize=rep(TRUE,3)
)
#create control gird
control=makeMBOControl(propose.points=1, final.method="best.predicted", final.evals=10)
control=setMBOControlTermination(control, iters=10)
control=setMBOControlInfill(control, crit=makeMBOInfillCritEI())
#perform optimization
lrn=makeMBOLearner(control, obj.fn)
res = mbo(obj.fn, design = NULL, learner = lrn, control = control, show.info = TRUE)
I got the following error:
Warning in generateDesign(n.params * 4L, par.set, fun = lhs::maximinLHS) :
generateDesign could only produce 15 points instead of 16!
Error in checkStuff(fun, design, learner, control) :
Objective function has 3 objectives, but the control object assumes 1.
I tried to fix this by changing the number of objectives:
#create control gird
control=makeMBOControl(propose.points=1, final.method="best.predicted", n.objectives = 3L, final.evals=10)
control=setMBOControlTermination(control, iters=10)
control=setMBOControlInfill(control, crit=makeMBOInfillCritEI())
#perform optimization
lrn=makeMBOLearner(control, obj.fn)
res = mbo(obj.fn, design = NULL, learner = lrn, control = control, show.info = TRUE)
But then I got a new error:
Error in checkStuff(fun, design, learner, control) :
Setting of final.method and final.evals for multi-objective optimization not supported at the moment.
Do you have any idea why this error is being produced?
Thank you so much for your help!
Thanks
from mlrmbo.
In MOO there is no final best but only a set of points that are pareto optimal.
You have to change makeMBOControl
control=makeMBOControl(propose.points=1)
from mlrmbo.
Hello Dr. Richter,
Thank you for your reply.
I removed the "best.predicted" statement, but the code is still not working:
library(mlrMBO)
obj.fn = makeMultiObjectiveFunction(
name = "My test function",
fn = function(x1, x2, x3, x4) {
var_1 <- sin(x1 + x2)
var_2 <- cos(x1 - x2)
var_3 <- x1 + x4
var_4 <- x3 + x4 -7
goal_1 = sum(var_1 + var_2 + var_3 + var_4)
goal_2 = var_1 + var_2 - var_3 + var_4
goal_3 = var_1 + var_2 - var_3 + 2*var_4
return(c(goal_1, goal_2, goal_3))
},
n.objectives = 3L,
#define acceptable ranges
par.set = makeParamSet(
makeNumericParam("x1", lower = 20, upper = 40),
makeNumericParam("x2", lower = 30, upper = 45),
makeNumericParam("x3", lower = 10, upper = 20),
makeNumericParam("x4", lower = 10, upper = 50)
#define constraints
, forbidden = expression(x2 >x1 | x3 > x4)
),
minimize=rep(TRUE,3)
)
#create control gird
control=makeMBOControl(propose.points=1, n.objectives = 3L, final.evals=10)
#perform optimization
lrn=makeMBOLearner(control, obj.fn)
res = mbo(obj.fn, design = NULL, learner = lrn, control = control, show.info = TRUE)
But this produces the following error
Error in checkStuff(fun, design, learner, control) :
Setting of final.method and final.evals for multi-objective optimization not supported at the moment.
As a result of this error, I tried to remove "final.evals":
#create control gird
control=makeMBOControl(propose.points=1, n.objectives = 3L)
#perform optimization
lrn=makeMBOLearner(control, obj.fn)
res = mbo(obj.fn, design = NULL, learner = lrn, control = control, show.info = TRUE)
But now I get a different error (even though I have specified there are 3 objectives):
Warning in generateDesign(n.params * 4L, par.set, fun = lhs::maximinLHS) :
generateDesign could only produce 15 points instead of 16!
Error in checkStuff(fun, design, learner, control) :
Objective function has 3 objectives, but the control object assumes 1.
If you have time, can you please try running this code on your computer and see if you can get it to work? I have been trying to get this to work for a while, but without any results.
Your Help Is Greatly Appreciated,
Thanks
from mlrmbo.
Hello Dr. Richter,,
Can you please take a look at this if you have some time?
Thanks
from mlrmbo.
Related Issues (20)
- invalid class “km” object: the number of experiments must be larger than the spatial dimension HOT 2
- invalid class “km” object: the number of experiments must be larger than the spatial dimension HOT 7
- pkgdown-site points to slack HOT 1
- human in the loop mbo fails if final.evals is != 0
- Undocumented ranges for settings
- Error in if (err < tol) break : missing value where TRUE/FALSE needed for 'classif.gausspr' HOT 6
- The 'configureMlr' can not work with the parallel computing HOT 4
- qLCB not implemented perfectly
- The solution to the died training-No return HOT 1
- Test failure on R-devel HOT 3
- MOIMBO with interleave.random.points causes error HOT 1
- Unable to install mlrMBO using install.packages dependencies=T. I am on IOS and using R v 1.4, someone else? HOT 4
- optimizing "multiple objective" functions with "constraints" HOT 3
- Error: unused arguments (forbidden = expression(x2 > x1)) HOT 1
- Final Answer from mlrMBO outside of the specified variable ranges (multi objective function) HOT 2
- Error: Setting of final.method and final.evals for multi-objective optimization not supported at the moment.
- Possible lack of consistency in xgboost hyperparameters optimization?
- error with AEI again
- Multi-task hyperparameter tuning using bayesian optimization
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mlrmbo.