Borrar filtros
Borrar filtros

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

4 visualizaciones (últimos 30 días)
Dalia ElNakib
Dalia ElNakib el 3 de Mayo de 2023
Editada: Torsten el 4 de Mayo de 2023
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 comentarios
Dalia ElNakib
Dalia ElNakib el 4 de Mayo de 2023
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 el 4 de Mayo de 2023
Editada: Torsten el 4 de Mayo de 2023
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.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Matrix Indexing en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by