Using "quadprog" in function "optimoptions"

Hello,
I hope this is a legitimate question, unfortunately I am unable to attach the MATLAB files.
I am using in my code the function "optimoptions" in the following way:
opts = optimoptions('quadprog','Algorithm','interior-point-convex','OptimalityTolerance',1e-8,'ConstraintTolerance',1e-8);
and I recieve the following error:
Error using optimoptions (line 124)
Invalid solver specified. Provide a solver name or handle (such as 'fmincon' or @fminunc).
Type DOC OPTIMOPTIONS for a list of solvers.
Error in compute_NE (line 78)
opts = optimoptions('quadprog','Algorithm','interior-point-convex','OptimalityTolerance',1e-8,'ConstraintTolerance',1e-8);
I know the code works (my collaborator was able to run it easily, but he has a much older version of MATLAB, while I have the 2024b)
I believe that due to verison upgrade, the behavior of either "quadprog" or "optimoptions" has changes, and thus I am unable to run it.
How can I ensure "optimoptions" treats "quadprog" as a solver?
Thank you in advance for your time and cosideration.

5 个评论

I believe that due to verison upgrade, the behavior of either "quadprog" or "optimoptions" has changes, and thus I am unable to run it.
Nope. Whatever is happening it is only on your computer. If we run it here in the online environment (R2024b), it works fine:
opts = optimoptions('quadprog','Algorithm','interior-point-convex','OptimalityTolerance',1e-8,'ConstraintTolerance',1e-8)
opts =
quadprog options: Options used by current Algorithm ('interior-point-convex'): (Other available algorithms: 'active-set', 'trust-region-reflective') Set properties: Algorithm: 'interior-point-convex' ConstraintTolerance: 1.0000e-08 OptimalityTolerance: 1.0000e-08 Default properties: Display: 'final' LinearSolver: 'auto' MaxIterations: 200 ScaleProblem: 0 StepTolerance: 1.0000e-12 Options not used by current Algorithm ('interior-point-convex') Default properties: FunctionTolerance: 'default dependent on problem' HessianMultiplyFcn: [] ObjectiveLimit: -1.0000e+20 SubproblemAlgorithm: 'cg' TypicalX: 'ones(numberOfVariables,1)' UseCodegenSolver: 0

Thank you for your quick response, I don't know why it didn't even cross my mind to check online.

I'll keep searching for the problem, currently have no idea. Maybe it is caused by a clash between the two Matlab versions currently installed on my computer.

Thank you very much once again, at least now I am sure it's not the code or the Matlab version.

Maybe it is caused by a clash between the two Matlab versions currently installed on my computer.
It shouldn't, but you could try a clean reinstall.
If we run it here in the online environment (R2024b),
Huh, I assumed that MATLAB Answers and MATLAB Online had been updated to R2025a, but it looks like they have not been!
Huh, I assumed that MATLAB Answers and MATLAB Online had been updated to R2025a, but it looks like they have not been!
Good thing. We've been seeing lots of problems with R2025a.

请先登录,再进行评论。

 采纳的回答

Altaïr
Altaïr 2025-7-7
编辑:Altaïr 2025-7-7
A similar issue was observed when generating a standalone executable for a script that uses the "contopptraj" function from the Robotics System Toolbox. This specific bug has been resolved in R2024b. Further details are available in the following external bug report:
Make sure that the Optimization Toolbox is installed correctly or try reinstalling it. The "ver" command can be used to check the installed toolboxes.
Sharing additional information about the workflow, the versions involved, and clearer reproduction steps would assist the community in providing more focused support.

更多回答(1 个)

Thank you everyone for your help! I appreciate it.
What fixed the problem was re-installing the Optimization Toolbox in Matlab R2024b.
All the best.

类别

帮助中心File Exchange 中查找有关 Startup and Shutdown 的更多信息

产品

版本

R2024b

Community Treasure Hunt

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

Start Hunting!

Translated by