Effacer les filtres
Effacer les filtres

constrained maximization, share variables of tagret function and constraint

2 vues (au cours des 30 derniers jours)
dominik
dominik le 31 Jan 2014
Commenté : dominik le 31 Jan 2014
I want maximize a function f(x) s.t. nonlinear cosntraints c(x). Both the function f(x) and c(x) contain a computation step g(x), which is very time consuming.
How can i avoid doing the same computation twice at each step of tha maximization loop? (Once when the constraints are evaluated, once when the taget function is evaluated)?
  2 commentaires
dominik
dominik le 31 Jan 2014
Another way to ask is: can i put the target function and the constraints vector in the same function or do something equivalent.
Amit
Amit le 31 Jan 2014
Can you post your problem. If not the code, atleast some description of f(x), c(x) and g(x). Without that its very hard to comment on solving the issue.

Connectez-vous pour commenter.

Réponse acceptée

Amit
Amit le 31 Jan 2014
Modifié(e) : Amit le 31 Jan 2014
Yes. You can. You can use nested functions to utilize g(x) without calculating twice. Nested functions share the variable.
See this post with a similar question:
  1 commentaire
dominik
dominik le 31 Jan 2014
Many thanks! I didnt know the problem structure, that should work!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Quadratic Programming and Cone Programming 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!

Translated by