knitro solver

76 views
Skip to first unread message

k_7...@yahoo.com

unread,
Feb 19, 2014, 4:52:18 AM2/19/14
to yal...@googlegroups.com
Hi Johan,


I'm wondering if I can use knitro solver inside optimizer command ? if yes, does it need to set some options before using it?

Thank you very much in advance

Klanter

Johan Löfberg

unread,
Feb 19, 2014, 4:58:38 AM2/19/14
to yal...@googlegroups.com
Yes, should work

sdpvar x
sdpvar u
P
= optimizer(x>=u,(x+5)^2,sdpsettings('solver','knitro'),u,x)
P
{.5}
Optimizer object with 1 inputs and 1 outputs.

ans
=

   
0.5000


Klanter

unread,
Feb 19, 2014, 6:31:50 AM2/19/14
to yal...@googlegroups.com
Thanks Johan for reply

I executed your code above and got this result:
??? Error using ==> optimizer.optimizer at 194
Failed exporting the model: Solver not found (+knitro)
 
I have trial version with license I verified it by this code:
[x fval] = knitromatlab(@(x)cos(x),1)

Final Statistics
----------------
Final objective value               = -1.00000000000000e+000
Final feasibility error (abs / rel) =   0.00e+000 / 0.00e+000
Final optimality error  (abs / rel) =   2.37e-009 / 2.37e-009
# of iterations                     =          7 
# of CG iterations                  =          0 
# of function evaluations           =         12
# of gradient evaluations           =          8
Total program time (secs)           =       0.083 (     0.063 CPU time)
Time spent in evaluations (secs)    =       0.014

===============================================================================

x =
    3.1416
fval =
   -1.0000

Johan Löfberg

unread,
Feb 19, 2014, 6:33:25 AM2/19/14
to yal...@googlegroups.com
Which version? 9.0 is required

Johan Löfberg

unread,
Feb 19, 2014, 6:36:20 AM2/19/14
to yal...@googlegroups.com
and are you really using the latest version of YALMIP?

Klanter

unread,
Feb 19, 2014, 6:50:49 AM2/19/14
to yal...@googlegroups.com
KNITRO 9.0

I downloaded it yesterday!

Klanter

unread,
Feb 19, 2014, 6:55:52 AM2/19/14
to yal...@googlegroups.com
yalmip version

ans =

20131220

Johan Löfberg

unread,
Feb 19, 2014, 6:56:01 AM2/19/14
to yal...@googlegroups.com
What is returned from

yalmip('version')


and

which -all 'knitromatlab'


Johan Löfberg

unread,
Feb 19, 2014, 7:00:58 AM2/19/14
to yal...@googlegroups.com
Are you sure you downloaded it yesterday? YALMIP was updated on the 17th (the link on the download page said otherwise, but the latest is always in the file YALMIP.zip, which downloaded correctly when I tried just now. Updated the name on the link though to the correct version number)

Anyway, you are running an old version.
Message has been deleted

Johan Löfberg

unread,
Feb 19, 2014, 7:11:52 AM2/19/14
to yal...@googlegroups.com
OK, problem solved then., Install the latest version of YALMIP which adds support to KNITRO and it will work.

Klanter

unread,
Feb 19, 2014, 7:15:08 AM2/19/14
to yal...@googlegroups.com
Thank you very much! I'm really appreciate your answer.
Message has been deleted

ahmad hdr

unread,
May 13, 2023, 12:23:23 AM5/13/23
to YALMIP
Dear Dr. Lofberg
I have the same problem. I just received the trial version of Knitro (version 13.2), running into MATALB (R2020b) with the command: 
[x fval] = knitro_nlp(@(x)sin(x),1) 
It is ok; however, when running yalmip('test'), it shows that knitro "not found." 
{yalmip('version') = 20210331}
It would be appreciated if you could guide me through this. 

Johan Löfberg

unread,
May 13, 2023, 8:23:49 AM5/13/23
to YALMIP
It is simply not supported, so you only way forward is either to add support for it in yalmip your self (contributions welcome), or wait for some release where this has been done

Johan Löfberg

unread,
Jun 12, 2023, 9:08:13 AM6/12/23
to YALMIP
Update for 13.1+ available in the develop branch now
Reply all
Reply to author
Forward
0 new messages