Conditional Optimization problem: inf and NaN
    조회 수: 5 (최근 30일)
  
       이전 댓글 표시
    
Hi guys, I am doing a conditional optimization procedure. My problem is that it says:
'fmincon cannot continue: user function is returning Inf or NaN values.'
Apparently my user function returns a Inf, or NaN! Is there a way to avoid this issue? I am running the optimization 1000 times at once, but it is pretty frustrating when it fails on the half-way!
I tried FunValCheck 'on' without luck.
The fmincon looks: fmincon(@(varrho) nlobj(varrho,...,...),...,...)
The objective function is nlobj. I need to minimize it to catch the 5x1 parameter vector "varrho". nlobj returns a scalar and the gradient of it returns a 5x1 vector. I believe these are NaN or Inf. Is there a way to convert these to, say nlobj=5 and gradient=[5 5 5 5 5]' ?
Or probably this not the best way of doing it ?
hope to hear from someone. Thank in advance and have a good day,
-Martin Bergholt
댓글 수: 0
답변 (4개)
  Yao Li
      
 2013년 5월 14일
        Try other initial values and adjust the tolerance by implementing optimoptions()
  Shashank Prasanna
    
 2013년 5월 14일
        댓글 수: 3
  Shashank Prasanna
    
 2013년 5월 14일
				How you wish you take care of inf and nan is up to you. It is your objective function and it depends on your problem and what you are trying to optimize.
If you don't know how, I'd recommend trying my second suggestion, changing the solver. Some solvers are capable of handling infs and nans.
  Shashank Prasanna
    
 2013년 5월 15일
				Martin, you may have to provide us with your nlobj to understand how we can modify it to not return inf or nan.
  Martin
 2013년 5월 15일
        댓글 수: 2
  Shashank Prasanna
    
 2013년 5월 15일
				Martin, please reply as a comment to an existing answer instead of creating a new answer which is really a comment. This makes it easier to track the right answer.
참고 항목
카테고리
				Help Center 및 File Exchange에서 Graphics Performance에 대해 자세히 알아보기
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!