Effacer les filtres
Effacer les filtres

unbounded in linear programming

4 vues (au cours des 30 derniers jours)
Mohammad
Mohammad le 14 Sep 2023
Modifié(e) : John D'Errico le 14 Sep 2023
Hay guys I'm trying to solve this problem using the linprog() function but it keeps telling that the problem is unbounded
%each type number of orders
syms x1 x2 x3 x4 x5 x6 ;
%profit margins for each type ($/vehicle)
m1=150; %Subcompact
m2=225; %Compact
m3=250; %Intermediate
m4=500; %Luxury
m5=400; %Truck
m6=200; %Van
%=========================================
%fuel constraint simplification
MPG=(40*x1 + 34*x2 + 15*x3 +12*x4 +20*x5 + 25*x6) -28*(x1 + x2 + x3 + x4 + x5 + x6); % >= 0
%Objective function
Rev=(m1*x1+m2*x2+m3*x3+m4*x4+m5*x5+m6*x6);
%========================================
%{The constraints:
%x1 + x2 + x3 + x4 + x5 + x6 <= 1,200,000
%x1 + x2 <= 620,000
%x3 + x4 <= 400,000
%x5 + x6 <= 275,000
% -12*x1 - 6*x2 + 13*x3 + 16*x4 + 8*x5 + 3*x6 <= 0
%}
A=[1 1 1 1 1 1;1 1 0 0 0 0;0 0 1 1 0 0;0 0 0 0 1 1;-12 -6 13 16 8 3];
b= [1200000;620000;400000;275000;0];
f=[-150 -225 -250 -500 -400 -200];
Aeq=[];
beq=[];
LB = [0;0];
%UB = [Inf; Inf]
UB = [];
[X,Z]=linprog(f,A,b,Aeq,beq,LB,UB);
Warning: Length of lower bounds is < length(x); filling in missing lower bounds with -Inf.
Problem is unbounded.
x=X
x = []
z=1*Z
z = []
  1 commentaire
Dyuman Joshi
Dyuman Joshi le 14 Sep 2023
If Rev is the objective function then what is f? And what is the use of MPG?
It's not clear from your code what you are solving for. Please attach the mathematical formulation of the problem you are trying to solve.

Connectez-vous pour commenter.

Réponses (1)

John D'Errico
John D'Errico le 14 Sep 2023
Modifié(e) : John D'Errico le 14 Sep 2023
First, read the warning message!
"Warning: Length of lower bounds is < length(x); filling in missing lower bounds with -Inf."
You gave only TWO lower bounds. But you have 6 unknowns. So MATLAB tells you the lower bounds it will employ are:
LB = [0 0 -inf -inf -inf -inf];
The upper bounds will all be +inf. Warning messages are used to tell you important information. Read them. Think about what they tell you.
Given that, I would not be at all suprised if your problem is indeed unbounded. If instead, I supply a complete set of lower bounds, the problem does indeed have a solution.
A=[1 1 1 1 1 1;1 1 0 0 0 0;0 0 1 1 0 0;0 0 0 0 1 1;-12 -6 13 16 8 3];
b= [1200000;620000;400000;275000;0];
f=[-150 -225 -250 -500 -400 -200];
Aeq=[];
beq=[];
LB = zeros(1,6);
UB = [];
[X,Z]=linprog(f,A,b,Aeq,beq,LB,UB)
Optimal solution found.
X = 6×1
560000 60000 0 305000 275000 0
Z = -360000000

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by