MatLAB linprog optimization function?
이전 댓글 표시
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
채택된 답변
추가 답변 (1개)
Jose Emilio Loya
2020년 12월 9일
0 개 추천
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
Alan Weiss
2020년 12월 10일
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
카테고리
도움말 센터 및 File Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!