optimisation with dynamic objective function
5 次查看(过去 30 天)
显示 更早的评论
Hi guys I am new in optimisation and matlab. I am looking to solve a problem described as followed: decision variable pi i=1..n, binary and with constraint p(1)+p(2)+...p(n)=1 min F(p) but the issue is that F(p)=pi*ci is calculated as followed:
if p(1)=1 then ci is calculated from a sequence of equations because F describes the life cycle cost of a specific design. The same for every p(i). I could calculate the ci for every case and have something like Fi=ci*pi the problem is that there are so many cases and it is computational impossible with the optimisation and also it is not very smart. Do you have any idea how this could happen. Because I tried in the objective function file to put if p(1)==0 then the files that end up calculating the ci but matlab does not accept it.
Thank you very much in advance.
Nicky
0 个评论
采纳的回答
Torsten
2017-5-12
If the pi's are binary and p(1)+p(2)+...+p(n)=1, then there are only n cases to consider as possible solutions.
So just calculate F(p) for these n cases and choose the one with minimum cost. Using an optimization routine will always be slower for this simple problem.
Best wishes
Torsten.
6 个评论
Torsten
2017-5-12
The general structure of the objective function routine could be like
function cost = objfun(x)
p=x(1:10);
k=x(11:20);
...
if p(1)==0 && k(1)==0
cost = ...;
else if ...
cost = ...;
else if ...
cost = ...;
end if
To determine "cost" for the different cases, you can call other functions.
Do not include the function files here.
Best wishes
Torsten.
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surrogate Optimization 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!