is the selected solution the optimal one?
Show older comments
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
Walter Roberson
on 13 Mar 2021
Why shouldn't the last two be 0? 0 is within bounds and satisfies the constraints?
Walter Roberson
on 13 Mar 2021
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?
Housam
on 13 Mar 2021
Walter Roberson
on 13 Mar 2021
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
Answers (0)
Categories
Find more on Solver Outputs and Iterative Display in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!