I have only non-linear eqality constraints

2 visualizaciones (últimos 30 días)
rambiz
rambiz el 26 de En. de 2015
Respondida: Alan Weiss el 26 de En. de 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.

Respuestas (2)

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

Alan Weiss
Alan Weiss el 26 de En. de 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

Categorías

Más información sobre Solver Outputs and Iterative Display en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by