Variable f coeffficient depends on x for linprog
2 次查看(过去 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!