errors with optimoptions and optim.opti​ons.create​SolverOpti​ons

I just installed MATLAB R2013a. (Specifically, I uninstalled it (including user preferences), cleaned out the directory, then reinstalled from the mathworks.com web site. There are no other MATLAB versions on this computer.) When I tried to run optimoptions, it gave me an error about attempting to use a script:
>> op = optimoptions('lsqnonlin')
Attempt to execute SCRIPT optimoptions as a function:
C:\Program Files\MATLAB\R2013a\toolbox\shared\optimlib\ja\optimoptions.m
Checking what optimoptions is getting executed, it says this:
>> which optimoptions -all
C:\Program Files\MATLAB\R2013a\toolbox\shared\optimlib\ja\optimoptions.m
C:\Program Files\MATLAB\R2013a\toolbox\optim\optim\optimoptions.m % Shadowed
The first one of these is indeed a script, so I tried moving ...\toolbox\optim\optim\ above ...\toolbox\shared\optimlib (and ...optimlib\ja) in the path and restarting MATLAB. Then I got a different error:
>> which optimoptions
C:\Program Files\MATLAB\R2013a\toolbox\optim\optim\optimoptions.m
>> op = optimoptions('lsqnonlin')
Error using optimoptions (line 114)
Undefined variable "optim" or class "optim.options.createSolverOptions".
It doesn't matter what arg I pass to optimoptions, it gives the same error with 'lsqlin' or 'foobar'. I removed all my directories (i.e., non-MATLAB-installed directories) from the path and restarted MATLAB, with no effect.
For what it's worth, if I do a search in Windows for createSolverOptions.m, one file shows up: C:\Program Files\MATLAB\R2013a\toolbox\optim\+optim\+options\createSolverOptions.m .
Help! Does anyone have any experience with this issue?
------------------------------------
Relevant versions in use:
MATLAB Version: 8.1.0.604 (R2013a)
Optimization Toolbox Version 6.3 (R2013a)
Windows 7 Professional 64-bit

 Réponse acceptée

Shashank Prasanna
Shashank Prasanna le 26 Août 2013
Modifié(e) : Shashank Prasanna le 26 Août 2013
Hi David, This seems like it most certainly is a path related issue. Could you try the following?
>> restoredefaultpath
>> savepath
>> rehash toolboxcache
>> op = optimoptions('lsqnonlin')

7 commentaires

Thanks, that solved the problem. I thought un-installing MATLAB, including erasing user preferences, would reset my machine to a virgin state, but I guess not! It's working now, so thanks again.
I had the same problem and it is now solved. Thank you.
>> op = optimoptions('intlinprog')
Error using optimoptions (line 114)
Invalid solver specified. Provide a solver name or handle (such as 'fmincon' or @fminunc).
Type DOC OPTIMOPTIONS for a list of solvers.
>> x = intlinprog([8; 1],2,A,b,[],[],[],[],op)
Error using intlinprog (line 111)
Unable to load a message catalog 'optim:intlinprog'. Please check the file location and format.
Actually i want to use intlinprog , it is showing this error can u help me with this
intlinprog was introduced in R2014a, make sure you are using the recent version of MATLAB. Check you version:
>> ver
arun shankar
arun shankar le 30 Juil 2014
Modifié(e) : arun shankar le 30 Juil 2014
i am using 2013a :(
any other option (function ) in 2013a for integer optimization ?
But it shows help for that , doesnt that mean function is there ?
Hi,
I cannot find optimoptions.m function, Where I can download such function
Thanks,
Best regards, Venkat
It's in the Optimization Toolbox. 'ver' will tell which toolboxes you have installed.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by