多目标优化约束问题:R

问题描述

鉴于 model1 model2model3 之前已经可以验证工作,我有以下代码定义了我想在我的多目标优化问题中使用的两个约束。>

restrictions <- function (var) {
  x <- var[1]; y <- var[2]
  restrictions <- logical(2)
  restrictions[1] <- (predict(get(model1),data.frame(x,y),type = "response") < 500)
  restrictions[2] <- (predict(get(model1),type = "response") > 0)
  return (restrictions);
}

在以下代码中构建遗传算法多目标函数

fn <- function (var) {
  x <- var[1]; y <- var[2]
  f <- numeric(3)
  f[1] <- predict(get(model1),type = "response")
  f[2] <- predict(get(model2),type = "response")
  f[3] <- predict(get(model3),type = "response")
  return (f);
}

最后是使用 mco 库的优化过程

library (mco)
optimum <- mco::nsga2 (fn = fn,idim = 2,odim=3,constraints = restrictions,cdim = 2,generations = 100,popsize= 40,cprob = 0.5,cdist = 20,mprob = 0.5,mdist = 20,lower.bounds = c(-80,50),upper.bounds = c(-70,60)
)

主要问题是解决方案不遵守指定的约束。对此有什么想法吗?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)