I have only non-linear eqality constraints

2 views (last 30 days)
rambiz
rambiz on 26 Jan 2015
Answered: Alan Weiss on 26 Jan 2015
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.

Answers (2)

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

Alan Weiss
Alan Weiss on 26 Jan 2015
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

Categories

Find more on Systems of Nonlinear Equations in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!