failure in initial objective function evaluation
이전 댓글 표시
Hello,
I want to solve an optimization problem by Matlab fmincon function. I defined my objective function as:
function f = objfun(x,p1,p2)
x1=x(1:24);
y1=x(25:48);
z1=x(48:end);
f=-mean(x1*(p1)'+y1*(p2)')+mean(z1*(p1)')
end
p1,p2 are 1x24 vectors which are calculated in the main file. I need to find the optimum values for x1, y1 and z1 which are 1x24 vectors (total 72 variables).
When I run the main code I get an error message about the objective function and then for fmincon by failure in initial objective unction evaluation. caused
Would you please advise how can I solve the problem? Thanks a lot!
댓글 수: 2
Alan Weiss
2017년 9월 5일
Please show us your fmincon call, the complete copy-pasted error message, and the value of x0. The problem could be as simple as you having x0 as a row vector instead of a column vector, or p1 a row vector, but without seeing the inputs to the problem and the complete error message, we cannot know.
Alan Weiss
MATLAB mathematical toolbox documentation
Sara
2017년 9월 5일
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Choose a Solver에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!