필터 지우기
필터 지우기

How to constrain fmincon unknowns to itself

조회 수: 2 (최근 30일)
somebody
somebody 2021년 10월 28일
댓글: somebody 2021년 10월 31일
I am attempting to use fmincon to solve a problem of multiple unknowns.
unknowns = fmincon(@(x)fun(x),initial,[],[],[],[],lb,ub)
I need four of the unknowns to be constrained such that
(unknowns(1) + unknowns(2)) < (unknowns(3) + unknowns(4))
I cannot hardcode this constraint into the upper and lower bounds of the problem, I was wondering if there was a way to implement it with the other options / nonlinear constraints?
Thanks for any input.

채택된 답변

Alan Weiss
Alan Weiss 2021년 10월 29일
Or maybe with linear constraints:
A = [1 1 -1 -1];
b = 0;
unknowns = fmincon(@(x)fun(x),initial,A,b,[],[],lb,ub)
What do the A and b arguments represent? Let x represent your unknowns argument.
A*x <= b
x(1) + x(2) -x(3) -x(4) <= 0
x(1) + x(2) <= x(3) + x(4)
unknowns = fmincon(@(x)fun(x),initial,[],[],[],[],lb,ub)
Alan Weiss
MATLAB mathematical toolbox documentation

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by