MATLAB Answers


Constraint of optimization problem

Asked by Brenda Aldaz on 11 Jul 2019
Latest activity Commented on by Matt J
on 12 Jul 2019
I am really desperate and I wish you can help me
I need to optimize (maximize) the function:
where the variables are w1, w2, w3, w4, w5 y w5 and a1, a2, a3, a4, a5 and a6 are constants
The Constraints are:
prob.Constraints.cons1 = w1+w2+w3+w4+w5+w6 == 1;
prob.Constraints.cons2 = w1>= 0;
prob.Constraints.cons3 = w2>= 0;
prob.Constraints.cons4 = w3>= 0;
prob.Constraints.cons5 = w4>= 0;
prob.Constraints.cons6 = w5>= 0;
prob.Constraints.cons7 = w6>= 0;
prob.Constraints.cons8 = y1;
where vector is a 1000-by-1 vector and r=100
The problem is that the sort function doesn't work with optimization variable
Do you know if it is possible to optimize with coinstraints like that?


Sign in to comment.

1 Answer

Answer by Matt J
on 11 Jul 2019
Edited by Matt J
on 11 Jul 2019
 Accepted Answer

It's the wrong solver. You would need to use ga() for a problem like that.


That function works very well!!
Matt J
on 12 Jul 2019
You're welcome, but since it worked, please Accept-click the answer.

Sign in to comment.