Constrained optimization of a vector

조회 수: 5 (최근 30일)
mahdi Izadi
mahdi Izadi 2022년 5월 24일
댓글: Walter Roberson 2022년 5월 25일
Hi!
I am trying to optimize a vector. I want to find , where ()=0, and .
f_1 and f-2 are two procedural functions, stored in m-files (not straight-forward functions).
How can I do it with a viable (time-effective) algorithm?
Thanks!

채택된 답변

Walter Roberson
Walter Roberson 2022년 5월 24일
Use fmincon. Make the objective f1^2 and use a nonlinear equality constraint with f2.
  댓글 수: 4
mahdi Izadi
mahdi Izadi 2022년 5월 25일
Dear Walter;
Thanks so much;
Your suggestion makes the work done;
However the algorithm is excrucietinly slow. (My vector has 100 of elements,) It takes 130 seconds roughly and the problem is that it is inside a loop that should work for more that 1000 iterations...
Is it possible to expedite this solver? I tried a better initial guess and it didn't work. I also tried different algorithms , SQP, iterative, ... but no improvement made in the speed.
Best regards
Mahdi
Walter Roberson
Walter Roberson 2022년 5월 25일
It depends what the calculations do. In particular, are there analytic forms of the jacobian? Possibly a sparse form? fmincon needs to estimate the gradient of every variable against every other variable, and if you have hundreds of variables that can get slow.

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

추가 답변 (1개)

Matt J
Matt J 2022년 5월 24일
편집: Matt J 2022년 5월 24일
You have two equations so, as long as numel(a)=2 and f1 and f2 are differentiable, you can use fsolve. If numel(a)>2 then you have more unknowns than equations and the problem is ill-posed.
  댓글 수: 1
mahdi Izadi
mahdi Izadi 2022년 5월 25일
Dear Matt;
Thanks;
I believe I explained a bit unclear. The problem is somehow OK, as I think the solution proposed above adressed this problem.

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

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

제품


릴리스

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by