Variable f coeffficient depends on x for linprog
조회 수: 1 (최근 30일)
이전 댓글 표시
I have a minimization problem and I wonder that if i can solve the problem with linprog or how can i solve within matlab framework?
E.g. f= [f(1) f(2)]; x = linprog(f,A,b,Aeq,beq);
In that problem i have variable f coefficient depend on x value. f(1)=0, if x(1)<0 / f(1)=50, if x(1)>0 .
How can i solve this minimization problem?
댓글 수: 5
Torsten
2022년 5월 27일
Sorry, but I don't see the equivalence of your original problem and the one you write above.
Even if they were: I don't understand why you choose such a complicated non-linear reformulation. The linear approach I suggested is simple and elegant if your f-vector only has non-negative entries.
답변 (2개)
Bruno Luong
2022년 5월 4일
Solve 2 problems
f= [0 f2]; x = linprog(f,A,b,Aeq,beq,lb1,up1); with lb1 = -inf(size(x)), up1 = zeros(size(x));
g= [50 f2]; x = linprog(g,A,b,Aeq,beq,lb2,up2); with lb2 = zeros(size(x)), up2 = inf(size(x));
Then pick the best solution
댓글 수: 2
Alan Weiss
2022년 5월 4일
I think that you can do what you want using binary indicator variables for each condition as described in Integer and Logical Modeling. This involves creating new binary variables and new constraints based on the Big-M formulation, and then using intlinprog to solve the resulting problem.
Alan Weiss
MATLAB mathematical toolbox documentation
Torsten
2022년 5월 4일
According to that some of x variables should be less than zero and some of them should be greter than zero. So, I think I need a combined solution.
Add new variables
y(i) (i=1,...,36)
and constraints
y(i) >= x(i)
y(i) >= 0
and define the objective as
f_con*y
For the interpretation:
y(i) = max(x(i),0)
댓글 수: 4
Torsten
2022년 5월 7일
편집: Torsten
2022년 5월 7일
My reformulation would be:
min: y1 - y2
x1 + x2 = 1
y1 >= x1
y2 >= x2
y1 >= 0
y2 >= 0
This problem is also unbounded :
y1 = 0, y2 = +Inf, x1 = 0, x2 = 1
But I didn't think in depth if this reformulation is always correct if f has negative components.
Maybe one can find a counterexample.
Bruno Luong
2022년 5월 7일
편집: Bruno Luong
2022년 5월 7일
I guess you get an idea, if I change A and b to
A = (-1,0)
b = 10;
(x >= -10 if you will) and keep the rest identical,
now your problem is unbounded and the original problem is not. Fact is the halfspace { x1 <= 0 } won't be capture by you refomulation by working on other half-space halfspace { x1 >= 0 } alone.
참고 항목
카테고리
Help Center 및 File Exchange에서 Solver-Based Optimization Problem Setup에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!