Too many output arguments while solving a constrained optimization problem.
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Michael Christian Linder
am 8 Mai 2021
Kommentiert: Michael Christian Linder
am 9 Mai 2021
Hello,
I'm trying to solve a optimization problem with a couple of non-linear constraints. When solving the problem I get the following error:
Error using writeCompiledFun2VirtualFile
Too many output arguments.
I tried different constraints and functions and I noticed that the error appears whenever I use multiplication and/or division with two optimvars. This might be due ot optimvar only supporting ./ and .* . However, replacing / and * with ./ and .* did not solve the problem.
You can find my code attached.
optimisation
Thanks in advance
2 Kommentare
Cris LaPierre
am 8 Mai 2021
Bearbeitet: Cris LaPierre
am 8 Mai 2021
I modified your post to run your m file. It returns a different error. It's the same error I get if I run your m-file in R2019b.
Akzeptierte Antwort
Matt J
am 8 Mai 2021
Bearbeitet: Matt J
am 8 Mai 2021
You are reporting multiple different errors in multiple different places from multiple different Matlab versions, so it is a little hard to parse your question. Basically, though, in earlier version of Matlab, the problem-based framework was limited in scope to linear programming. Non-linear OptimizationVariables expressions were simply not supported. As I demonstrated in my other answer, the code runs fine on more recent Matlab versions, once you supply an initial guess. If you cannot upgrade to a more recent version, however, you will have to resort to the Optimization Toolbox's solver-based optimization tools.
Weitere Antworten (1)
Siehe auch
Kategorien
Mehr zu Get Started with Optimization Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!