To know the Exact Code Please To Run this Example: (optimization linprog)

2 次查看(过去 30 天)
Dear Eng.
I'm trying to solve this attached problem as Assignment using linprog Code
Then it will be solved through:
h(1) = 0.6
h(2) =0.8
h(3) =1
g(1) =0.1
g(2) =0.2
g(3) =0.3
C Matrix
C = [1
1
1]
A Matrix (3*3)
A= [h(1) - g(1)h(2) -g(3)h(3)
-g(2)h(1) h(2) -g(2)h(3)
-g(3)h(1) -g(3)h(2) h(3)]
b Matrix
b = [0
0
0]
Assuming Values for h's and Gamma's as shown above
Do you think we'll need Upper limit and Lower Limit for this example?
I need the correct Matlab Linprog Code to run please?
Thanks alot for your cooperation
I
  7 个评论
Dalia ElNakib
Dalia ElNakib 2023-5-4
h(1) = 0.6;
h(2) = 0.8;
h(3) = 1;
g(1) = 0.1;
g(2) = 0.2;
g(3) = 0.3;
%c Matrix
c = [1; 1; 1];
%A Matrix (3*3)
A = [h(1) -g(1)*h(2) -g(3)*h(3);-g(2)*h(1) h(2) -g(2)*h(3);-g(3)*h(1) -g(3)*h(2) h(3)];
%b Matrix
b = [0; 0 ;0];
%Bound constraint
lb = [0.0000003; 0.0000003; 0.0000003];
ub = [1000 ;1000 ;1000];
%Solve
p = linprog(c,A,b,[],[],lb,ub);
Optimal solution found.
Torsten
Torsten 2023-5-4
编辑:Torsten 2023-5-4
No, my code from above was correct (using -A and -b).
I only wanted to point out that for linprog, it's necessary to pass -A and -b because the inequality is reversed compared to your problem formulation.

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by