Global Search optimization error

조회 수: 1 (최근 30일)
Giorgos Papakonstantinou
Giorgos Papakonstantinou 2013년 1월 23일
I am trying to run a global search optimization in order to minimize a function. When I run it, I receive the following error:
Warning: Matrix is singular, close to
singular or badly scaled. Results may
be inaccurate. RCOND = NaN.
> In qpsub>eqnsolv at 953
In qpsub at 157
In nlconst at 619
In fmincon at 837
In C:\Program Files\MATLAB\R2012b\toolbox\globaloptim\globaloptim\private\globalsearchnlp.p>i_runLocalSolver at 684
In C:\Program Files\MATLAB\R2012b\toolbox\globaloptim\globaloptim\private\globalsearchnlp.p>globalsearchnlp at 292
In GlobalSearch>GlobalSearch.run at 327
In opt_model_ms at 52
Do you have any idea why is this happening? My function is well defined. On the other hand it has 6 variables, which could be difficult for global search to find the minimum. I could also post the function here if you need more information?
  댓글 수: 1
Walter Roberson
Walter Roberson 2013년 1월 23일
Yes, please post your code.

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

채택된 답변

Giorgos Papakonstantinou
Giorgos Papakonstantinou 2013년 1월 23일
편집: Giorgos Papakonstantinou 2013년 1월 27일
Thank you Alan for the numerous times that you have tried to answer my questions. Well I tried your suggestion but again results in the following error:
Error using -
Matrix dimensions must agree.
Error in C:\Program
Files\MATLAB\R2012b\toolbox\globaloptim\globaloptim\private\globalsearchnlp.p>i_calcConstrViolation
(line 598)
Error in C:\Program
Files\MATLAB\R2012b\toolbox\globaloptim\globaloptim\private\globalsearchnlp.p>i_calcPenalty
(line 627)
Error in C:\Program
Files\MATLAB\R2012b\toolbox\globaloptim\globaloptim\private\globalsearchnlp.p>globalsearchnlp
(line 343)
Error in GlobalSearch/run (line 327)
[x,fval,exitflag,output,solutionSet]
= ...
Error in opt_model_ms (line 52)
[xmin, pmin, exitflag, output,
manymins]=run(gs,problem);
  댓글 수: 1
Alan Weiss
Alan Weiss 2013년 1월 23일
Perhaps your line
Aeq(2,6)=zeros;
should be
Aeq = zeros(2,6);
Also, I notice that you are integrating a function symbolically inside your function, then converting the answer to numeric. This is bound to be slow. It would probably be better to get a symbolic expression for the integral (if one exists) and use matlabFunction to give you a function handle or file for numeric computation. If there is no closed form symbolic expression for the integral, then I recommend you use a numeric integrator in MATLAB such as integral or quadgk.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

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

추가 답변 (3개)

Giorgos Papakonstantinou
Giorgos Papakonstantinou 2013년 1월 23일
편집: Giorgos Papakonstantinou 2013년 2월 3일
Thank you Walter for interest

Alan Weiss
Alan Weiss 2013년 1월 23일
The warning indicates that you are using the fmincon active-set algorithm. The first thing I would try is to use the interior-point algorithm. Then the sqp algorithm. See the documentation for details.
To choose the fmincon algorithm using GlobalSearch, see the documentation. For just this option:
opts = optimset('Algorithm','interior-point');
problem = createOptimProblem('fmincon','options',opts);
Obviously, you will have other things in your problem structure, I just wanted to show you how to include the options to change the algorithm.
Alan Weiss
MATLAB mathematical toolbox documentation

Giorgos Papakonstantinou
Giorgos Papakonstantinou 2013년 1월 23일
Thank you Alan. The optimization is now running. What I notice thought is that many of the optimized variables are forced to the boundaries.
One answer to that could be that the optimum is indeed in the boundaries. On the other hand it could be that I don't optimize correctly.
Do you have any what could be the case?
  댓글 수: 2
Matt J
Matt J 2013년 1월 23일
Either could be the case, but there is no reason to doubt the solution just because it lies at the boundaries.
Alan Weiss
Alan Weiss 2013년 1월 24일
You could also try some of the suggestions in the documentation for how to check whether your answer is indeed an optimum.
If you feel that I have sufficiently answered your questions, please accept the appropriate answer.
Alan Weiss
MATLAB mathematical toolbox documentation

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

카테고리

Help CenterFile Exchange에서 Linear Least Squares에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by