Optimization problem with lower and upper bounded constraints

1 view (last 30 days)
maximize:x0.063x4x7 5.04x1 0.035x2 10x3 3.36x5
subject to: x5 = 1.22x4 x1
x6 = (98000 x3x4)/(x9 + 1000x3)
x8 = (x2 + x5)/x1
(99/100)x4 x1(1.12 + 0.13167x8 0.00667x28) (100/99)x4
(99/100)x7 86.35 + 1.098x8 0.038x28 + 0.325(x6 89) (100/99)x7
(9/10)x9 35.82 0.222x10 (10/9)x9
(99/100)x10 ≤−133 + 3x7 (100/99)x10
[0,0,0,0,0,85,90,3,0.01,145] x
x[2000,16000,120,5000,2000,93,95,12,4,162]
How do I represent constraints 4 through 6? This is what i have so far:
clc; clear
x = optimvar('x',10,'UpperBound',[2000;16000;120;5000;2000;93;95;12;4;162],"LowerBound",[0;0;0;0;0;85;90;3;0.01;145]);
prob = optimproblem("Objective",0.063*x(4)*x(7)-5.04*x(1)-0.035*x(2)-10*x(3)-3.36*x(5),"ObjectiveSense","maximize")
prob.Constraints.c1 = x(5) == 1.22*x(4)-x(1);
prob.Constraints.c2 = x(6) == 9800* x(3)/(x(4)*x(9)+1000*x(3));
prob.Constraints.c3 = x(8) == (x(2)+x(5))/x(1);
show(prob)

Accepted Answer

Walter Roberson
Walter Roberson on 1 Dec 2021
clc; clear
x = optimvar('x',10,'UpperBound',[2000;16000;120;5000;2000;93;95;12;4;162],"LowerBound",[0;0;0;0;0;85;90;3;0.01;145]);
prob = optimproblem("Objective",0.063*x(4)*x(7)-5.04*x(1)-0.035*x(2)-10*x(3)-3.36*x(5),"ObjectiveSense","maximize")
prob =
OptimizationProblem with properties: Description: '' ObjectiveSense: 'maximize' Variables: [1×1 struct] containing 1 OptimizationVariable Objective: [1×1 OptimizationExpression] Constraints: [0×0 struct] containing 0 OptimizationConstraints See problem formulation with show.
prob.Constraints.c1 = x(5) == 1.22*x(4)-x(1);
prob.Constraints.c2 = x(6) == 9800* x(3)/(x(4)*x(9)+1000*x(3));
prob.Constraints.c3 = x(8) == (x(2)+x(5))/x(1);
prob.Constraints.c4 = (99/100)*x(4) <= x(1)*(1.12 + 0.1367*x(8) - 0.00667*x(2)*x(8));
prob.Constraints.c5 = x(1)*(1.12 + 0.1367*x(8) - 0.00667*x(2)*x(8)) <= (100/99)*x(4);
prob.Constraints.c6 = (99/100)*x(7) <= 86.35 + 1.098*x(8) - 0.038*x(2)*x(8) + 0.325*(x(6)-89);
prob.Constraints.c7 = 86.35 + 1.098*x(8) - 0.038*x(2)*x(8) + 0.325*(x(6)-89) <= (100/99)*x(7);
show(prob)
OptimizationProblem : Solve for: x maximize : 0.063*x(4)*x(7) - 5.04*x(1) - 0.035*x(2) - 10*x(3) - 3.36*x(5) subject to c1: x(1) - 1.22*x(4) + x(5) == 0 subject to c2: x(6) == ((9800 .* x(3)) ./ ((x(4) .* x(9)) + (1000 .* x(3)))) subject to c3: x(8) == ((x(2) + x(5)) ./ x(1)) subject to c4: (0.99 .* x(4)) <= (x(1) .* ((1.12 + (0.1367 .* x(8))) - ((0.00667 .* x(2)) .* x(8)))) subject to c5: (x(1) .* ((1.12 + (0.1367 .* x(8))) - ((0.00667 .* x(2)) .* x(8)))) <= (1.0101 .* x(4)) subject to c6: (0.99 .* x(7)) <= (((86.35 + (1.098 .* x(8))) - ((0.038 .* x(2)) .* x(8))) + (0.325 .* (x(6) - 89))) subject to c7: (((86.35 + (1.098 .* x(8))) - ((0.038 .* x(2)) .* x(8))) + (0.325 .* (x(6) - 89))) <= (1.0101 .* x(7)) variable bounds: 0 <= x(1) <= 2000 0 <= x(2) <= 16000 0 <= x(3) <= 120 0 <= x(4) <= 5000 0 <= x(5) <= 2000 85 <= x(6) <= 93 90 <= x(7) <= 95 3 <= x(8) <= 12 0.01 <= x(9) <= 4 145 <= x(10) <= 162
and so on.
I had to guess about what x28 was; I coded it as x(2)*x(8)
  2 Comments
Anthony Sirico
Anthony Sirico on 1 Dec 2021
Sorry its x^2...so did you break each of them up into 2 separate constraints?
Walter Roberson
Walter Roberson on 1 Dec 2021
Yes, split the range inequality into two inequalities.
The x28 cannot be x^2 because x is a vector. Perhaps it is a clumsy x(8)^2

Sign in to comment.

More Answers (0)

Products


Release

R2021a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!