How to solve 'User supplied objective function must return a scalar value' in fmincon?

조회 수: 3 (최근 30일)
Hello. I have done power flow calculation. After power flow calculation, I got Losses in the line which is (131x96) matrix. This matrix I have used as an objective value to optimize losses. The objective value is like below,
AC_DC_losses=abs(LineLosses); ----- (131x96) matrix.
When I optimize with fmincon, it shows the error like, 'User supplied objective function must return a scalar value'. I am understanding the problem. Is this the problem because the objective value is (131x96) matrix. Could anyone give me suggestion regarding this?
Thanks in advance.
  댓글 수: 1
Walter Roberson
Walter Roberson 2018년 1월 27일
You have multiple outputs. What are you trying to optimize:
  • minimize total losses?
  • minimize median loss?
  • minimize standard deviation of losses?
  • find a set of losses such that it is not possible to lower any one of them without raising at least one other of them? ("Pareto front")

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

답변 (2개)

Walter Roberson
Walter Roberson 2018년 1월 28일
To minimize total losses your output should be
AC_DC_losses = sum(abs(LineLosses(:)));

Arifur Rahman
Arifur Rahman 2018년 1월 27일
I have to minimize total losses. @Walter Roberson

카테고리

Help CenterFile Exchange에서 Multiobjective Optimization에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by