Skip to content

Fix: extend recursivefieldnames to support MATLAB optimizer classes#1523

Merged
johanlofberg merged 1 commit intoyalmip:developfrom
manwolframio:fixing-matlab-optimization-class-detection
Oct 29, 2025
Merged

Fix: extend recursivefieldnames to support MATLAB optimizer classes#1523
johanlofberg merged 1 commit intoyalmip:developfrom
manwolframio:fixing-matlab-optimization-class-detection

Conversation

@manwolframio
Copy link
Copy Markdown
Contributor

The validation in sdpsettings relied on recursivefieldnames, which only worked with structs. However, MATLAB internal optimizers return options as classes (e.g., optim.options.intlinprog, subclasses of optim.options.MultiAlgorithm). These were discarded, breaking cases like:

opts = sdpsettings('solver','intlinprog');
opts = sdpsettings(opts,'intlinprog.RelativeGapTolerance',relGap);

The fix converts the properties of optim.options.MultiAlgorithm objects into a struct before recursively extracting field names, preserving the expected code flow without exposing private fields.

The validation in sdpsettings relied on recursivefieldnames, which only worked with structs.
However, MATLAB internal optimizers return options as classes (e.g., optim.options.intlinprog,
subclasses of optim.options.MultiAlgorithm). These were discarded, breaking cases like:

  opts = sdpsettings('solver','intlinprog');
  opts = sdpsettings(opts,'intlinprog.RelativeGapTolerance',relGap);

The fix converts the properties of optim.options.MultiAlgorithm objects into a struct before
recursively extracting field names, preserving the expected code flow without exposing private fields.
@manwolframio manwolframio reopened this Oct 4, 2025
@johanlofberg johanlofberg merged commit 0b3a7c5 into yalmip:develop Oct 29, 2025
0 of 14 checks passed
@johanlofberg
Copy link
Copy Markdown
Member

Thank you for the contribution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants