Giter VIP home page Giter VIP logo

cvanaret / uno Goto Github PK

View Code? Open in Web Editor NEW
215.0 13.0 16.0 44.3 MB

A next-gen solver for optimization with nonconvex objective and constraints. Reimplements filterSQP and IPOPT (barrier) in a modern and generic way, and unlocks a variety of novel methods. Competitive against filterSQP, IPOPT, SNOPT, MINOS and CONOPT.

License: MIT License

CMake 0.99% C++ 97.92% Fortran 0.76% Shell 0.34%
optimization-algorithms optimization-methods optimization nonlinear-optimization nonlinear-programming nonlinear-programming-algorithms gradient-descent newton-method numerical-optimization interior-point-method

uno's Introduction

Hey, I'm Charlie

I am a researcher in mathematical optimization at Argonne National Laboratory/Zuse-Institut Berlin. I am interested in large-scale nonlinear optimization, reliable optimization based on interval analysis and I enjoy modern software development (mainly in C++, a bit of Julia as well). In particular, I am actively developing the Uno solver, a modular open-source C++ library that unifies nonlinearly constrained nonconvex optimization and offers dozens of strategy combinations. It is competitive against IPOPT and filterSQP, while being modern, lightweight and extensible. Check it out!

I got my PhD from Université de Toulouse (France) in January 2015. Then I was a postdoctoral researcher with IRT Saint Exupéry (France), Argonne National Laboratory (USA), Fraunhofer ITWM (Germany), Technische Universität Berlin (Germany) and Zuse-Institut Berlin (Germany).

When I am not scribbling math on a black board or feverishly writing code, I enjoy playing bass with the Toto tribute band The Cats of Oz, taking landscape photos and doing some sort of physical activity (such as bouldering or cross-country skiing).

uno's People

Contributors

amontoison avatar cvanaret avatar traversaro avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

uno's Issues

C++ API

Is there an C++ API available or there are Plans to provide a C++ API in the future?
To clearify what I mean is did you design Uno such that it could also be used without AMPL?

Citation

Hi Charlie,

Can you provide a bibtex? I wish to cite Uno in my paper.

Thanks,
CZ

Building without BQPD

Hello, I'm trying to build the AMPL driver for this interesting solver, but there is probably something I am missing; i'm trying to build without bqpd - as per instructions the library seems to be optional - but I get:

Preprocessing.cpp:(.text+0x1245): undefined reference to `BQPDSolver::BQPDSolver(unsigned long, unsigned long, unsigned long, BQPDProblemType, Options const&)'
/usr/bin/ld: Preprocessing.cpp:(.text+0x132e): undefined reference to `BQPDSolver::solve_QP(unsigned long, unsigned long, std::vector<Interval, std::allocator<Interval> > const&, std::vector<Interval, std::allocator<Interval> > const&, SparseVector<double> const&, std::vector<SparseVector<double>, std::allocator<SparseVector<double> > > const&, SymmetricMatrix<double> const&, std::vector<double, std::allocator<double> > const&, WarmstartInformation const&)'

Cleary if I then add BQPDSolver.cpp to the sources, I get:

/usr/bin/ld: BQPDSolver.cpp:(.text+0x1871): undefined reference to `bqpd_'

which is to be expected, as I don't link with bqpd.

Is there any way to use Uno without it? Thank you!

"The problem has inequality constraints. Create an instance of EqualityConstrainedModel" error when solving with ipopt preset in Debug mode

I am trying to solve the example .nl files provided in https://github.com/cvanaret/Uno/tree/main/examples with uno_ampl with the ipopt preset, and they are both failing with:

uno_ampl: /home/traversaro/unows/Uno/uno/ingredients/subproblem/interior_point_methods/PrimalDualInteriorPointSubproblem.cpp:46: virtual void PrimalDualInteriorPointSubproblem::generate_initial_iterate(const NonlinearProblem&, Iterate&): Assertion `problem.has_inequality_constraints() && "The problem has inequality constraints. Create an instance of EqualityConstrainedModel"' failed.

However, if I try to comment out the assert in

assert(problem.has_inequality_constraints() && "The problem has inequality constraints. Create an instance of EqualityConstrainedModel");
, then the problems both get solved, and the solution is quite similar to the one found by ipopt, see for example for polak5.nl:

# Uno
(/home/traversaro/unows/env) traversaro@IITICUBLAP257:~/unows/Uno/build$ ./uno_ampl -preset ipopt -print_solution yes ../examples/polak5.nl
<...>
Uno (LS feasibility_restoration waechter_filter_method primal_dual_interior_point)
Wed Jun 21 16:31:43 2023
────────────────────────────────────────
Status:                                 Converged with feasible KKT point
Objective value:                        50
┌ Optimality stationarity residual:     8.458521e-09
│ Feasibility stationarity residual:    1
│ Constraint violation:                 8.4585e-09
│ Optimality complementarity residual:  1e-09
└ Feasibility complementarity residual: 8.454271e-06
┌ Infeasibility measure:                1.610706e-08
│ Optimality measure:                   50
└ Auxiliary measure:                    4.01609e-08
Primal solution:                        1.036611e-09 0.005779715 50
Constraint multipliers:                 -0.5 -0.5
Lower bound multipliers:                0 0 0
Upper bound multipliers:                0 0 0
Objective multiplier:                   1
CPU time:                               0.144922s
Iterations:                             32
Objective evaluations:                  33
Constraints evaluations:                34
Objective gradient evaluations:         34
Jacobian evaluations:                   34
Hessian evaluations:                    32
Number of subproblems solved:           32
memory_allocation_amount = 0

# Ipopt

(/home/traversaro/unows/env) traversaro@IITICUBLAP257:~/unows/Uno/build$ ipopt ../examples/polak5.nl

<...>
                                   (scaled)                 (unscaled)
Objective...............:   4.9999999991818186e+01    4.9999999991818186e+01
Dual infeasibility......:   8.4449709447653731e-09    8.4449709447653731e-09
Constraint violation....:   6.6267923873419930e-09    6.6267923873419930e-09
Variable bound violation:   0.0000000000000000e+00    0.0000000000000000e+00
Complementarity.........:   9.0909090909090941e-10    9.0909090909090941e-10
Overall NLP error.......:   8.4449709447653731e-09    8.4449709447653731e-09


Number of objective function evaluations             = 33
Number of objective gradient evaluations             = 33
Number of equality constraint evaluations            = 0
Number of inequality constraint evaluations          = 33
Number of equality constraint Jacobian evaluations   = 0
Number of inequality constraint Jacobian evaluations = 33
Number of Lagrangian Hessian evaluations             = 32
Total seconds in IPOPT                               = 0.025

EXIT: Optimal Solution Found.

Ipopt 3.14.12: Optimal Solution Found

Problem compiling the library on Ubuntu 22.04

Thanks a lot for open sourcing this library @cvanaret !

I initially tried to compile it on Ubuntu 22.04, and I failed.

First of all, I installed AMPL/ASL and HSL/MA57 . I tried to install BQPD, but I could not find where to download it (I need to drop a mail as described in https://www.mcs.anl.gov/~leyffer/solvers.html or there is a more direct option?)

Configuration problems

Then, I tried to configure the project, and it was failing with error:

CMake Error at CMakeLists.txt:120 (message):
  Required library gomp was not found.  Use ccmake to configure its path.

this was fixed by passing the gomp location to cmake:

cmake -Dgomp=/usr/lib/x86_64-linux-gnu/libgomp.so.1 ..

Also for amplsolver and ma57 I specified the location manually.

Compilation Problems

After that, the configuration was successful and I could start the compilation.

Infinity.hpp error

The first compilation that I got is:

[ 21%] Building CXX object CMakeFiles/uno.dir/uno/ingredients/globalization_strategy/Filter.cpp.o
In file included from /home/straversaro/unoaptws/clean/uno/uno/ingredients/globalization_strategy/Filter.hpp:10,
                 from /home/straversaro/unoaptws/clean/uno/uno/ingredients/globalization_strategy/Filter.cpp:
:
/home/straversaro/unoaptws/clean/uno/uno/tools/Infinity.hpp:7:25: error: ‘numeric_limits’ is not a member of
std’
    7 | const double INF = std::numeric_limits<double>::infinity();
      |                         ^~~~~~~~~~~~~~
/home/straversaro/unoaptws/clean/uno/uno/tools/Infinity.hpp:7:40: error: expected primary-expression before ‘double’
    7 | const double INF = std::numeric_limits<double>::infinity();
      |                                        ^~~~~~
make[2]: *** [CMakeFiles/uno.dir/build.make:188: CMakeFiles/uno.dir/uno/ingredients/globalization_strategy/Filter.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/uno.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

that was fixed by modifying the uno/uno/tools/Infinity.hpp as in:

diff --git a/uno/tools/Infinity.hpp b/uno/tools/Infinity.hpp
index 1ada183..8ae84da 100644
--- a/uno/tools/Infinity.hpp
+++ b/uno/tools/Infinity.hpp
@@ -4,6 +4,9 @@
 #ifndef UNO_INFINITY_H
 #define UNO_INFINITY_H

+#include <cmath>
+#include <limits>
+
 const double INF = std::numeric_limits<double>::infinity();

 inline bool is_finite(double value) {

Direction.hpp Compilation Error

After that, I had:

[ 31%] Building CXX object CMakeFiles/uno.dir/uno/ingredients/subproblem/Direction.cpp.o
In file included from /home/straversaro/unoaptws/clean/uno/uno/ingredients/subproblem/Direction.cpp:4:
/home/straversaro/unoaptws/clean/uno/uno/ingredients/subproblem/Direction.hpp:57:16: error: ‘ostream’ in namespace ‘std’ does not name a type
   57 |    friend std::ostream& operator<<(std::ostream& stream, const Direction& step);
      |                ^~~~~~~
In file included from /home/straversaro/unoaptws/clean/uno/uno/ingredients/subproblem/Direction.cpp:4:
/home/straversaro/unoaptws/clean/uno/uno/ingredients/subproblem/Direction.hpp:11:1: note: ‘std::ostream’ is defined in header ‘<ostream>’; did you forget to ‘#include <ostream>’?
   10 | #include "tools/Infinity.hpp"
  +++ |+#include <ostream>
   11 |

that was fixed by:

diff --git a/uno/ingredients/subproblem/Direction.hpp b/uno/ingredients/subproblem/Direction.hpp
index 337e7ce..5c66cb3 100644
--- a/uno/ingredients/subproblem/Direction.hpp
+++ b/uno/ingredients/subproblem/Direction.hpp
@@ -8,6 +8,7 @@
 #include <optional>
 #include "optimization/Multipliers.hpp"
 #include "tools/Infinity.hpp"
+#include <ostream>

 enum class Status {
    OPTIMAL = 0,

LPSolverFactory.hpp Compilation Problem

The final error (that I was not able to solve is on LPSolverFactory.hpp ):

[ 26%] Building CXX object CMakeFiles/uno.dir/uno/ingredients/subproblem/HessianModel.cpp.o
In file included from /home/straversaro/unoaptws/clean/uno/uno/ingredients/subproblem/LPSubproblem.cpp:5:
/home/straversaro/unoaptws/clean/uno/uno/solvers/QP/LPSolverFactory.hpp:16:27: error: ‘BQPDSolver’ was not declared in this scope; did you mean ‘LPSolver’?
   16 |    static std::unique_ptr<BQPDSolver> create(size_t number_variables, size_t number_constraints, const std::string& LP_solver_name,
      |                           ^~~~~~~~~~
      |                           LPSolver
/home/straversaro/unoaptws/clean/uno/uno/solvers/QP/LPSolverFactory.hpp:16:37: error: template argument 1 is invalid
   16 |    static std::unique_ptr<BQPDSolver> create(size_t number_variables, size_t number_constraints, const std::string& LP_solver_name,
      |                                     ^
/home/straversaro/unoaptws/clean/uno/uno/solvers/QP/LPSolverFactory.hpp:16:37: error: template argument 2 is invalid
In file included from /home/straversaro/unoaptws/clean/uno/uno/ingredients/subproblem/LPSubproblem.cpp:5:
/home/straversaro/unoaptws/clean/uno/uno/solvers/QP/LPSolverFactory.hpp: In static member function ‘static int LPSolverFactory::create(size_t, size_t, const string&, const Options&)’:
/home/straversaro/unoaptws/clean/uno/uno/solvers/QP/LPSolverFactory.hpp:24:4: warning: no return statement in function returning non-void [-Wreturn-type]

At a first glance, it seems like BQPD is not an optional dependency, as suggested by the README?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.