I have only non-linear eqality constraints

2 次查看(过去 30 天)
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