필터 지우기
필터 지우기

constrained maximization, share variables of tagret function and constraint

조회 수: 2 (최근 30일)
dominik
dominik 2014년 1월 31일
댓글: dominik 2014년 1월 31일
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
dominik
dominik 2014년 1월 31일
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 2014년 1월 31일
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.

댓글을 달려면 로그인하십시오.

채택된 답변

Amit
Amit 2014년 1월 31일
편집: Amit 2014년 1월 31일
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:

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Quadratic Programming and Cone Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by