Giter Club home page Giter Club logo

proxsuite's People

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  avatar

proxsuite's Issues

Using vectorization seems to make no difference.

I tried both dense and sparse backend to solve my QP problem. I compared the impact of whether to enabling vectorization during compilation of the ProxSuite on the QP problem solving time. I found that enable vectorization seems to make no difference.
So I want to konw how to judge whether the vectorization works? And why the vectorization has little impact on performance?

The cpu of my computer is Intel i7-12700K, and the OS is Ubuntu 20.04.
The dimension of my QP problem is about 500๏ผŒand the number of constraints is about 1000, more than 70% of the constraints is inequality constraints. Sparsity ratio is about 0.1.
Thank you!

Build errors when compiling with VS 17 2022

I'm getting a massive amount of errors (syntax errors etc. see attached files) when trying to build the tests and examples on Windows 10 with MSVC in Visual Studio 17 2022. (Microsoft (R) C/C++ Optimizing Compiler Version 19.32.31329 for x64)

I'm compiling with BUILD_TESTING=True, BUILD_WITH_VECTORISATION_SUPPORT=False and BUILD_PYTHON_INTERFACE=False
All other cache variables are set to their defaults (except CMAKE_PREFIX_PATH which is set to point to Eigen and matio).

I'm using Eigen-3.4.0 and matio-1.5.23
(As an aside, the link on this page confusingly points to matio-cpp but the proxsuite library actually appears to link the original matio library. )
The dependencies seem to be found and linked fine. Note, I built matio without the optional HDF5 dependency.

I've attached the Visual Studio Error List and the command-line output from CMake.

An example of the kind of errors I'm getting
Error C2504 'proxsuite::linalg::veg::tuple::IndexedTuple<proxsuite::linalg::veg::_detail::_meta::integer_sequence<proxsuite::linalg::veg::usize> *>': base class undefined C:\Repos\proxsuite\out\build\x64-Debug\proxsuite C:\Repos\proxsuite\include\proxsuite\linalg\veg\tuple.hpp 507

ErrorList.csv
clOutput.txt

Cannot build on Windows MSVC 2022 without vectorization support

image

Steps to reproduce:
Windows 10, msvc 2022, cmake 3.24.0, eigen 3.40.0

git clone https://github.com/Simple-Robotics/proxsuite --recursive
cd proxsuite
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="$(pwd)/install" -G Ninja -DINSTALL_DOCUMENTATION=OFF -DBUILD_WITH_VECTORIZATION_SUPPORT=OFF -DCMAKE_CXX_STANDARD=20 -DBUILD_TESTING=OFF
cmake --build build --config Release --target install

The cmake output:

image

CMake-Version requirement is wrong

The CMakeLists.txt set the minimum required version of CMake to 3.10.
However, the FindSimde.cmake file requires a higher version of CMake as the option REASON_FAILURE_MESSAGE is only available in CMake 3.16 and higher (see 3.16 vs 3.15).
Furthermore, the error target_compile_definitions may only be set INTERFACE properties on INTERFACE targets is triggered when the former error is fixed by removing the unsupported option.

Steps to reproduce

Try manual build with CMake 3.10.

Suggestions

Either remove unsupported commands for CMake 3.10 or bump up CMake version in CMakeLists.txt.

[python] Segfault on empty NumPy arrays

The following Python example segfaults:

import numpy as np
import proxsuite

H = np.array([[65.0, -22.0, -16.0], [-22.0, 14.0, 7.0], [-16.0, 7.0, 5.0]])
g = np.array([-13.0, 15.0, 7.0])
A = np.array([])
b = np.array([])
C = np.array([])
u = np.array([])
l = np.array([])

results = proxsuite.proxqp.dense.solve(H, g, A, b, C, u, l)
print("optimal x: {}".format(results.x))

However, it runs fine if we replace all np.array([]) by [].

[cmake] Inverse PROXSUITE_DONT_VECTORIZE

Hello all,

This is a proposal to modify PROXSUITE_DONT_VECTORIZE to PROXSUITE_VECTORIZE or PROXSUITE_SMID
As the library is header-only, it is simpler for people to simply copy and paste the library in their code.

Having this macro declared forces people to have this flag passed into their project.

Moreover, smide being an optional library library, it is better to enable the feature for that use case.

To be clear:

Use case 1 - simple copy --> No external dependencies, no flags necessary, easily portable library.
Use case 2 - building the lib for advanced users with smide --> External dep, flags necessary, better use the prosuiteConfig etc.

What do you think ?

time consuming vs sqp

Hello , i build examples/cpp/benchmark_dense_qp.cpp and run it, but why resulted setup time and solve time is 0s?

Then I use clock_gettime(CLOCK_THREAD_CPUTIME_ID, &time) to count cpu time consuming, this time I get
image
which is quite different from time declared in this file.

My full code is

/*

Compile this code once with and without vectorization to see performance
difference.

Use vectorization:
g++ -O3 -march=native -DNDEBUG -std=gnu++17 -DPROXSUITE_VECTORIZE
benchmark_dense_qp.cpp -o benchmark_dense_qp $(pkg-config --cflags proxsuite)

Do not use vectorization:
g++ -DNDEBUG -std=gnu++17 benchmark_dense_qp.cpp -o benchmark_dense_qp
$(pkg-config --cflags proxsuite)

Comparison of timings on Intel i7-11850H and ubuntu 20.04 using this file:

With vectorization:
sparsity_factor: 0.1
Setup Time consumption(dense): 0.000237295s
Solve Time consumption(dense): 0.000500206s
sparsity_factor: 0.2
Setup Time consumption(dense): 0.000465961s
Solve Time consumption(dense): 0.000903787s
sparsity_factor: 0.3
Setup Time consumption(dense): 0.000697931s
Solve Time consumption(dense): 0.00136976s
sparsity_factor: 0.4
Setup Time consumption(dense): 0.000931736s
Solve Time consumption(dense): 0.00185252s


Without vectorization:
sparsity_factor: 0.1
Setup Time consumption(dense): 0.0147825s
Solve Time consumption(dense): 0.0277815s
sparsity_factor: 0.2
Setup Time consumption(dense): 0.029592s
Solve Time consumption(dense): 0.0490869s
sparsity_factor: 0.3
Setup Time consumption(dense): 0.0443664s
Solve Time consumption(dense): 0.0746045s
sparsity_factor: 0.4
Setup Time consumption(dense): 0.0592621s
Solve Time consumption(dense): 0.101507s

*/

#include <proxsuite/proxqp/dense/dense.hpp>
#include <proxsuite/proxqp/utils/random_qp_problems.hpp>
#include <time.h>

using namespace proxsuite::proxqp;
using T = double;

uint64_t osal_get_boot_time_us(void)
{
    struct timespec time = {0, 0};
    clock_gettime(CLOCK_MONOTONIC, &time);
    return ((uint64_t)time.tv_sec * 1000000) + ((uint64_t)time.tv_nsec / 1000);
}

uint64_t osal_get_boot_time_ms(void)
{
    struct timespec time = {0, 0};
    clock_gettime(CLOCK_MONOTONIC, &time);
    return ((uint64_t)time.tv_sec * 1000) + ((uint64_t)time.tv_nsec / 1000000);
}

uint64_t osal_get_thread_time_us(void)
{
    struct timespec time = {0, 0};
    clock_gettime(CLOCK_THREAD_CPUTIME_ID, &time);
    return ((uint64_t)time.tv_sec * 1000000) + ((uint64_t)time.tv_nsec / 1000);
}

uint64_t osal_get_thread_time_ms(void)
{
    struct timespec time = {0, 0};
    clock_gettime(CLOCK_THREAD_CPUTIME_ID, &time);
    return ((uint64_t)time.tv_sec * 1000) + ((uint64_t)time.tv_nsec / 1000000);
}

int
main()
{
  double N = 100.0;
  double solve_time = 0.0;
  double setup_time = 0.0;

  dense::isize dim = 100;
  dense::isize n_eq(dim / 2);
  dense::isize n_in(dim / 2);

  for (T sparsity_factor = 0.1; sparsity_factor < 0.5; sparsity_factor += 0.1) {
    T strong_convexity_factor(1.e-2);
    dense::Model<T> qp_random = utils::dense_strongly_convex_qp(
      dim, n_eq, n_in, sparsity_factor, strong_convexity_factor);
    time_t start;
    for (int i = 0; i < N; i++) {
      uint64_t sqp_tt_start      = osal_get_thread_time_us();
      dense::QP<T> qp(dim, n_eq, n_in);
      qp.settings.max_iter = 10000;
      qp.settings.max_iter_in = 1000;
      qp.settings.eps_abs = 1e-4;
      qp.settings.eps_rel = 0;
      qp.init(qp_random.H,
              qp_random.g,
              qp_random.A,
              qp_random.b,
              qp_random.C,
              qp_random.l,
              qp_random.u);
      qp.solve();
      solve_time += (osal_get_thread_time_us() - sqp_tt_start) / N;
      setup_time += qp.results.info.setup_time / N;
    }
    std::cout << "sparsity_factor: " << sparsity_factor << std::endl;
    std::cout << "Setup Time consumption(dense): " << setup_time << " us"
              << std::endl
              << "Solve Time consumption(dense): " << solve_time << " us"
              << std::endl;
  }

  return 0;
}

And the cmake list file is

cmake_minimum_required(VERSION 3.10)

project(Example CXX)
find_package(proxsuite REQUIRED)
set(CMAKE_CXX_STANDARD 17) # set(CMAKE_CXX_STANDARD 14) will work too

add_executable(example benchmark_dense_qp.cpp)
target_link_libraries(example PUBLIC proxsuite::proxsuite)

# Vectorization support via SIMDE and activated by the compilation options '-march=native' or `-mavx2 -mavx512f`
add_executable(example_with_full_vectorization_support benchmark_dense_qp.cpp)
target_link_libraries(example_with_full_vectorization_support PUBLIC proxsuite::proxsuite-vectorized)
target_compile_options(example_with_full_vectorization_support PUBLIC "-march=native")

My PC is Intel i7-11700 and ubuntu 18.04 ๏ผŒwhich should not cost too much time from given reference consumption.

In addition, I wonder how sqp performs under this same dense matrix?

Reimplement AMD under BSD-3

We are interested in adding ProxQP support to dairlib as a solver for MPC and whole-body control problems, and eventually to Drake as a supported solver. This requires being able to build against Eigen with the EIGEN_MPL2_ONLY flag enabled to comply with Drake's strict licensing rules.

I see from this comment that there are plans to make this happen.

I can continue with that build flag disabled for now, as I am highly unlikely to have the bandwidth to implement such a change anytime soon myself. I just wanted to let you know that the change would be greatly appreciated!

Thanks for the great software!

Unable to install the package

I am not able to install the package on my computer (intel7, windows 10). I have tried the both ways.
Pip:
ERROR: Could not find a version that satisfies the requirement proxsuit (from versions: none)
ERROR: No matching distribution found for proxsuit

Conda:
(base) C:\Users\Administrator>conda install proxsuite -c conda-forge
Collecting package metadata (current_repodata.json): failed

>>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<

Traceback (most recent call last):
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\gateways\repodata\__init__.py", line 132, in conda_http_errors
    yield
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\gateways\repodata\__init__.py", line 101, in repodata
    response.raise_for_status()
  File "C:\Users\Administrator\anaconda3\lib\site-packages\requests\models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://conda.anaconda.org/gurobi/win-64/current_repodata.json

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Administrator\anaconda3\lib\site-packages\requests\models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Users\Administrator\anaconda3\lib\site-packages\simplejson\__init__.py", line 525, in loads
    return _default_decoder.decode(s)
  File "C:\Users\Administrator\anaconda3\lib\site-packages\simplejson\decoder.py", line 372, in decode
    obj, end = self.raw_decode(s)
  File "C:\Users\Administrator\anaconda3\lib\site-packages\simplejson\decoder.py", line 402, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\exceptions.py", line 1124, in __call__
    return func(*args, **kwargs)
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\cli\main.py", line 69, in main_subshell
    exit_code = do_call(args, p)
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\cli\conda_argparse.py", line 91, in do_call
    return getattr(module, func_name)(args, parser)
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\notices\core.py", line 109, in wrapper
    return func(*args, **kwargs)
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\cli\main_install.py", line 20, in execute
    install(args, parser, 'install')
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\cli\install.py", line 264, in install
    unlink_link_transaction = solver.solve_for_transaction(
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\core\solve.py", line 132, in solve_for_transaction
    unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\core\solve.py", line 175, in solve_for_diff
    final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\core\solve.py", line 280, in solve_final_state
    ssc = self._collect_all_metadata(ssc)
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\common\io.py", line 84, in decorated
    return f(*args, **kwds)
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\core\solve.py", line 447, in _collect_all_metadata
    index, r = self._prepare(prepared_specs)
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\core\solve.py", line 1060, in _prepare
    reduced_index = get_reduced_index(self.prefix, self.channels,
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\core\index.py", line 267, in get_reduced_index
    new_records = SubdirData.query_all(spec, channels=channels, subdirs=subdirs,
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 124, in query_all
    result = tuple(chain.from_iterable(executor.map(subdir_query, channel_urls)))
  File "C:\Users\Administrator\anaconda3\lib\concurrent\futures\_base.py", line 609, in result_iterator
    yield fs.pop().result()
  File "C:\Users\Administrator\anaconda3\lib\concurrent\futures\_base.py", line 439, in result
    return self.__get_result()
  File "C:\Users\Administrator\anaconda3\lib\concurrent\futures\_base.py", line 391, in __get_result
    raise self._exception
  File "C:\Users\Administrator\anaconda3\lib\concurrent\futures\thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 113, in <lambda>
    subdir_query = lambda url: tuple(
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 129, in query
    self.load()
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 215, in load
    _internal_state = self._load()
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\core\subdir_data.py", line 323, in _load
    raw_repodata_str = self._repo.repodata(mod_etag_headers)
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\gateways\repodata\__init__.py", line 101, in repodata
    response.raise_for_status()
  File "C:\Users\Administrator\anaconda3\lib\contextlib.py", line 137, in __exit__
    self.gen.throw(typ, value, traceback)
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\gateways\repodata\__init__.py", line 179, in conda_http_errors
    raise RepodataIsEmpty(
  File "C:\Users\Administrator\anaconda3\lib\site-packages\conda\exceptions.py", line 461, in __init__
    body = response.json()
  File "C:\Users\Administrator\anaconda3\lib\site-packages\requests\models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

$ C:\Users\Administrator\anaconda3\Scripts\conda-script.py install proxsuite -c conda-forge

environment variables:
CIO_TEST=
CMAKE_PREFIX_PATH=C:\Users\Administrator\anaconda3\envs\formkl\Library\bin
CONDA_DEFAULT_ENV=base
CONDA_EXE=C:\Users\Administrator\anaconda3\condabin..\Scripts\conda.exe
CONDA_EXES="C:\Users\Administrator\anaconda3\condabin..\Scripts\conda.exe"
CONDA_PREFIX=C:\Users\Administrator\anaconda3
CONDA_PROMPT_MODIFIER=(base)
CONDA_PYTHON_EXE=C:\Users\Administrator\anaconda3\python.exe
CONDA_ROOT=C:\Users\Administrator\anaconda3
CONDA_SHLVL=1
CURL_CA_BUNDLE=
GIT_LFS_PATH=C:\Program Files\Git LFS
HOMEPATH=\Users\Administrator
LD_PRELOAD=
PATH=C:\Users\Administrator\anaconda3;C:\Users\Administrator\anaconda3\Libr
ary\mingw-w64\bin;C:\Users\Administrator\anaconda3\Library\usr\bin;C:
Users\Administrator\anaconda3\Library\bin;C:\Users\Administrator\anaco
nda3\Scripts;C:\Users\Administrator\anaconda3\bin;C:\Users\Administrat
or\anaconda3\condabin;C:\Users\Administrator\win64\bin;C:\Program
Files (x86)\Intel\oneAPI\tbb\latest\redist\intel64\vc_mt;C:\Program
Files (x86)\Intel\oneAPI\tbb\latest\redist\ia32\vc_mt;C:\Program Files
(x86)\Intel\oneAPI\compiler\latest\windows\redist\intel64_win\compiler
;C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\redist\ia
32_win\compiler;C:\Program
Files\Microsoft\jdk-11.0.12.7-hotspot\bin;C:\Program
Files\MiKTeX\miktex\bin\x64;C:\Program Files\Git LFS;C:\Program
Files\MATLAB\R2022b\bin;C:\Program Files\MATLAB\R2022a\bin;C:\Program
Files\CMake\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Intel
oneAPI\mkl\bin;C:\Users\Administrator\AppData\Local\Programs\Python\Py
thon36\Scripts;C:\Users\Administrator\AppData\Local\Programs\Python\Py
thon36;C:\Users\Administrator\AppData\Local\Microsoft\WindowsApps;C:\U
sers\Administrator\AppData\Local\GitHubDesktop\bin;C:\Windows\system32
;C:\Windows;C:\Windows\System32\wbem;C:\Windows\System32\WindowsPowerS
hell\v1.0
PSMODULEPATH=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\Windows
PowerShell\v1.0\Modules
REQUESTS_CA_BUNDLE=
SSL_CERT_FILE=

 active environment : base
active env location : C:\Users\Administrator\anaconda3
        shell level : 1
   user config file : C:\Users\Administrator\.condarc

populated config files : C:\Users\Administrator.condarc
conda version : 23.1.0
conda-build version : 3.22.0
python version : 3.9.13.final.0
virtual packages : __archspec=1=x86_64
__win=0=0
base environment : C:\Users\Administrator\anaconda3 (writable)
conda av data dir : C:\Users\Administrator\anaconda3\etc\conda
conda av metadata url : None
channel URLs : https://conda.anaconda.org/conda-forge/win-64
https://conda.anaconda.org/conda-forge/noarch
https://conda.anaconda.org/gurobi/win-64
https://conda.anaconda.org/gurobi/noarch
https://repo.anaconda.com/pkgs/main/win-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/win-64
https://repo.anaconda.com/pkgs/r/noarch
https://repo.anaconda.com/pkgs/msys2/win-64
https://repo.anaconda.com/pkgs/msys2/noarch
package cache : C:\Users\Administrator\anaconda3\pkgs
C:\Users\Administrator.conda\pkgs
C:\Users\Administrator\AppData\Local\conda\conda\pkgs
envs directories : C:\Users\Administrator\anaconda3\envs
C:\Users\Administrator.conda\envs
C:\Users\Administrator\AppData\Local\conda\conda\envs
platform : win-64
user-agent : conda/23.1.0 requests/2.28.1 CPython/3.9.13 Windows/10 Windows/10.0.18363
administrator : False
netrc file : None
offline mode : False

An unexpected error has occurred. Conda has prepared the above report.

If submitted, this report will be used by core maintainers to improve
future releases of conda.
Would you like conda to send this report to the core maintainers? [y/N]:

Do you have any ideas why this happen? Thank you.

Proxsuite import fails, name 'instructionset' is not defined

Hello dear proxsuite developers,

I am using a package with proxsuite as a dependency, but since yesterday, I cannot use it anymore as importing proxsuite fails.

Reproduce:

  1. Create a new docker image based on the follwing dockerfile and docker build -t proxsuite_debug .:
FROM python:3.10
RUN pip install --no-cache-dir proxsuite
CMD [ "python" ]
  1. Start a container (docker run -it --rm proxsuite_debug)
  2. run import proxsuite

Error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.10/site-packages/cmeel.prefix/lib/python3.10/site-packages/proxsuite/__init__.py", line 36, in <module>
    load_main_module(globals=globals())
  File "/usr/local/lib/python3.10/site-packages/cmeel.prefix/lib/python3.10/site-packages/proxsuite/__init__.py", line 25, in load_main_module
    ("proxsuite_pywrap_avx512", instructionset.has_AVX512F),
NameError: name 'instructionset' is not defined

Reason:
According to the platform docs, an empty string is a likely/frequent return for platform.processor(). However, looking at the init script, it is bound to fail if it does because instructionset is not imported.

Installing aarch64 binaries via pip

Hi There,

Thanks for the nice library! I'm currently using it with a humanoid (PAL REEM-C) and TSID. I was wondering whether aarch64 binaries are available for install via pip? I tried to do pip install proxsuite on Ubuntu 22.04 ARM64 version but am met with:

parallels@docker:~# pip install proxsuite
Defaulting to user installation because normal site-packages is not writeable
ERROR: Could not find a version that satisfies the requirement proxsuite (from versions: none)
ERROR: No matching distribution found for proxsuite

If helpful, I'm using Parallels 18 on an M1 MacBook Pro.

Thanks for your time!

Windows MSVC building failed with c++20

It works with c++17 but has error with c++20 on Windows MSVC(VisualStudio 2022 17.4.3). But will work with Clang15, both c++17 and c++20.
This is the CMakeLists.txt file.

cmake_minimum_required(VERSION 3.14)

project(proxqp_test)
set(CMAKE_VERBOSE_MAKEFILE ON)

include(FetchContent)
# set(FETCHCONTENT_UPDATES_DISCONNECTED ON)

FetchContent_Declare(
    simde
    GIT_REPOSITORY https://github.com/simd-everywhere/simde.git
    GIT_TAG v0.7.2
    GIT_SHALLOW    TRUE
)
FetchContent_MakeAvailable(simde)
set(Simde_INCLUDE_DIR ${simde_SOURCE_DIR})

set(BUILD_TESTING OFF CACHE INTERNAL "")
FetchContent_Declare(
    proxsuite
    GIT_REPOSITORY https://github.com/Simple-Robotics/proxsuite.git
    GIT_TAG v0.2.16
    GIT_SHALLOW    TRUE
)
FetchContent_MakeAvailable(proxsuite)

# find_package(proxsuite REQUIRED)

add_executable(app main.cpp)
target_link_libraries(app PUBLIC
  proxsuite
)
target_compile_features(app PUBLIC cxx_std_20)
target_compile_definitions(app PUBLIC NOMINMAX)
target_compile_options(app PUBLIC "/arch:AVX2")

The effect of eps_rel in the solver's settings is very strange.

I find that even changing the eps_rel from 0 to a very small value(e.g. eps_rel changes from 0 to 1e-15, eps_abs keeps 1e-4) can have a great impact on the results, some variables differ by more than 50%. But if I use OSQP to solve my problem, changing the solver's parameters from (eps_abs = 1e-4, eps_rel = 0) to (eps_abs = 1e-4, eps_rel = 1e-15,) makes little difference.
I'm not sure whether I understand this parameter incorrectly or whether there is some bugs about relative convergence condition in the ProxQP solver?

The dimension of my QP problem is about 500๏ผŒand the number of constraints is about 1000, more than 70% of the constraints is inequality constraints. Sparsity ratio is about 0.1.
Thank you!

Termination issue on QGFRDXPN problem

Same setting as in #62. ProxQP 0.2.2 does not seem to terminate on the QGFRDXPN problem from the Maros and Meszaros test set.

Reproduction steps

Clone qpsolvers_benchmark, then un:

$ python run_benchmark.py --problem QGFRDXPN --solver proxqp

Outcome on my machine: still running after 1 hour. (The maximum number of iterations should be the default 1e4.)

Details

Same as in #62.

Max number of iterations on small example

Trying out ProxQP 0.2.8 from PyPI today, it fails to pass unit tests in qpsolvers.

Reproducible example

Here is a small example that doesn't work:

import numpy as np
from qpsolvers import solve_qp

M = np.array([[1.0, 2.0, 0.0], [-8.0, 3.0, 2.0], [0.0, 1.0, 1.0]])
P = np.dot(M.T, M)  # this is a positive definite matrix
q = np.dot(np.array([3.0, 2.0, 3.0]), M)
G = np.array([[1.0, 2.0, 1.0], [2.0, 0.0, 1.0], [-1.0, 2.0, -1.0]])
h = np.array([3.0, 2.0, -2.0])
A = np.array([1.0, 1.0, 1.0])
b = np.array([1.0])

x = solve_qp(P, q, G, h, A, b, solver="proxqp")

Here is a reproducible version: decompress example.zip then run:

import numpy as np
import scipy.io as spio
from proxsuite import proxqp

m = spio.loadmat("example.mat", squeeze_me=True)
P = m["P"].astype(float)
q = m["q"].astype(float)
A = m["A"].astype(float).reshape((1, 3))
b = np.array([m["b"]]).reshape((1,))
C = m["C"].astype(float)
l = m["l"].astype(float)
u = m["u"].astype(float)

proxqp.dense.solve(P, q, A, b, C, l, u, verbose=True)

Observed outcomes

ProxQP 0.2.7

-------------------------------------------------------------------------------------------------

                              ProxQP  -  Primal Dual Proximal QP Solver
     (c) Antoine Bambade, Sarah El Kazdadi, Fabian Schramm, Adrien Taylor, Justin Carpentier
                                         Inria Paris 2022        

-------------------------------------------------------------------------------------------------

problem:  
          variables n = 3, equality constraints n_eq = 1,
          inequality constraints n_in = 3
settings: 
          backend = dense,
          eps_abs = 1e-05 eps_rel = 0
          eps_prim_inf = 0.0001, eps_dual_inf = 0.0001,
          rho = 1e-06, mu_eq = 0.001, mu_in = 0.1,
          max_iter = 10000, max_iter_in = 1500,
          scaling: on, 
          timings: on, 
          initial guess: equality constrained initial guess. 

...
-------------------SOLVER STATISTICS-------------------
outer iter:   5
total iter:   5
mu updates:   0
rho updates:  0
objective:    -2.31e+00
status:       Solved
run time:     4.44e+03
--------------------------------------------------------

ProxQP 0.2.8

-------------------------------------------------------------------------------------------------

                              ProxQP  -  Primal Dual Proximal QP Solver
     (c) Antoine Bambade, Sarah El Kazdadi, Fabian Schramm, Adrien Taylor, Justin Carpentier
                                         Inria Paris 2022

-------------------------------------------------------------------------------------------------

problem:
          variables n = 3, equality constraints n_eq = 1,
          inequality constraints n_in = 3
settings:
          backend = dense,
          eps_abs = 1e-05 eps_rel = 0
          eps_prim_inf = 0.0001, eps_dual_inf = 0.0001,
          rho = 1e-06, mu_eq = 0.001, mu_in = 0.1,
          max_iter = 10000, max_iter_in = 1500,
          scaling: on,
          timings: on,
          initial guess: equality constrained initial guess.

...
-------------------SOLVER STATISTICS-------------------
outer iter:   10000
total iter:   10000
mu updates:   0
rho updates:  0
objective:    -2.31e+00
status:       Maximum number of iterations reached
run time:     1.74e+05
--------------------------------------------------------

Memory allocations

Hello!

I'm wondering what is required to use ProxyQP without performing any memory allocations during runtime. For my specific problems, I know the matrix sizes before-hand, but the sparsity pattern of these matrices may change in-between calls and the non-zero elements may change to different values (e.g. some constraint rows may become zero).

I'm aware that a related issue was fixed in the past, but I'm wondering under which assumptions this holds. Under which cases would ProxyQP need to allocate memory? For example, would ProxyQP need to allocate memory if the sparsity pattern of the constraint matrix changes between two calls to the solver?

Thanks!

updating LDL cholesky decomposition

I have one question that when penalization parameter $\mu_e$ changed, how to update LDL cholesky decomposition. It seems that when penalization parameter $\mu_e$ changed, the problem is how to update LDL cholesky decomposition with respect to adding an diagonal matrix with size of number of equality constrains., which should be different from updating LDL cholesky decomposition with rows and colmns added.

Broken link in the README

There is a broken link in the README, pointing to a repository from @Bambade that is likely not set to Public yet:

The numerical benchmarks of ProxQP against other commercial and open-source solvers are available here.

Can't wait to try out ProxQP!

Julia bindings?

Hi there - not sure if you remember me, but we talked at your poster at RSS yesterday. I'm a relatively recent C++ => Julia convert, and I would love to use your solver in Julia. Thanks so much for the great work, and keep it up!

Regression on QFORPLAN problem?

ProxQP 0.2.2 used to solve the QFORPLAN problem with the following timings on my machine (reproduction code below):

$ pip install proxsuite==0.2.2
Defaulting to user installation because normal site-packages is not writeable
...
Successfully installed proxsuite-0.2.2
$ python reprod.py
Solving dense...
Time: 24.1527040459996 s
Solving sparse...
Time: 5.297871345999738 s

Now with ProxQP 0.2.4 it does not terminate after at least 7 min:

$ pip install proxsuite==0.2.4
Defaulting to user installation because normal site-packages is not writeable
...
Successfully installed proxsuite-0.2.4
$ python reprod.py
Solving dense...

Reproduction

Decompress QFORPLAN.mat from QFORPLAN.zip then run:

from time import perf_counter

import proxsuite
import scipy.io as spio
import scipy.sparse as spa

m = spio.loadmat("QFORPLAN.mat", squeeze_me=True)
P = m["P"].astype(float)
q = m["q"].astype(float)
A = m["A"].astype(float)
b = m["b"].astype(float)
C = m["C"].astype(float)
l = m["l"].astype(float)
u = m["u"].astype(float)
print("Solving dense...")
start = perf_counter()
proxsuite.proxqp.dense.solve(P, q, A, b, C, l, u)
print(f"Time: {perf_counter() - start} s")

P = spa.csc_matrix(P)
A = spa.csc_matrix(A)
C = spa.csc_matrix(C)
print("Solving sparse...")
start = perf_counter()
proxsuite.proxqp.sparse.solve(P, q, A, b, C, l, u)
print(f"Time: {perf_counter() - start} s")

Ship dependencies with FetchContent or CPM

Hello Again,

As a user, it would save me a lot a time if the dependencies could be added automatically, to avoid having to install them manually.
It would make the repo self-contained.

Proposed Solution

Use FetchContent (or CPM) to handle external dependencies.

It would look like this:

include(FetchContent)

# cmake modules
FetchContent_Declare(
cmake_modules
GIT_URL https://github.com/jrl-umi3218/jrl-cmakemodules.git
GIT_TAG 9403226002b930d592ca83b50d3cd714a1c2dc01
SOURCE_DIR cmake_modules
)
FetchContent_MakeAvailable(cmake_modules)

# eigen
FetchContent_Declare(
  Eigen
  GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git
  GIT_TAG 3.4.0
  GIT_SHALLOW TRUE
  GIT_PROGRESS TRUE)
set(EIGEN_BUILD_DOC OFF)
set(EIGEN_BUILD_TESTING OFF)
set(EIGEN_BUILD_PKGCONFIG OFF)
FetchContent_MakeAvailable(Eigen)

target_link_libraries(proxsuite PRIVATE Eigen3::Eigen)

Same for smide etc.
Good things:

What do you think ?

pip install picks up 0.2.13 instead of 0.3.4

I don't understand why, since 0.2.14 and ulterior are listed in https://pypi.org/pypi/proxsuite/json, but on both Ubuntu 20.04 machines I tested this on pip picks up version 0.2.13 as the latest one.

  • pip version: 23.0.1
$ pip index versions proxsuite
WARNING: pip index is currently an experimental command. It may be removed/changed in a future release without prior warning.
proxsuite (0.2.13)
Available versions: 0.2.13, 0.2.12, 0.2.11, 0.2.10, 0.2.9, 0.2.8, 0.2.7, 0.2.6, 0.2.5, 0.2.4, 0.2.2, 0.2.1, 0.2.0, 0.1.2, 0.1.1, 0.1.0, 0.0.1, 0.0.0
  INSTALLED: 0.2.13
  LATEST:    0.2.13

@nim65s @fabinsch Do you have an idea what could be causing this discrepancy?

[cmake] Hardcoded path in install space

Hello Again,

The cmake config and targets contains some hardcoded-machine-dependant paths, making portability difficult.

image

NOTE: To my biggest surprise, the pkgconfig is generic. it's usually the other way around

Error: pip install seems not to work,

(base) z00617747@huawei:/software$ pip install proxsuite-0.3.4-0-cp38-cp38-manylinux_2_35_x86_64.whl
ERROR: proxsuite-0.3.4-0-cp38-cp38-manylinux_2_35_x86_64.whl is not a supported wheel on this platform.
(base) z00617747@huawei:
/software$ pip --version
pip 21.0.1 from /home/z00617747/anaconda3/lib/python3.8/site-packages/pip (python 3.8)
my platform is Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-197-generic x86_64)

[python] Unregistered type QPSolverOutput

Trying to get results.status.info from an example from the docs yields:

TypeError: Unregistered type : proxsuite::proxqp::QPSolverOutput

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "test_prox.py", line 40, in <module>
    print(results.info.status)
TypeError: Unable to convert function return value to a Python type! The signature was
	(self: proxsuite.proxsuite_pywrap_avx2.proxqp.Info) -> proxsuite::proxqp::QPSolverOutput

Here is the example from the docs with the extra print instruction:

import proxsuite
import numpy as np
import scipy.sparse as spa

def generate_mixed_qp(n, seed=1):
    # A function for generating random convex Qps

    np.random.seed(seed)
    n_eq = int(n / 4)
    n_in = int(n / 4)
    m = n_eq + n_in

    P = spa.random(
        n, n, density=0.075, data_rvs=np.random.randn, format="csc"
    ).toarray()
    P = (P + P.T) / 2.0

    s = max(np.absolute(np.linalg.eigvals(P)))
    P += (abs(s) + 1e-02) * spa.eye(n)
    P = spa.coo_matrix(P)
    q = np.random.randn(n)
    A = spa.random(m, n, density=0.15, data_rvs=np.random.randn, format="csc")
    v = np.random.randn(n)  # Fictitious solution
    delta = np.random.rand(m)  # To get inequality
    u = A @ v
    l = -1.0e20 * np.ones(m)

    return P, q, A[:n_eq, :], u[:n_eq], A[n_in:, :], u[n_in:], l[n_in:]


# load a Qp object using Qp problem dimensions
n = 10
n_eq = 2
n_in = 2
H, g, A, b, C, u, l = generate_mixed_qp(n)

# solve the problem using the sparse backend
results = proxsuite.proxqp.sparse.solve(H, g, A, b, C, u, l)
print(results.info.status)

Regression on LISWET3 problem?

I can post a more detailed report, but just an early warning that the LISWET3 from Maros-Meszaros used to perform as follows on my machine with ProxQP 0.2.7:

  • Default settings: solved in 146 seconds
  • With eps_abs=1e-3: solved in 3.16 seconds
  • With eps_abs=1e-9: not solved (at least not in <= 1000 seconds)

However it does not solve with default settings with ProxQP 0.3.0 (at least not in <= 1000 seconds).

Comparison caveat: I was running proxsuite==0.2.7 from PyPI while now I'm running ``proxsuite=0.3.0` from conda.

Extra context

Tabular details on ProxQP 0.2.7 performance:

problem solver settings runtime found primal_residual dual_residual duality_gap cost_error
LISWET3 proxqp default 145.59669646402472 True 8.24151833156428e-06 9.650276648620616e-08 0.0003489140499368 0.0008056529543516
LISWET3 proxqp high_accuracy 0.0 False inf inf inf
LISWET3 proxqp low_accuracy 3.162652347004041 True 0.0008081155198323 1.0899415509024736e-08 0.0419660059992565 0.0448540420093301

Build code without git history

The Installation instructions in the official document use "git clone https://github.com/Simple-Robotics/proxsuite.git --recursive" to get the source code.

If I download the source code from releases directly (e.g. https://github.com/Simple-Robotics/proxsuite/archive/refs/tags/v0.2.7.tar.gz) and compile it, following error will be reported.
image

I think the main difference is that there is no git history for downloading source code from the releases.
How to solve this issue?
Thank you!

Absolute duality gap stopping criterion

Looking at these preliminary results, ProxQP appears less good than the other solvers in enforcing the duality gap (which is also affecting its success rate). It could be however that the solver is converging fine, but its internal duality-gap absolute stopping criterion is relaxed compared to the contract ๐Ÿ‘‡

(Sorry if I'm missing something, just checking ๐Ÿ˜Š)

In both backends there is a test:

    if (is_primal_feasible && is_dual_feasible) {
      if (qpsettings.check_duality_gap) {
        if (std::abs(qpresults.info.duality_gap) <=
            qpsettings.eps_abs + qpsettings.eps_rel * rhs_duality_gap) {

Both lhs and rhs duality are scaled by sqrt_max_dim in the backend's utils.hpp:

  duality_gap /= sqrt_max_dim; // in order to get an a-dimensional duality gap
  rhs_duality_gap /= sqrt_max_dim;

So the relative stopping criterion is the same as in e.g. SCS. But then isn't the absolute stopping criterion relaxed to $r_g \leq \epsilon_{abs} \sqrt{d}$ instead of $r_g \leq \epsilon_{abs}$? (Denoting by $r_g$ the unscaled duality gap.)

I understand there is an argument about making the gap adimensional. However, this makes benchmarking ProxQP against other solvers more difficult, unless there were a way to set eps_abs_gap and eps_rel_gap (noooo ๐Ÿ™ˆ)

Error related to simde when building from source

When installing from source I get the following error

>>> cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF
-- Package version (ROS package.xml): 0.2.6
-- The CXX compiler identification is GNU 9.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1")
-- Performing Test R-pedantic
-- Performing Test R-pedantic - Success
-- Performing Test R-Wno-long-long
-- Performing Test R-Wno-long-long - Success
-- Performing Test R-Wall
-- Performing Test R-Wall - Success
-- Performing Test R-Wextra
-- Performing Test R-Wextra - Success
-- Performing Test R-Wcast-align
-- Performing Test R-Wcast-align - Success
-- Performing Test R-Wcast-qual
-- Performing Test R-Wcast-qual - Success
-- Performing Test R-Wformat
-- Performing Test R-Wformat - Success
-- Performing Test R-Wwrite-strings
-- Performing Test R-Wwrite-strings - Success
-- Performing Test R-Wconversion
-- Performing Test R-Wconversion - Success
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
CMake Warning at cmake-module/doxygen.cmake:494 (message):
  Failed to find Doxygen, documentation will not be generated.
Call Stack (most recent call first):
  cmake-module/post-project.cmake:59 (_setup_project_documentation)
  CMakeLists.txt:41 (project)


-- CMAKE_SYSTEM_PROCESSOR: x86_64
CMake Error at /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
  Could NOT find Simde (missing: Simde_INCLUDE_DIR)

      Reason given by package: Set BUILD_WITH_VECTORIZATION_SUPPORT=OFF or install Simde on your system.
   If Simde is already installed, ensure that the CMake variable CMAKE_MODULE_PATH correctly points toward the location of FindSimde.cmake file.

Call Stack (most recent call first):
  /usr/share/cmake-3.16/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
  cmake-module/find-external/Simde/FindSimde.cmake:12 (find_package_handle_standard_args)
  cmake-module/package-config.cmake:110 (find_package)
  CMakeLists.txt:95 (add_project_dependency)


-- Configuring incomplete, errors occurred!
See also "/home/bolun/Documents/proxsuite/build/CMakeFiles/CMakeOutput.log".

Would it be possible to provide some instructions on what is the suggested way to install simde?

Thanks in advance.

Error after upgrading from 0.2.7 to 0.2.10

Hi,

I was running my code here. And I noticed that even though I did not change anything, after upgrading ProxSuite from v0.2.7 to v0.2.10 I get the following error:

terminate called after throwing an instance of 'std::invalid_argument'
  what():  From file: /home/bolun/miniconda3/envs/fr3_env/include/proxsuite/proxqp/dense/wrapper.hpp
in function: void proxsuite::proxqp::dense::QP<T>::init(proxsuite::optional<Eigen::Ref<const Eigen::Matrix<LhsScalar, -1, -1, 1>, 0, typename Eigen::internal::conditional<const Eigen::Matrix<LhsScalar, -1, -1, 1>::IsVectorAtCompileTime, Eigen::InnerStride<1>, Eigen::OuterStride<> >::type> >, proxsuite::optional<Eigen::Ref<const Eigen::Matrix<Scalar, -1, 1> > >, proxsuite::optional<Eigen::Ref<const Eigen::Matrix<LhsScalar, -1, -1, 1>, 0, typename Eigen::internal::conditional<const Eigen::Matrix<LhsScalar, -1, -1, 1>::IsVectorAtCompileTime, Eigen::InnerStride<1>, Eigen::OuterStride<> >::type> >, proxsuite::optional<Eigen::Ref<const Eigen::Matrix<Scalar, -1, 1> > >, proxsuite::optional<Eigen::Ref<const Eigen::Matrix<LhsScalar, -1, -1, 1>, 0, typename Eigen::internal::conditional<const Eigen::Matrix<LhsScalar, -1, -1, 1>::IsVectorAtCompileTime, Eigen::InnerStride<1>, Eigen::OuterStride<> >::type> >, proxsuite::optional<Eigen::Ref<const Eigen::Matrix<Scalar, -1, 1> > >, proxsuite::optional<Eigen::Ref<const Eigen::Matrix<Scalar, -1, 1> > >, bool, proxsuite::optional<T>, proxsuite::optional<T>, proxsuite::optional<T>) [with T = double; proxsuite::optional<Eigen::Ref<const Eigen::Matrix<LhsScalar, -1, -1, 1>, 0, typename Eigen::internal::conditional<const Eigen::Matrix<LhsScalar, -1, -1, 1>::IsVectorAtCompileTime, Eigen::InnerStride<1>, Eigen::OuterStride<> >::type> > = std::optional<Eigen::Ref<const Eigen::Matrix<double, -1, -1, 1, -1, -1>, 0, Eigen::OuterStride<> > >; typename Eigen::internal::conditional<const Eigen::Matrix<LhsScalar, -1, -1, 1>::IsVectorAtCompileTime, Eigen::InnerStride<1>, Eigen::OuterStride<> >::type = Eigen::OuterStride<>; proxsuite::optional<Eigen::Ref<const Eigen::Matrix<Scalar, -1, 1> > > = std::optional<Eigen::Ref<const Eigen::Matrix<double, -1, 1>, 0, Eigen::InnerStride<1> > >; typename Eigen::internal::conditional<const Eigen::Matrix<Scalar, -1, 1>::IsVectorAtCompileTime, Eigen::InnerStride<1>, Eigen::OuterStride<> >::type = Eigen::InnerStride<1>; proxsuite::optional<T> = std::optional<double>]
at line: 138
wrong argument size: expected 0, got 14
hint: the dimension wrt the primal variable x variable for initializing g is not valid.

After downgrading to v0.2.7 the error goes away. Any idea what might cause this error? Is this a bug in ProxSuite?

Order of arguments in c++ api

So far, the order of arguments to describe the inequality constraints l <= C x <= u is C, u, l which is not very intuitive and different fron the common C, l, u.
If it is still time to fix the order, it would avoid surprises for the user.

Work on memory allocations

With #92 and #100 we start to fix some of the remaining memory allocations in the dense backend. Proxsuite v0.2.7, containing these fixes, seems to be around 8% faster on our benchmarks. With #93 we add an option to easily check for allocations and we use the pipeline [conda:macos-latest:Debug:c++17] with the new option CHECK_RUNTIME_MALLOC. We can still see some unittests failing when we are not allowing for memory allocations.
In this commit, we identify all the places in the dense backend that need to allow for memory allocations to make all unittests pass. We should therefore understand if and how these can be fixed.

The remaining allocations seem to be coming from multiplications of Eigen::Maps.

Segmentation fault on a sparse problem

  • ProxSuite 0.0.1 installed from PyPI

The following sparse problem leads to a segmentation fault on my machine:

import numpy as np
import proxsuite
import scipy.sparse as spa

n = 150
M = spa.lil_matrix(spa.eye(n))
for i in range(1, n - 1):
    M[i, i + 1] = -1
    M[i, i - 1] = 1

H = spa.csc_matrix(M.dot(M.transpose()))
g = -np.ones((n,))
A = []
b = []
C = spa.csc_matrix(spa.eye(n))
l = 2.0 * np.ones((n,))
u = np.full(l.shape, +np.infty)

results = proxsuite.proxqp.sparse.solve(H, g, A, b, C, u, l)

(The solution to this problem is np.array([2.0] * 149 + [3.0]).)

[cmake] add_library INTERFACE library requires no source arguments

  • CMake version: 3.16.3 (> 3.10)

I ran into the following issue when trying to build from source:

$ cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DBUILD_WITH_VECTORIZATION_SUPPORT=OFF
-- Package version (ROS package.xml): 0.0.1
-- The CXX compiler identification is GNU 9.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.29.1") 
-- Performing Test R-pedantic
-- Performing Test R-pedantic - Success
-- Performing Test R-Wno-long-long
-- Performing Test R-Wno-long-long - Success
-- Performing Test R-Wall
-- Performing Test R-Wall - Success
-- Performing Test R-Wextra
-- Performing Test R-Wextra - Success
-- Performing Test R-Wcast-align
-- Performing Test R-Wcast-align - Success
-- Performing Test R-Wcast-qual
-- Performing Test R-Wcast-qual - Success
-- Performing Test R-Wformat
-- Performing Test R-Wformat - Success
-- Performing Test R-Wwrite-strings
-- Performing Test R-Wwrite-strings - Success
-- Performing Test R-Wconversion
-- Performing Test R-Wconversion - Success
-- Found Doxygen: /usr/bin/doxygen (found version "1.8.17") found components: doxygen dot 
CMake Error at CMakeLists.txt:100 (add_library):
  add_library INTERFACE library requires no source arguments.


CMake Error at CMakeLists.txt:101 (target_link_libraries):
  Cannot specify link libraries for target "proxsuite" which is not built by
  this project.


-- Configuring incomplete, errors occurred!

Maybe the cmake_minimum_required version should be bumped?

Maximum iterations reached on unconstrained least squares

Here is an unconstrained least squares that seems hard to solve (but is solvable).

Reproduction steps

  • Install proxsuite in a fresh conda environment (currently 0.2.13)
  • Run the following script:
import numpy as np
import proxsuite

n = 1000
M = np.array(range(n * n), dtype=float).reshape((n, n))
P = np.dot(M.T, M)  # this is a positive definite matrix
q = np.dot(np.ones(n, dtype=float), M)
result = proxsuite.proxqp.dense.solve(P, q, verbose=True)

The outcome is:

...
-------------------SOLVER STATISTICS-------------------
outer iter:   10000
total iter:   10000
mu updates:   0
rho updates:  1
objective:    -5.00e+02
status:       Maximum number of iterations reached
run time:     3.52e+07
--------------------------------------------------------

Solution to this problem

This problem is $\min \Vert M x + 1 \Vert^2$, which has a solution:

x = [5.99997604e-06, 5.98793961e-06, 5.97590323e-06, 5.96386857e-06,  ..., -5.95216208e-06, -5.96412719e-06, -5.97609110e-06, -5.98805638e-06]

such that np.allclose(M.dot(x), -1) == True. (This one was found by OSQP.)

See also

This test arose from this discussion. OSQP is the only solver I can find today that solves it successfully.

Linear programming question

In the README, you write about LPs and QPs. As far as I understand, you currently only have a QP interface, but it can of course also be used for solving LPs by letting P be a matrix of zeros. Is this how you intend to solve LPs, or are you planning on making an LP interface?

I am quite impressed with your QP solver so far. It also seems to have good performance on LPs, but it might be possible to improve further if it has its own interface.

Segmentation fault on HUESTIS problem

While reproducing the Maros-Meszaros test set in qpsolvers_benchmark, I ran into a segmentation fault with ProxQP 0.2.2 on the HUESTIS problem.

Reproduction steps

Clone qpsolvers_benchmark, then un:

$ python run_benchmark.py --problem HUESTIS --solver proxqp

Outcome on my machine:

Running problem HUESTIS with proxqp...
[1]    89986 segmentation fault (core dumped)  python run_benchmark.py --problem HUESTIS --solver proxqp

Details

The .mat files are the ones from proxqp_benchmark.

They are separated into constraint $l \leq C x \leq u$ and box $lb \leq x \leq ub$ inequalities in from_mat_file, then extract equality constraints in from_double_sided_ineq. Those will be finally converted back to ProxQP format $l \leq C x \leq u$ by qpsolvers in proxqp_combine_inequalities. There may be something wrong in these back-and-forth conversions, but at any rate, it results in a reproducible segfault for ProxQP.

I haven't checked whether HUESTIS is solved fine in proxqp_benchmark (can do, just some extra work to get the benchmark working without Mosek or qpOASES installed).

cmake error when building on windows

I am trying to use proxsuite via cmake 'FetchContent' command. But something wrong.

[cmake] fatal: not a git repository (or any of the parent directories): .git
[cmake] -- Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE) 
[cmake] -- CMAKE_SYSTEM_PROCESSOR: AMD64
[cmake] CMake Error at build/_deps/proxsuite-src/cmake-module/logging.cmake:118 (file):
[cmake]   file failed to open for writing (Invalid argument):
[cmake] 
[cmake]     E:/mycode/proxqp/## ---------------- ##
[cmake] 
[cmake] Call Stack (most recent call first):
[cmake]   build/_deps/proxsuite-src/cmake-module/base.cmake:323 (logging_finalize)
[cmake]   build/_deps/proxsuite-src/cmake-module/base.cmake:207 (setup_project_finalize)
[cmake]   CMakeLists.txt:2147483647 (SETUP_PROJECT_FINALIZE_HOOK)
[cmake] 
[cmake] 
[cmake] -- Configuring incomplete, errors occurred!

This is my CMakeLists.txt

cmake_minimum_required(VERSION 3.14)

project(proxqp_test)

include(FetchContent)
set(FETCHCONTENT_UPDATES_DISCONNECTED ON)

FetchContent_Declare(
    simde
    GIT_REPOSITORY https://github.com/simd-everywhere/simde.git
    GIT_TAG v0.7.2
    GIT_SHALLOW    TRUE
)
FetchContent_MakeAvailable(simde)
set(Simde_INCLUDE_DIR ${simde_SOURCE_DIR}/simde)

set(DISABLE_TESTS ON)
set(BUILD_TESTING OFF)
FetchContent_Declare(
    proxsuite
    GIT_REPOSITORY https://github.com/Simple-Robotics/proxsuite.git
    GIT_TAG v0.2.15
)
FetchContent_MakeAvailable(proxsuite)

Please help me figure it out. Thanks.

Linearly dependent constraints

Thanks, guys. This solver is much faster than any others in my project. However, when I do a test of adding many linearly dependent constraints, the speed of solver will be slown down. Would you mind giving any advice to handle this?

Unintended heap allocations

ProxQP does a lot of work to avoid heap allocations. However, I found that some heap allocations are still performed after the initialization. Here is the call graph with the functions that allocate from the heap during solve():

callgraph

Steps to reproduce:

  • Take any QP (e.g. from testcases)
  • Compile with:
    • Eigen 3.3.4
    • -O0 -g -DNDEBUG -std=gnu++17 -DPROXSUITE_VECTORIZE
  • valgrind --tool=massif --xtree-memory=full <name_to_executable_to_examine>
  • kcachegrind <name_of_output>

Desired behavior

ProxQP does not generate any heap allocations during solve. This is essential for running ProxQP on resource-constrained devices or under real-time constraints.

Make Documentation optional to avoid a warning

Hello,
I'm trying to build proxsuite on a system without doxygen, I get:

-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
CMake Warning at cmake-module/doxygen.cmake:494 (message):
  Failed to find Doxygen, documentation will not be generated.
Call Stack (most recent call first):
  cmake-module/post-project.cmake:59 (_setup_project_documentation)
  CMakeLists.txt:45 (project)

Proposed solution

Add a BUILD_DOCUMENTATION cmake option to it does not even bother to search for doxygen and display a warning.

Official release of ProxQP

We are hardly working on polishing ProxQP, the generic purposed and efficient QP solver for robotics and beyond.
In the meantime, we invite you to read the related paper to familiarize yourself with the concepts.
You can follow this issue to be updated when the solver will be officially released.

Thanks for your interest in using ProxQP,

The ProxSuite team.

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.