Optimization function based on different domain of optimized variables

Hello,
I have an linear objective function f(x1,x2,x3.. ) which is defined for a fixed domain of x1 say x1< (constant k). Also the objective function changes to g(x1,x2,x3 ... ) if x1> (constant k). The objective function in both the cases is linear. x1,x2,x3 are the optimization variables. There are set of other equality and inquality constraints on the other variables.
I was trying to solve this optimization problem using linprog .
How can I switch the optimization function based on the domain of x1? Can I iterate over the current value of x1 and check if it is less than that constant in 'linprog' solver and accordingly select the optimization function f or g?

 采纳的回答

Matt J
Matt J 2020-11-26
编辑:Matt J 2020-11-26
Solve the problem twice, once with the constraint x1<=k and once with x1>=k, imposing the appropriate objective function in each case. Whichever of the solutions gives the best objective function value wins.

1 个评论

Okay.. Thank you for the reply.
I asked this because I was just wondering if there was any other more succint way of doing this instead of writing the same constraints x2,x,3...etc ( which don't affect the objective functions ,being the same for both f and g) as many times as the different domains of the constraint x1 specified.

请先登录,再进行评论。

更多回答(0 个)

类别

在 帮助中心 和 File Exchange 中查找有关 Nonlinear Optimization 的更多信息

产品

版本

R2019a

标签

Community Treasure Hunt

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

Start Hunting!

Translated by