MatLAB linprog optimization function?
Show older comments
Hello everyone, I am currently trying to recreate the optimization presented in "Optimizing the distribution of Italian building energy retrofit incentives with Linear Programming" in MATLAB. The goal of the research is to propose an optimization-based methodology for the evaluation of retrofit incentives for different regions. However, I am struggling implementing the main part.

I am trying to do the optimization using the linprog command. Linprog requires a vector as objective function, however, to my understanding my objective function would be a matrix given the (5) equation. This is what I have so far.
A = Value.avg_cost;
At = A';
bt = Value.budget_ma;
b = Value.budget_ret;
l_b = zeros(1,5);
l_bt = zeros(1,5);
u_b = sum(Value.n');
u_bt = Value.N;
A = [A;A'];
b = [b bt];
l_b = [l_b l_bt];
u_b = [u_b u_bt];
f = -sum(Value.avg_sav);
x(:,c) = linprog(f,A,b,[],[],l_b,u_b);
Since I have two inequality constraints I have decided to make a big matrix out of them (A) and the relative vector (b), then I tried to develop a objective function f that was the sum of both rows and columns. s_ij correspond to avg_sav and a_ij to avg_cost, while b_i and b_j are budget_ma and budget_ret respectively. The l_b and u_b corresponds to the upper and lower boundaries of the variable x. Is it correctly formulated? Thank you in advance for the help!
Gianluca
Accepted Answer
More Answers (1)
Jose Emilio Loya
on 9 Dec 2020
0 votes
Hellow, can someone help me?
I am try to solve a transportation problem, but I´m having problems using the "lineprog" function.
I´m using this:
[xopt, fval] = linprog(lpp.f,lpp.A,lpp.b,[],[],lpp.lb);
and they show mw this:
'linprog' requires Optimization Toolbox.
Error in try1 (line 19)
[xopt, fval] = linprog(lpp.f,lpp.A,lpp.b,[],[],lpp.lb);
Im using the R202b version. thank you
1 Comment
Alan Weiss
on 10 Dec 2020
It sounds like you do not have OOptimization Toolbox installed. If you have a license for it, reinstall the toolbox.
Alan Weiss
MATLAB mathematical toolbox documentation
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!