필터 지우기
필터 지우기

Optimization problem gets stuck before going into solver

조회 수: 7 (최근 30일)
Filippos
Filippos 2023년 11월 20일
댓글: Nima 2023년 11월 28일
I have defined my constraints and objective function for my optimization problem and I have selected fmincon as the solver using the command
opt = optimoptions('fmincon', 'MaxIterations', 1000, 'Algorithm', 'sqp');
However, the command window does even show the classical message "Solving problem using fmincon" after 30 minutes. So I think that matlab gets stuck even before that. Meanwhile the system is under "busy" condition. Then, when I stop it manually I get the following error:
Operation terminated by user during optim.internal.problemdef.visitor.CompileNonlinearFunction/getArgumentName In optim.internal.problemdef.visitor.CompileReverseADReversePass/getParentJacArgumentName In optim.internal.problemdef.visitor.CompileReverseADReversePass/visitOperatorTimes In optim.internal.problemdef.Times/acceptVisitor In optim.internal.problemdef.visitor.CompileReverseADReversePass/visitBinaryExpressionImpl In optim.internal.problemdef.BinaryExpressionImpl/acceptVisitor In optim.internal.problemdef.visitor.CompileReverseADReversePass/visitTree In optim.internal.problemdef.visitor.CompileReverseADReversePass/visitForest In optim.internal.problemdef.ExpressionForest/compileReverseAD In optim.problemdef.OptimizationExpression/compileReverseAD In optim.internal.problemdef.compile.compileNonlinearExprOrConstrWithAD In optim.internal.problemdef.compile.compileNonlinearObjective In optim.problemdef.OptimizationProblem/compileObjectives In optim.internal.problemdef.ProblemImpl/prob2structImpl In optim.internal.problemdef.ProblemImpl/solveImpl In optim.problemdef.OptimizationProblem/solve In routingGame (line 92) sol = solve(sysProb,x_init,'options',opt);
Does anybody have any idea?
Thanks in advance!
  댓글 수: 2
Torsten
Torsten 2023년 11월 20일
And setting
sol = solve(sysProb)
does not produce this behaviour ?
Nima
Nima 2023년 11월 28일
If this is happenning at the "define objective" step, I have exactly faced the same issue recently with the surrogate optimization. It takes quite a while until MATLAB gets to the "solve" step and I haven't found any solution for that yet.

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

답변 (1개)

Alan Weiss
Alan Weiss 2023년 11월 20일
It is apparent that solve is taking too long to calculate constraint derivatives using reverse-mode autodifferentiation. This might not happen in a new version of MATLAB, where internally there are smarter AD algorithms. However, you can lkely avoid this issue in all versions by turning off AD:
sol = solve(prob,ConstraintDerivative="finite-differences") % Maybe also ObjectiveDerivative="finite-differences"
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

카테고리

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

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by