How can write code of multi objective functions with using optimproblem format?
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
S AsZ
el 1 de Dic. de 2019
How can I define functions of multi objective problem with optimproblem format? My mean is using problem based method not using solver based method. ?
For example I have this optimization model:
That this model has two objectives.
I want to write the code of this model with optomproblem.
So I attach my model as above:
prob.Objective = x(1) + 2*x(2);
But above formolation is for one objective function not multi objective problems.
But I have two objective function in my model and I don't know how can I coded them with this method ☹
3 comentarios
Star Strider
el 2 de Dic. de 2019
My pleasure.
That could help, providing your code is well-documented so we can understand what it does.
Respuesta aceptada
Walter Roberson
el 3 de Dic. de 2019
You cannot. Examine https://www.mathworks.com/help/optim/ug/problem-based-optimization-algorithms.html and observe that none of the algorithms are multi-objective . Or look at https://www.mathworks.com/help/optim/ug/optimproblem.html#d117e128953 and see that for problem based optimization, the objective must be scalar.
5 comentarios
Walter Roberson
el 3 de Dic. de 2019
Look at the example for problem2struct() .
%bunch of code
steelprob.Constraints.conswt = totalweight == 25;
steelprob.Constraints.conscarb = totalCarbon == 1.25;
steelprob.Constraints.consmolyb = totalMolyb == 1.25;
problem = prob2struct(steelprob);
Now
>> problem
problem =
struct with fields:
intcon: [5 6 7 8]
lb: [8×1 double]
ub: [8×1 double]
x0: []
f0: 0
f: [8×1 double]
solver: 'intlinprog'
Aineq: []
bineq: []
Aeq: [3×8 double]
beq: [3×1 double]
options: []
You would do the same thing for each of the optimproblem that you created. You would need to compare that lb contained the same thing for each, and that ub contained the same thing for each, and likewise Aineq and bineq and Aeq and beq and intcon . Then having verified that those were all the same, you would extract the common ones into variables
joint_A = problem.Aineq;
joint_b = problem.Bineq;
and so on
and you would extract the various f fields describing the objective functions and merge them together into one, that might look something like
joint_obj = @(x) [problem.f(x), problem2.f(x)];
I think you would be ending up with the same nonlcon for all of them rather than having to merge them
and then call
gamultiobj(joint_obj, length(joint_lb), joint_A, joint_b, joint_Aeq, joint_beq, joint_lb, joint_ub, joint_nlcon, joint_options)
Más respuestas (0)
Ver también
Categorías
Más información sobre Get Started with Optimization Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!