optimproblem object: Change variable bounds
Ältere Kommentare anzeigen
"OptimizationProblem property 'Variables' is read-only". That is the message I get after trying to change something like:
prob.Variables.x.LowerBound = lb
where prob is an optimproblem object.
How can I get around this? Another issue I found was that I could not add variables to the problem, for the same reason. I got around this by adding dummy constraints with all zero coefficients. Overall I like this new tool, it is very convenient, but there should be a way to manipulate variables easily. I am using 2017b.
5 Kommentare
Alan Weiss
am 23 Jan. 2018
That is an interesting observation about resetting the bounds. The team is looking into it. Meanwhile, Matt has given very good advice.
Alan Weiss
MATLAB mathematical toolbox documentation
Opt User
am 23 Jan. 2018
Alan Weiss
am 23 Jan. 2018
Indeed, the problem-based approach is not really supposed to be used with other solvers for that reason, among others. It is supposed to be used with solve. If you can get it to work for you with other solvers, great, but it is outside of the current design scope to do so.
Alan Weiss
MATLAB mathematical toolbox documentation
Matt J
am 23 Jan. 2018
If you can get it to work for you with other solvers, great, but it is outside of the current design scope to do so.
That seems to throw into question the purpose of offering a prob2struct() method in the first place.
On the other hand, I don't think it would be difficult for the user to reconstruct the connection between the problem-based names and the solver form, assuming TMW guarantees that the ordering of the variables/constraints in both forms will always be the same. I think this is undocumented, currently.
Opt User
am 24 Jan. 2018
Akzeptierte Antwort
Weitere Antworten (0)
Kategorien
Mehr zu Problem-Based Nonlinear Optimization finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!