I have only non-linear eqality constraints
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
0 commentaires
Réponses (2)
A Jenkins
le 26 Jan 2015
Did you try making it empty?
For example:
function [c,ceq]=nonLinearConstraints(x)
c=[];
ceq=...
0 commentaires
Alan Weiss
le 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
0 commentaires
Voir également
Catégories
En savoir plus sur Systems of Nonlinear Equations dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!