How to optimize a vector, where only two values are allowed?
显示 更早的评论
Hello,
as you see in the Pseudocode I have an optimization problem with two inputvectors, which I combine as a matrix. This works well so far.
Now I have the problem that the vector v2 can only have two values: 0 and 1. But I don't know how the two values are best distributed over the vector.
So I would like that during running the optimization the best distribution of zeros and ones over the vector v2 is calculated. How can I make this restriction for v2?
Thanks for your help
mExample=[v1,v2];
opts = optimoptions(@fmincon,'MaxIterations',500,'MaxFunctionEvaluations',500);
optFunction = @(mExample)OptimProb(vstativ,mExample);
optProblem = createOptimProblem('fminunc', 'x0', mExample, 'objective', optFunction,'options',opts);
[mExampleSolution, OptimizationCriterion, ~, Output] = run(MultiStart, optProblem, NMultistart);
function OptimizationCriterion = OptimProb(vstatic,mExample)
%calculateOptimizationCriterion from vstatic and mExample
end
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Surrogate Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!