esa / pagmo_plugins_nonfree

A pagmo affiliated package (https://github.com/esa/pagmo2) adding commercial solvers to the list of solvers/algorithms: SNOPT7, WORHP
GNU General Public License v3.0
10 stars 9 forks source link

Snopt7 now working with 7.7 and 7.6 APIs #7

Closed darioizzo closed 5 years ago

darioizzo commented 5 years ago

Tested. Here is the log of a working session. Both Snopt 7.7.1 and Snopt 7.2.4 were used (fortran). Note that the c library version is, instead, 2.2 and 2.0 respectively.

┌─[dario@valentina]─[~]
└──╼ ipython
imPython 3.7.2 (default, Jan 10 2019, 23:51:51) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.2.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: import pygmo_plugins_nonfree as pnf                                                                                                                                                                        

In [2]: import pygmo as pg                                                                                                                                                                                         

In [3]: uda = pnf.snopt7(library = r'/usr/local/lib/libsnopt76_c.so', screen_output=True, minor_version=6)                                                                                                         

In [4]: algo = pg.algorithm(uda)                                                                                                                                                                                   

In [5]: prob = pg.problem(pg.ackley(10))                                                                                                                                                                           

In [6]: pop = pg.population(prob, 10)                                                                                                                                                                              

In [7]: pop = algo.evolve(pop)                                                                                                                                                                                     
 ==============================
   SNOPT  C interface  2.0.0   
 ==============================
 S N O P T  7.2-4    (Jun 2006)
 ==============================

 SNMEMA EXIT 100 -- finished successfully
 SNMEMA INFO 104 -- memory requirements estimated

 Nonlinear constraints       0     Linear constraints       1
 Nonlinear variables        10     Linear variables         0
 Jacobian  variables         0     Objective variables     10
 Total constraints           1     Total variables         10

 The user has defined       0   out of      10   first  derivatives

 Major Minors     Step   nObj Feasible  Optimal      Objective    nS
     0     10               1           5.9E-01  1.6817613E+01    10   r
     1      1  1.5E-01      2           5.0E-01  1.6130361E+01    10 n r
     2      1  1.4E-01      3           3.2E-01  1.5813800E+01    10 s
     3      1  1.0E+00      4           7.8E-02  1.5704890E+01    10
     4      1  1.0E+00      5           6.4E-03  1.5698342E+01    10
     5      1  3.3E-01      6           2.2E-03  1.5698329E+01    10
     6      1  1.0E+00      7           2.4E-03  1.5698328E+01    10
     7      1  1.0E+00      8           7.5E-04  1.5698324E+01    10
     8      1  1.0E+00      9           2.2E-04  1.5698324E+01    10
     9      1  1.0E+00     10           2.7E-05  1.5698324E+01    10

 Major Minors     Step   nObj Feasible  Optimal      Objective    nS
    10      1  1.0E+00     11           1.5E-05  1.5698324E+01    10
    11      1  1.0E+00     12           5.7E-06  1.5698324E+01    10       c
    11      2  1.0E+00     12           2.7E-05  1.5698324E+01    10       c
    12      1  4.5E-01     13           5.9E-06  1.5698324E+01    10       c
    13      1  1.0E+00     14          (8.0E-07) 1.5698324E+01    10       c

 SNOPTA EXIT   0 -- finished successfully
 SNOPTA INFO   1 -- optimality conditions satisfied

 Problem name                 Ackley F
 No. of iterations                  24   Objective value      1.5698323763E+01
 No. of major iterations            13   Linear objective     0.0000000000E+00
 Penalty parameter           0.000E+00   Nonlinear objective  1.5698323763E+01
 No. of calls to funobj            211   No. of calls to funcon            211
 Calls with modes 1,2 (known g)     14   Calls with modes 1,2 (known g)     14
 Calls for forward differencing    120   Calls for forward differencing    120
 Calls for central differencing     60   Calls for central differencing     60
 No. of superbasics                 10   No. of basic nonlinears             0
 No. of degenerate steps             0   Percentage                       0.00
 Max x                       5 1.6E+01   Max pi                      1 1.0E+00
 Max Primal infeas           0 0.0E+00   Max Dual infeas             5 1.6E-06

 Solution not printed

In [8]: uda = pnf.snopt7(library = r'/usr/local/lib/libsnopt77_c.so', screen_output=True, minor_version=7)                                                                                                         

In [9]: algo = pg.algorithm(uda)                                                                                                                                                                                   

In [10]: pop = pg.population(prob, 10)                                                                                                                                                                             

In [11]: pop = algo.evolve(pop)                                                                                                                                                                                    
 ==============================
    SNOPT  C interface  2.2.0   
 ==============================
 S N O P T  7.7.1    (Nov 2018)
 ==============================

 SNMEMA EXIT 100 -- finished successfully
 SNMEMA INFO 104 -- memory requirements estimated

 Trial version of SNOPT -- for evaluation or academic purposes only

 Nonlinear constraints       0     Linear constraints       1
 Nonlinear variables        10     Linear variables         0
 Jacobian  variables         0     Objective variables     10
 Total constraints           1     Total variables         10

 The user has defined       0   out of      10   first  derivatives

 Major Minors     Step   nObj Feasible  Optimal      Objective     nS
     0     10               1           5.6E-01  1.9313431E+01     10   r
     1      1  1.0E+00      2           7.5E-01  1.8485845E+01     10   r
     2      1  1.9E-01      3           5.7E-01  1.8046349E+01     10 s
     3      1  1.0E+00      4           5.2E-01  1.7804930E+01     10
     4      1  1.0E+00      5           5.1E-01  1.7799763E+01     10
     5      1  1.0E+00      6           3.6E-02  1.7783339E+01     10
     6      1  1.0E+00      7           1.0E-02  1.7783045E+01     10
     7      1  1.0E+00      8           1.2E-03  1.7783021E+01     10
     8      1  1.0E+00      9           9.8E-04  1.7783021E+01     10
     9      1  1.0E+00     10           2.2E-05  1.7783020E+01     10
     9      1              10           8.9E-05  1.7783020E+01     10       c

 Major Minors     Step   nObj Feasible  Optimal      Objective     nS
    10      1  1.0E+00     11           6.4E-05  1.7783020E+01     10       c
    11      1  1.0E+00     12          (4.3E-07) 1.7783020E+01     10       c

 SNOPTA EXIT   0 -- finished successfully
 SNOPTA INFO   1 -- optimality conditions satisfied

 Problem name                 Ackley F
 No. of iterations                  22   Objective            1.7783020464E+01
 No. of major iterations            11   Linear    obj. term  0.0000000000E+00
                                         Nonlinear obj. term  1.7783020464E+01
 User function calls (total)       185   Calls with modes 1,2 (known g)     12
 Calls for forward differencing    130   Calls for central differencing     30
 No. of superbasics                 10   No. of basic nonlinears             0
 No. of degenerate steps             0   Percentage                       0.00
 Max x                       6 2.7E+01   Max pi                      1 1.0E+00
 Max Primal infeas           0 0.0E+00   Max Dual infeas            10 4.3E-07

 Solution not printed

 Time for MPS input                             0.00 seconds
 Time for solving problem                       0.00 seconds
 Time for solution output                       0.01 seconds
 Time for constraint functions                  0.00 seconds
 Time for objective function                    0.00 seconds
codecov-io commented 5 years ago

Codecov Report

Merging #7 into master will decrease coverage by 0.25%. The diff coverage is 91.17%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #7      +/-   ##
=========================================
- Coverage   96.55%   96.3%   -0.26%     
=========================================
  Files           4       4              
  Lines         872     866       -6     
=========================================
- Hits          842     834       -8     
- Misses         30      32       +2
Impacted Files Coverage Δ
include/pagmo_plugins_nonfree/worhp.hpp 93.44% <66.66%> (-0.45%) :arrow_down:
include/pagmo_plugins_nonfree/snopt7.hpp 97.86% <93.54%> (-0.08%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c605b39...59b3c74. Read the comment docs.