solve optimization with constraints
Afficher commentaires plus anciens
I want to maximize an equation with 12 variables (The comment in code described the problem). I solved this by excel solver, but in matlab I dont know how to write the constraints. Below is my try:
% Maximize B = 3.9 X1 + 4.2 X2 + 4.2 X3 + 4.5 X4 + 4.1 X5 + 3.6 X6 + 3.1 X7
% + 2.7 X8 + 2.5 X9 + 2.6 X10 + 2.9 X11 +3.6 X12
%Subject to:
% S0 = 5;
% S(t-1) + I(t) - X(t) = S(t) (t =1,...,12) --> how to wirte this constraint?
% 1<= X(t) <= 7 (t = 1,...,12 )
% S(t) <= 10 (t = 1,...,12 )
f = [-3.9 -4.2 -4.2 -4.5 -4.1 -3.6 -3.1 -2.7 -2.5 -2.6 -2.9 -3.6];
lb=[1;1;1;1;1;1;1;1;1;1;1;1];
ub=[7;7;7;7;7;7;7;7;7;7;7;7];
I = [4 3 2 2 1 2 3 3 2 2 2 3];
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!