I have only non-linear eqality constraints

조회 수: 2 (최근 30일)
rambiz
rambiz 2015년 1월 26일
답변: Alan Weiss 2015년 1월 26일
Hi every body, In order to solve an optimization problem, I am using the fmincon function. As you know fmincon is accepting non-linear constraints, which must be defined in another fuction, which we call here say, "nonLinearConstraints.m" . This fuction must be in the following form: [c,ceq]=nonLinearConstraints(x) . Now I have non-linear equality constraints(ceq) but no inequality constraints(c)! What shall I do? To be specific , I have some bounds on my variables, but I have already specified this bounds and no need to specify them again as non-linear inequalities.

답변 (2개)

A Jenkins
A Jenkins 2015년 1월 26일
Did you try making it empty?
For example:
function [c,ceq]=nonLinearConstraints(x)
c=[];
ceq=...

Alan Weiss
Alan Weiss 2015년 1월 26일
Nonlinear constraint functions must return both c and ceq, the inequality and equality constraint functions, even if they do not both exist. Return empty [] for a nonexistent constraint.
For example,
function [c,ceq]=ellipseparabola(x)
c(1) = (x(1)^2)/9 + (x(2)^2)/4 - 1;
c(2) = x(1)^2 - x(2) - 1;
ceq = [];
end
Alan Weiss
MATLAB mathematical toolbox documentation

카테고리

Help CenterFile Exchange에서 Systems of Nonlinear Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by