필터 지우기
필터 지우기

How to added a “if statement” to constraints of matlab linear minimization

조회 수: 4 (최근 30일)
scully2014
scully2014 2016년 8월 12일
답변: Alan Weiss 2016년 8월 12일
I have a typical linear min problem in matlab. x = linprog(f,A,b,Aeq,beq,lb,ub,x0,options) However, two of the optimization variables x3 and x4 are related this way.
If 0 <x3<20, x4=2*x3; Elseif 20 <x3<40, x4=3*x3; Else x4=4*x3;
How to add the "if condition" in the constraints? or which solver i should use
Thank you,

답변 (1개)

Alan Weiss
Alan Weiss 2016년 8월 12일
I would solve three problems. For one, put bounds 0 <= x3 <= 20 and set x4 = 2*x3. For another, put bounds 20 <= x3 <= 30 and x4 = 3*x3. For the last, put a bound 40 <= x3 and x4 = 4*x3. Look at the smallest resulting function value, and then you have the solution to your problem.
Alan Weiss
MATLAB mathematical toolbox documentation

카테고리

Help CenterFile 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!

Translated by