Passing options to WORHP

517 views
Skip to first unread message

Nicolò Robuschi

unread,
Mar 21, 2018, 6:25:08 PM3/21/18
to CasADi
Dear all,

I am currently using CasADi on Python 3.6 32bit, along with the SQP solver WORHP 1.10.
The installation of WORHP went smoothly, however I am experiencing some problem in passing the options to the solver.

For example, the syntax is this one:
opts_worhp = {}
opts_worhp["worhp.BFGSmethod"] = 1
opts_worhp["worhp.MaxIter"] = 5
opts_worhp["worhp.UserHM"] = False
opts_worhp["worhp.FidifHM"] = False
solver = nlpsol('solver', 'worhp', nlp_prob, opts_worhp)

but when the solver starts it gets stuck with default options. I am not able to set up a BFGS method nor to impose, for example, 5 iterations...it goes ahead to iterate with default options without showing any error.
I have also tried WORHP 1.11 and 1.07, but the problem persists in CasADi 3.3.0 and also in CasADi 3.4.0.

Do you have any idea?

Thanks a lot!

Best regards,
Nicolò

Nicolò Robuschi

unread,
Mar 22, 2018, 6:20:06 AM3/22/18
to CasADi
Update: with the new release of CasADi 3.4.0 I am able to use WORHP also on Matlab 2016b. However, I am experiencing the same problem described in the previous post.

For example:
worhp_options = struct;
worhp_options.worhp.MaxIter = 5;
worhp_options.worhp.Timeout = 100;
nlp_solver = nlpsol('solver', 'worhp', nlp_prob, worhp_options);

the solver converge to an optimal solution in 52 iterations and Timeout time still the default one: 1800s.

Is it something related to WORHP itself? Or a compatibility issue between the solver and CasADi?


Thanks!

Best,
Nicolò


Joris Gillis

unread,
Apr 11, 2018, 3:48:09 AM4/11/18
to CasADi
Should be fixed now (3.4.1).

Nicolò Robuschi

unread,
Apr 11, 2018, 12:06:10 PM4/11/18
to CasADi
Dear Joris,

unfortunately I am facing the same type of error with WORHP. Maybe I am doing something wrong in declaring the options?

Thanks,
Nicolò

Joris Gillis

unread,
Apr 11, 2018, 5:18:57 PM4/11/18
to CasADi
Strange. Here's my test problem, and its output (for 3.4.1):


from casadi import *

x
= MX.sym("x")

solver
= nlpsol("solver","worhp",{"x":x,"g":x**2,"f":x**6},{"worhp": {"MaxIter":2}})
solver
(lbg=1,ubg=2)

 
LICENSED FOR NON-PROFIT, ACADEMIC OR INSTRUCTIONAL USE.
 YOU ARE NOT PERMITTED TO EXPLOIT THIS LICENSE COMMERCIALLY
.


-------------------------------------------------------
   
This is WORHP 1.10-3, the European NLP-solver.
   
Use of WORHP is subject to terms and conditions.
   
Visit http://www.worhp.de for more information.
-------------------------------------------------------

Total number of variables ........................        1
                                   
fixed variables        0
                   variables
with lower bound only        0
              variables
with lower and upper bound        0
                   variables
with upper bound only        0
Total number of box constraints ..................        0
Total number of other constraints ................        2
                              equality constraints        
0
      inequality constraints
with lower bound only        0
 inequality constraints
with lower and upper bound        1
      inequality constraints
with upper bound only        0


Gradient (user)  1/1 = 100.000%
Jacobian (user)  1/1 = 100.000%
Hessian  (user)  1/1 = 100.000%

Algorithm    Sequential Quadratic Programming
NLP
MaxIter  2               Line Search Method     Filter
QP  
MaxIter  500
LA solver    MA97
(tol 1.0E-09, ref 10, ord METIS/AMD, scl none)

Tolerances:
Optimality  (sKKT)   1.00E-06 (1.0E-03)   IP ComTol    2.00E-07
Feasibility          1.00E-06 (1.0E-03)   IP ResTol    4.00E-08
Complementarity      1.00E-06

Timeout              1800.000  seconds

    ITER           OBJ             CON            OPTI
/COMPL    FLAGS  ALPHA       |DX|     REL  PEN   REG     TIME
[   0|   5]  +0.00000000E+00  1.00000000E+00  0.00000000E+00 sc  Uio  0.00E+00   0.00E+00    -    -     -    5.88E-04
[   1|   1]  +0.00000000E+00  1.00000000E+00  3.11747464E+07 so  Uin  1.00E+00d  0.00E+00   1.0   -   +0.6   1.42E-02
[   2|   1]  +0.00000000E+00  1.00000000E+00  3.03046132E+07 so  Uin  1.00E+00d  0.00E+00   1.0   -   +7.7   2.16E-02

 
Final values after iteration 2:
 
Final objective value .............  0.0000000000E+00
 
Final constraint violation ........  1.0000000000E+00
 
Final complementarity .............  0.0000000000E+00 (0.0000000000E+00)
 
Final KKT conditions ..............  3.0304613191E+07 (0.0000000000E+00)
 
Unsuccessful termination: Maximum number of iterations reached.

How does yours look?
Are you working on linux? It might be a different bug altogether then ( https://github.com/casadi/casadi/issues/2161 )

Best,
  Joris

Nicolò Robuschi

unread,
Apr 12, 2018, 7:35:16 AM4/12/18
to CasADi
Dear Joris,

I am working on Windows 10 Pro, 64bit.

I have implemented your example on Python 3.6 32bit. This is the output of WORHP:


 LICENSED FOR NON-PROFIT, ACADEMIC OR INSTRUCTIONAL USE.
 YOU ARE NOT PERMITTED TO EXPLOIT THIS LICENSE COMMERCIALLY.


-------------------------------------------------------
  This is WORHP 1.10-2160fae, the European NLP-solver.

   Use of WORHP is subject to terms and conditions.
    Visit http://www.worhp.de for more information.
-------------------------------------------------------

Total number of variables ........................        1
                                   fixed variables        0
                   variables with lower bound only        0
              variables with lower and upper bound        0
                   variables with upper bound only        0
Total number of box constraints ..................        0
Total number of other constraints ................        2
                              equality constraints        0
      inequality constraints with lower bound only        0
 inequality constraints with lower and upper bound        1
      inequality constraints with upper bound only        0


Gradient (user)  1/1 = 100.000%
Jacobian (user)  1/1 = 100.000%
Hessian  (user)  1/1 = 100.000%

Algorithm    Sequential Quadratic Programming
NLP MaxIter  10000           Line Search Method     Filter

QP  MaxIter  500
LA solver    MA97 (tol 1.0E-09, ref 10, ord METIS/AMD, scl none)

Tolerances:
Optimality  (sKKT)   1.00E-06 (1.0E-03)   IP ComTol    2.00E-07
Feasibility          1.00E-06 (1.0E-03)   IP ResTol    4.00E-08
Complementarity      1.00E-06

Timeout              1800.000  seconds

     ITER           OBJ              CON             OPTI/COMPL     FLAGS  ALPHA        |DX|      REL  PEN   REG     TIME
[    0|   5]  +0.00000000E+000  1.00000000E+000  0.00000000E+000 sc  Uio  0.00E+000   0.00E+000    -    -     -    0.00E+000
[    1|   1]  +0.00000000E+000  1.00000000E+000  3.11747464E+007 so  Uin  1.00E+000d  0.00E+000   1.0   -   +0.6   6.30E-002
[    2|   1]  +0.00000000E+000  1.00000000E+000  3.03046132E+007 so  Uin  1.00E+000d  0.00E+000   1.0   -   +7.7   7.80E-002
[    3|   1]  +0.00000000E+000  1.00000000E+000  3.03046132E+007 so  Uin  1.00E+000d  0.00E+000   1.0   -   +7.6   9.40E-002
[    4|   1]  +0.00000000E+000  1.00000000E+000  3.03046132E+007 so  Uin  1.00E+000d  0.00E+000   1.0   -   +7.6   1.10E-001

 Final values after iteration 4:
 Final objective value ............. 0.0000000000E+000
 Final constraint violation ........ 1.0000000000E+000
 Final complementarity ............. 0.0000000000E+000 (0.0000000000E+000)
 Final KKT conditions .............. 3.0304613191E+007 (0.0000000000E+000)
 Unsuccessful termination: Minimum Stepsize reached in Armijo.
               t_proc [s]   t_wall [s]    n_eval
       nlp_f            0            0      2114
       nlp_g            0            0      2120
  nlp_grad_f            0            0         6
  nlp_hess_l            0            0         5
   nlp_jac_g            0            0         6
      solver        0.156        0.156         1

As you can see MaxIter still the default one, but the same happens for all the other options that I am trying to tune.

The same happens in Matlab, which is 64bit; hence I would roule out a bitness issue.

Could be something related to the XML file in the lib folder? I tried to modify that file and also tried to delate it from the folder, but nothing changes.

Thank you!

Best,
Nicolò

Joris Gillis

unread,
Apr 17, 2018, 4:31:09 AM4/17/18
to CasADi
Dear Nicolo,

Could you test out this debug release ( https://github.com/casadi/binaries/releases/tag/commit-61cb2e5 ), with Worhp 1.12?

Thanks!

Best,
  Joris

Nicolò Robuschi

unread,
Apr 17, 2018, 1:45:46 PM4/17/18
to CasADi
Dear Joris,

thanks for the effort!

unfortunately I have Py36 32bit on Windows, or Matlab 2016b, always on Windows. Could you provide me the binaries of one of these two languages (preferably Python)? Thanks!

Best,
Nicolò

Joris Gillis

unread,
Apr 17, 2018, 4:14:20 PM4/17/18
to CasADi
Should appear in about half an hour..

Nicolò Robuschi

unread,
Apr 18, 2018, 4:04:32 AM4/18/18
to CasADi
Dear Joris,

thanks, now it works!

With this options:
opts_worhp = {}
opts_worhp['worhp.MaxIter'] = 10

opts_worhp['worhp.UserHM'] = False
opts_worhp['worhp.FidifHM'] = False
opts_worhp['worhp.BFGSmethod'] = 2
opts_worhp['worhp.Timeout'] = 60
solver = nlpsol('solver', 'worhp', nlp_prob, opts_worhp)

This is the output or WORHP 1.12

-------------------------------------------------------
    This is WORHP 1.12-1, the European NLP-solver.

   Use of WORHP is subject to terms and conditions.
    Visit http://www.worhp.de for more information.
-------------------------------------------------------

Total number of variables ........................      367
                                   fixed variables       36

                   variables with lower bound only        0
              variables with lower and upper bound      149

                   variables with upper bound only        0
Total number of box constraints ..................      334
Total number of other constraints ................      274
                              equality constraints      274

      inequality constraints with lower bound only        0
 inequality constraints with lower and upper bound        0

      inequality constraints with upper bound only        0


Gradient (user)  367/367    = 100.000%
Jacobian (user)  670/100558 =   0.666%
Block BFGS with intersections (1-3)

Algorithm    Sequential Quadratic Programming
NLP MaxIter  10              Line Search Method     Filter

QP  MaxIter  500
LA solver    MA97 (tol 1.0E-09, ref 10, ord METIS/AMD, scl none)

Tolerances:
Optimality  (sKKT)   1.00E-06 (1.0E-03)   IP ComTol    2.00E-07
Feasibility          1.00E-06 (1.0E-03)   IP ResTol    4.00E-08
Complementarity      1.00E-06

Timeout                60.000  seconds


    ITER           OBJ              CON            OPTI/COMPL      FLAGS   ALPHA        |DX|      REL   PEN   REG     TIME
[   0|   4]  +2.29053230E-001  2.76254591E-002  6.57310466E-002 so  Bin  0.000E+000   3.85E-001    -     -     -    2.72E+000
[   1|   2]  +2.14317440E-001  2.37232105E-002  1.15159244E-002 sc  Bin  1.000E+000   3.84E-001   0.85   -     -    4.22E+000
[   2|   3]  +1.86686700E-001  1.41826062E-002  1.53575719E-002 so  Bin  1.000E+000   1.13E+000   0.52   -     -    5.64E+000
[   3|   3]  +1.67744423E-001  2.80021126E-003  1.74884458E-002 so  Bin  1.000E+000   1.36E+000   0.14   -     -    7.14E+000
[   4|  10]  +1.64495129E-001  7.14022537E-005  4.13698163E-004 so  Baa  1.000E+000   3.07E-001    -     -     -    8.56E+000
[   5|   2]  +1.63509709E-001  2.25582490E-004  8.89790722E-004 so  Baa  1.000E+000   3.52E-001    -     -     -    1.00E+001
[   6|   7]  +1.60844987E-001  9.68700470E-004  5.96488522E-003 so  Ban  1.000E+000   9.79E-001   0.00   -     -    1.15E+001
[   7|  11]  +1.52977802E-001  1.88273399E-003  1.34318522E-002 so  Bin  1.000E+000   1.66E+000   0.00   -     -    1.30E+001
[   8|  11]  +1.48499503E-001  8.30618357E-004  2.17588854E-002 so  Ban  1.000E+000   1.04E+000   0.00   -     -    1.44E+001
[   9|   9]  +1.43855667E-001  6.09263493E-004  2.07500916E-002 so  Ban  1.000E+000   1.06E+000   0.00   -     -    1.58E+001

    ITER           OBJ              CON            OPTI/COMPL      FLAGS   ALPHA        |DX|      REL   PEN   REG     TIME
[  10|  11]  +1.39370740E-001  4.03624855E-004  2.57748984E-003 so  Ban  1.000E+000   1.39E+000   0.00   -     -    1.72E+001


 Final values after iteration 4:
 Final objective value ............. 1.6449512859E-001
 Final constraint violation ........ 7.1402253656E-005
 Final complementarity ............. 3.5433133675E-005 (3.5433133675E-005)
 Final KKT conditions .............. 4.1369816298E-004 (3.8390942757E-003)
 Terminating: Maximum number of iterations reached.
 Successful termination: Acceptable Solution Found in previous iteration.

               t_proc [s]   t_wall [s]    n_eval
       nlp_f         1.45         1.45        11
       nlp_g         1.49         1.48        11
  nlp_grad_f         5.86         5.86        12
   nlp_jac_g         8.11         8.11        12
      solver         17.3         17.3         1

Can I use this debug release instead of the 3.4.1 also with other NLP solvers, or is better to wait for an official 3.4.2 release?

Best,
Nicolò

Fb

unread,
Jan 31, 2020, 12:23:39 PM1/31/20
to CasADi
Dear Joris,

I'm under ubuntu 18.04 using casadi 3.5.1, compiled with the WORHP option.
The WORHP solver is able to find the license but when I try to run any exemple as yours :

from casadi import *

x
= MX.sym("x")

solver
= nlpsol("solver","worhp",{"x":x,"g":x**2,"f":x**6},{"worhp": {"MaxIter":2}})
solver
(lbg=1,ubg=2)
 
I get the following :

Opened license file /devel/license/worhp.lic
This module 'worhp' is licensed for versions <= 2.0 to:
   bimec28
   Université de Montréal
   on host 'Bimec28' until 29.01.2021


 LICENSED FOR NON-PROFIT, ACADEMIC OR INSTRUCTIONAL USE.
 YOU ARE NOT PERMITTED TO EXPLOIT THIS LICENSE COMMERCIALLY.


-------------------------------------------------------
Erreur de segmentation (core dumped)

Do you have an idea of how to solve this issue ? Would a backtrace from gdb help in anyway ?

Thanks in advance,

Francois
Reply all
Reply to author
Forward
0 new messages