is the selected solution the optimal one?

linprog always selects the lower limits (zero) for the last two variables and the upper limit for the second variable. However, the values should not be zeros.
question2: how can i visualize the feasible region, plotting the constraints?
objfunc.Constraints.econs1 = var1 + var2 == vector(i);
objfunc.Constraints.cons1 = var1 + var2 <= var3;
objfunc.Constraints.cons2 = var5 >= 3 * var4;
f= [49.1 49.1 98 577 1306];
vector=[950;1200;2000;20000];
for i=1:length(vector)
A= [1 1 -1 0 0
0 0 0 -3 1]
b= [0 0]
Aeq=[1 1 0 0 0]
beq=vector(i)
lb=[0;0;0;0;0]
ub=[25112; 1255; 25112-0.05*25112; 1255; 3*1255]
options = optimoptions('linprog','Algorithm','dual-simplex','Display','iter');
[x,fval,exitflag,output,lambda] = linprog(f,A,b,Aeq,beq,lb,ub,options)
X{i,1}=x
FVAL{i,1}=fval + 580
end

4 Comments

Why shouldn't the last two be 0? 0 is within bounds and satisfies the constraints?
You have 5 independent variables. To visualize just the constraints you need a 5 dimensional plot. If you want the result of f at each point you need to add another dimension.
People who are skilled at visualizing hyperdimensional objects tend to have their own preferences as to how they prefer to have plots presented. What kind of 6 dimensional plot works best for you?
Thanks for the reply.
zero is physically not an acceptable solution. then how can i improve my problem formulation to maximize the last two variables instead
lb=[0;0;0;0;0]
tells it that 0 is acceptable. If 0 is not acceptable change the appropriate lb entry to hold the smallest acceptable value such as eps(realmin) which technically is not 0. However if the rejection is for physical reasons perhaps you should use the planck distance or 1/avagadro's number or whatever value corresponds to one quanta

Sign in to comment.

Answers (0)

Asked:

on 13 Mar 2021

Commented:

on 13 Mar 2021

Community Treasure Hunt

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

Start Hunting!