linear programming optimization equality constraints

hello, i am trying to do linear programming. and i am trying to find the minimum of my objective function.
i have attached the code. and my problem statement is also attached. i keep getting error for my equality constraints i tried every possible way known to me to solve. still couldn't fix it if anyone could suggest a way, it would be really helpful thank you

8 件のコメント

Matt J
Matt J 2018 年 2 月 14 日
The problem in your problemstatement.txt is pretty absurd (so I'm wondering if there is a mistake). The objective function is constant over the constrained region, so all feasible points (if any exist) are optimal.
anu vru
anu vru 2018 年 2 月 14 日
how exactly is it absurd?? i have a function to minimize my coefficients change over a period of time.
anu vru
anu vru 2018 年 2 月 14 日
編集済み: anu vru 2018 年 2 月 14 日
"Are you solving a separate sub-problem for every pv(i), pw(i), l(i) or something else?"
Yes
I need X(i) for every value of PV(I) PW(I) and l(I)
For the second part... I need to do (PV+pw-L) this is my objective...but my L is constant..I cannot vary that....for that that L I need values for Pv and PW...such that pv+pw-L=0 or atleast close to Zero
Matt J
Matt J 2018 年 2 月 14 日
In your problem statement document, pv, pw, and L appear to be scalars, yet in your code they are vectors. You need to help us reconcile that. Are you solving a separate sub-problem for every pv(i), pw(i), l(i) or something else?
In any case, the problem as written is absurd because as I said, all choices of x(1) and x(2) are equally optimal. Your constraint
(pv*x(1)+pw*x(2))=L
assures that the objective function
f(x)=(pv*x(1)+ pw*x(2))
is a constant f(x)=L over all feasible x.
Matt J
Matt J 2018 年 2 月 14 日
編集済み: Matt J 2018 年 2 月 14 日
For the second part... I need to do (PV+pw-L) this is my objective...
What happened to the x(i)'s?
but my L is constant..I cannot vary that....for that that L I need values for Pv and PW...such that pv+pw-L=0 or atleast close to Zero
You need Pv and PW? But in your code, they are given constants!
anu vru
anu vru 2018 年 2 月 14 日
Well, I need the X values which will make my pv+pw-L=0...
I need the X values for Pv and PW... And I am pretty sure my code doesn't consider them as constants
Matt J
Matt J 2018 年 2 月 14 日
編集済み: Matt J 2018 年 2 月 14 日
Well, I need the X values which will make my pv+pw-L=0...
There are no X values appearing anymore in the expression pv+pw-L. Are we still talking about pv*x(1)+pw*x(2)-L=0?
Similarly, is the objective still f(x) = pv*x(1)+pw*x(2) ?
anu vru
anu vru 2018 年 2 月 14 日
Yes....I need the x

サインインしてコメントする。

 採用された回答

Matt J
Matt J 2018 年 2 月 14 日
編集済み: Matt J 2018 年 2 月 14 日

0 投票

for that that L I need values for x(1) and x(2)...such that pv*x(1)+pw*x(2)-L=0 or atleast close to Zero
The above is a a version of what you said here with corrections added by me based on your later comments.
If the whole point is really to minimize |pv*x(1)+pw*x(2)-L| subject to bounds on x, then you should really be using lsqlin:
N=length(pv);
clear x
for i=N:-1:1
f=[pv(i) pw(i)];
[x{i} fval{i}]=lsqlin(f,l(i),[],[],[],[], [0.5,0.5],[2.5,2]);
end

3 件のコメント

anu vru
anu vru 2018 年 2 月 14 日
編集済み: Matt J 2018 年 2 月 14 日
yes its working now
also is a way i could get all the possible solutions?? for example
pv=1;pw=2 and L=4
therefore my x values can be x=[0 2] or x=[2 1] and more non integer answers. is there a possibility i can get all those values??
i have further analysis to do on it.
anu vru
anu vru 2018 年 2 月 14 日
"the trust region reflective algorithm requires at least as many equations as variables" It is showing this warning... Also how is using lsqlin better than linprog?
Matt J
Matt J 2018 年 2 月 14 日
編集済み: Matt J 2018 年 2 月 14 日
yes its working now
If so, please Accept-click the answer to certify that the question has been addressed.
The set of all possible solutions will typically be an infinite set of points satisfying the inequalities,
L-optimalValue <= pv*x1+pw*x2 <= L+optimalValue
lbv<= x(1) <=ubv
lbw<= x(2) <=ubw
You can find the vertices of this region using this package.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

質問済み:

2018 年 2 月 14 日

編集済み:

2018 年 2 月 14 日

Community Treasure Hunt

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

Start Hunting!

Translated by