Azzera filtri
Azzera filtri

can we create other function to call the constraint function or create gradient of constraint function without input directly from other source in fmincon?

1 visualizzazione (ultimi 30 giorni)
Dear sir,
I have worked with fmincon when i try to input the gradient of constraint function it's okay when it was small problem but if in the big problem case, can we create other function to call the gradient of constraint function by no need to input it manually ?
thank you sir,i am sorry if make you difficult to understand with my poor english.
Best Regards!

Risposta accettata

Walter Roberson
Walter Roberson il 27 Mag 2015
When you use matlabFunction() to create your gradient from symbolic form, tell matlabFunction to write the result to a file. See Write Generated MATLAB Function to File
  1 Commento
Chantrea Lean
Chantrea Lean il 27 Mag 2015
as we have this problem:
function [c,ceq,DC,DCeq] = confungrad(x)
c(1) = 1.5 + x(1) * x(2) - x(1) - x(2); % Inequality constraints
c(2) = -x(1) * x(2)-10;
% No nonlinear equality constraints
ceq=[]; % Gradient of the constraints: if nargout > 2
DC= [x(2)-1, -x(2);
x(1)-1, -x(1)];
DCeq = [];
end
for the analytic gradient of constraint function DC.so can we call that value from other function without input manually like this?

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Argument Definitions in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by