Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
241529f
changed directory and fixed dependency issues
lb3825 Jul 29, 2025
1645338
added python executable to run maros_meszaros problems
lb3825 Aug 1, 2025
45cc522
Updated bindings. Streamelined the generation of all possible combina…
lb3825 Aug 17, 2025
ffc6465
Drop files from .gitignore
lb3825 Aug 17, 2025
384f8a0
added ability to adjust combinations from command line
lb3825 Aug 17, 2025
4be13da
Restructured combination computation and added trackign of iter counter
lb3825 Aug 18, 2025
1c7dae5
Added mailing system, multi-threading, parallelism, and optuna implem…
lb3825 Aug 20, 2025
9184ef8
added pruning, removed most print statements, added infeasibility tar…
lb3825 Aug 24, 2025
431a491
updated bindings to include pid controller and added macros
lb3825 Aug 25, 2025
c24aec9
fixed objective function
lb3825 Aug 25, 2025
6c1e33d
new objective metric
lb3825 Aug 27, 2025
2ca2682
fixed bindings issue
lb3825 Aug 27, 2025
08aa345
updated bindings, pruning criteria, negating pid controller parameter…
lb3825 Aug 27, 2025
db4ae1c
updated optuna hyperparamter choices and all print statements
lb3825 Aug 31, 2025
f3a0222
updated bindings, updated integral_geom to be logarithmic and have a …
lb3825 Sep 5, 2025
b2a1282
test
lb3825 Sep 5, 2025
29a0220
made it possible to load in MIPLIB and Mittelman probs
lb3825 Sep 10, 2025
cacd8f4
added miplib and mittelman to the call for PROBLEM_NAME=ALL
lb3825 Sep 10, 2025
07f76ad
added mittelman, miplib, and netlib problems and their exclusions
lb3825 Sep 16, 2025
2157325
test
lb3825 Oct 14, 2025
603054f
updating maros_meszaros_benchmarks
lb3825 Nov 3, 2025
58cb77b
Cleaning and moving
lb3825 Nov 6, 2025
8268ec2
Updated bindings and added print statements to benchamrks
lb3825 Nov 7, 2025
f4e6ce0
Updated some pruning behavior
lb3825 Nov 12, 2025
4f8c342
changed ci rules to run on develop branches
bstellato Nov 16, 2025
fe7a6b1
use cudss branch in cmake
bstellato Nov 16, 2025
2d23667
try to first make CI pass before rebasing
bstellato Nov 16, 2025
94836b2
updated gitignore
bstellato Nov 16, 2025
6952ba1
Fix warm_start test to accommodate rho persistence
bstellato Nov 16, 2025
6d83d21
fix pre-commit issues
bstellato Nov 16, 2025
8952a99
Use Development.Module for CMake Python finding
bstellato Nov 16, 2025
12b4ad9
Removed benchmarks files
lb3825 Nov 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/build_cuda.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ name: Build CUDA Linux

on:
push:
branches:
- master
branches: [ master, develop**, ci ]
tags:
- '*'
pull_request:
branches:
- master
branches: [ master, develop** ]

jobs:
build_wheels:
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/build_cuda_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ name: Build CUDA Windows

on:
push:
branches:
- master
branches: [ master, develop**, ci ]
tags:
- '*'
pull_request:
branches:
- master
branches: [ master, develop** ]

env:
CUDATOOLKIT_URL: https://developer.download.nvidia.com/compute/cuda/12.6.3/local_installers/cuda_12.6.3_561.17_windows.exe
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/build_default.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ name: Build Default

on:
push:
branches:
- master
branches: [ master, develop**, ci ]
tags:
- '*'
pull_request:
branches:
- master
branches: [ master, develop** ]

jobs:
build_sdist:
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/build_mkl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ name: Build MKL Mac/Linux

on:
push:
branches:
- master
branches: [ master, develop**, ci ]
tags:
- '*'
pull_request:
branches:
- master
branches: [ master, develop** ]

jobs:
build_wheels:
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/build_mkl_windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ name: Build MKL Windows

on:
push:
branches:
- master
branches: [ master, develop**, ci ]
tags:
- '*'
pull_request:
branches:
- master
branches: [ master, develop** ]

env:
# update urls for oneapi packages according to
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/build_wasm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,11 @@ name: Build WASM

on:
push:
branches:
- master
branches: [ master, develop**, ci ]
tags:
- '*'
pull_request:
branches:
- master
branches: [ master, develop** ]

jobs:
build_wheels:
Expand Down
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,3 +129,17 @@ src/osqp/_version.py

# files that are modified in the build process
src/osqp/bindings.cpp



CMakeFiles/
INSTALL.vcxproj
INSTALL.vcxproj.filters
ZERO_CHECK.vcxproj
ZERO_CHECK.vcxproj.filters
cmake_install.cmake
ext.sln
ext_builtin.vcxproj
ext_builtin.vcxproj.filters
src/bindings.cpp
CLAUDE.md
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
exclude: '^(benchmarks|examples)/'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
Expand Down
47 changes: 43 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ project(ext)

set(PYTHON "ON")
set(OSQP_BUILD_UNITTESTS "OFF")
set(OSQP_USE_LONG "OFF")
# set(OSQP_USE_LONG "OFF")
set(OSQP_USE_LONG "ON")
set(OSQP_CUSTOM_PRINTING "${CMAKE_CURRENT_SOURCE_DIR}/cmake/printing.h")
set(OSQP_CUSTOM_MEMORY "${CMAKE_CURRENT_SOURCE_DIR}/cmake/memory.h")
set(OSQP_CODEGEN_INSTALL_DIR "codegen/codegen_src" CACHE PATH "" FORCE)
Expand All @@ -17,7 +18,25 @@ include(FetchContent)
# 03/05/24 - Use modern python discovery
set(PYBIND11_FINDPYTHON "ON")

find_package(pybind11 CONFIG REQUIRED)
# Try to find pybind11, if not found, fetch it
find_package(pybind11 CONFIG QUIET)
if(NOT pybind11_FOUND)
message(STATUS "pybind11 not found, fetching from GitHub...")
FetchContent_Declare(
pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11.git
GIT_TAG v2.11.1
)
FetchContent_MakeAvailable(pybind11)
else()
message(STATUS "Found pybind11: ${pybind11_DIR}")
endif()

# find_package(pybind11 CONFIG REQUIRED)

# Find Python before configuring OSQP
# Use Development.Module for better CMake 4.0+ compatibility
find_package(Python COMPONENTS Interpreter Development.Module REQUIRED)

# 03/05/24 - Workaround because OSQP CMakeLists.txt is using old variable names
set(PYTHON_FOUND "ON")
Expand All @@ -27,12 +46,32 @@ message(STATUS "Fetching/configuring OSQP")
list(APPEND CMAKE_MESSAGE_INDENT " ")
FetchContent_Declare(
osqp
GIT_REPOSITORY https://github.com/osqp/osqp.git
GIT_TAG v1.0.0
# GIT_REPOSITORY https://github.com/osqp/osqp.git
GIT_REPOSITORY https://github.com/lb3825/osqp.git
# SOURCE_DIR "C:/Users/baice/Documents/GitHub/osqp"
# SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../osqp"
# GIT_TAG v1.0.0
GIT_TAG b/develop-halpern-ci-fixes
# GIT_TAG plot
)
list(POP_BACK CMAKE_MESSAGE_INDENT)
FetchContent_MakeAvailable(osqp)

# Define the module name if not already set
if(NOT DEFINED OSQP_EXT_MODULE_NAME)
set(OSQP_EXT_MODULE_NAME "osqp")
endif()

if(${OSQP_ALGEBRA_BACKEND} STREQUAL "builtin")
set(OSQP_EXT_MODULE_NAME "ext_builtin")
elseif(${OSQP_ALGEBRA_BACKEND} STREQUAL "mkl")
set(OSQP_EXT_MODULE_NAME "osqp_mkl")
elseif(${OSQP_ALGEBRA_BACKEND} STREQUAL "cuda")
set(OSQP_EXT_MODULE_NAME "osqp_cuda")
else()
set(OSQP_EXT_MODULE_NAME "osqp")
endif()

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/bindings.cpp.in
${CMAKE_CURRENT_SOURCE_DIR}/src/bindings.cpp)
pybind11_add_module(${OSQP_EXT_MODULE_NAME} src/bindings.cpp)
Expand Down
14 changes: 14 additions & 0 deletions run_with_probname.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@echo off
setlocal enabledelayedexpansion

set PROBNAME=%1
set STARTDIR=%CD%

cd examples
@REM py maros_meszaros_benchmarks.py !PROBNAME!
cd ..\..

cd osqp
py .\plot\plot.py !PROBNAME! 3

cd /d !STARTDIR!
58 changes: 57 additions & 1 deletion src/bindings.cpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,26 @@ PYBIND11_MODULE(@OSQP_EXT_MODULE_NAME@, m) {
.value("OSQP_DIAGONAL_PRECONDITIONER", OSQP_DIAGONAL_PRECONDITIONER)
.export_values();

py::enum_<osqp_restart_type>(m, "osqp_restart_type", py::module_local())
.value("OSQP_RESTART_NONE", OSQP_RESTART_NONE)
//.value("OSQP_RESTART_AVERAGED", OSQP_RESTART_AVERAGED)
//.value("OSQP_RESTART_HALPERN", OSQP_RESTART_HALPERN)
.value("OSQP_RESTART_REFLECTED_HALPERN", OSQP_RESTART_REFLECTED_HALPERN)
.export_values();

//py::enum_<osqp_halpern_adaptive_type>(m, "osqp_halpern_adaptive_type", py::module_local())
//.value("OSQP_ADAPTIVE_HALPERN_NONE", OSQP_ADAPTIVE_HALPERN_NONE)
//.value("OSQP_ADAPTIVE_HALPERN", OSQP_ADAPTIVE_HALPERN)
//.value("OSQP_ADAPTIVE_HALPERN_BEFORE_INI_REST_LEN", OSQP_ADAPTIVE_HALPERN_BEFORE_INI_REST_LEN)
//.export_values();

py::enum_<osqp_halpern_anchor_point>(m, "osqp_halpern_anchor_point", py::module_local())
.value("OSQP_HALPERN_ANCHOR_INITIAL_POINT", OSQP_HALPERN_ANCHOR_INITIAL_POINT)
.value("OSQP_HALPERN_ANCHOR_FIRST_ITER", OSQP_HALPERN_ANCHOR_FIRST_ITER)
.value("OSQP_HALPERN_ANCHOR_TAU_NOT", OSQP_HALPERN_ANCHOR_TAU_NOT)
.value("OSQP_HALPERN_ANCHOR_INIT_REST", OSQP_HALPERN_ANCHOR_INIT_REST)
.export_values();

// CSC
py::class_<CSC>(m, "CSC", py::module_local())
.def(py::init<py::object>())
Expand Down Expand Up @@ -415,6 +435,27 @@ PYBIND11_MODULE(@OSQP_EXT_MODULE_NAME@, m) {
.def_readwrite("rho_is_vec", &OSQPSettings::rho_is_vec)
.def_readwrite("sigma", &OSQPSettings::sigma)
.def_readwrite("alpha", &OSQPSettings::alpha)
.def_readwrite("beta", &OSQPSettings::beta)
.def_readwrite("lambd", &OSQPSettings::lambd)
.def_readwrite("restart_necessary", &OSQPSettings::restart_necessary)
.def_readwrite("restart_artificial", &OSQPSettings::restart_artificial)
.def_readwrite("ini_rest_len", &OSQPSettings::ini_rest_len)
.def_readwrite("restart_type", &OSQPSettings::restart_type)
//.def_readwrite("halpern_scheme", &OSQPSettings::halpern_scheme)
.def_readwrite("halpern_anchor", &OSQPSettings::halpern_anchor)
.def_readwrite("adaptive_rho_tolerance_greater", &OSQPSettings::adaptive_rho_tolerance_greater)
.def_readwrite("adaptive_rho_tolerance_less", &OSQPSettings::adaptive_rho_tolerance_less)
.def_readwrite("adaptive_rest", &OSQPSettings::adaptive_rest)
//.def_readwrite("alpha_adjustment_reflected_halpern", &OSQPSettings::alpha_adjustment_reflected_halpern)
//.def_readwrite("rho_custom_condition", &OSQPSettings::rho_custom_condition)
//.def_readwrite("custom_average_rest", &OSQPSettings::custom_average_rest)
//.def_readwrite("adapt_rho_on_restart", &OSQPSettings::adapt_rho_on_restart)
//.def_readwrite("vector_rho_in_averaged_KKT", &OSQPSettings::vector_rho_in_averaged_KKT)
//.def_readwrite("rho_custom_tolerance", &OSQPSettings::rho_custom_tolerance)
//.def_readwrite("xi", &OSQPSettings::xi)
//.def_readwrite("plot", &OSQPSettings::plot)
.def_readwrite("integral", &OSQPSettings::integral)
.def_readwrite("halpern_step_first_inner_iter", &OSQPSettings::halpern_step_first_inner_iter)

// Settings - CG
.def_readwrite("cg_max_iter", &OSQPSettings::cg_max_iter)
Expand All @@ -425,8 +466,17 @@ PYBIND11_MODULE(@OSQP_EXT_MODULE_NAME@, m) {
// Settings - Adaptive rho
.def_readwrite("adaptive_rho", &OSQPSettings::adaptive_rho)
.def_readwrite("adaptive_rho_interval", &OSQPSettings::adaptive_rho_interval)
.def_readwrite("restart_check_interval", &OSQPSettings::restart_check_interval)
.def_readwrite("adaptive_rho_fraction", &OSQPSettings::adaptive_rho_fraction)
.def_readwrite("adaptive_rho_tolerance", &OSQPSettings::adaptive_rho_tolerance)
.def_readwrite("pid_controller", &OSQPSettings::pid_controller)
//.def_readwrite("pid_controller_sqrt", &OSQPSettings::pid_controller_sqrt)
//.def_readwrite("pid_controller_log", &OSQPSettings::pid_controller_log)
.def_readwrite("KP", &OSQPSettings::KP)
.def_readwrite("KI", &OSQPSettings::KI)
.def_readwrite("KD", &OSQPSettings::KD)
.def_readwrite("negate_K", &OSQPSettings::negate_K)


// Settings - Termination parameters
.def_readwrite("max_iter", &OSQPSettings::max_iter)
Expand Down Expand Up @@ -474,14 +524,20 @@ PYBIND11_MODULE(@OSQP_EXT_MODULE_NAME@, m) {
.def_readwrite("obj_val", &OSQPInfo::obj_val)
.def_readonly("prim_res", &OSQPInfo::prim_res)
.def_readonly("dual_res", &OSQPInfo::dual_res)
.def_readonly("duality_gap", &OSQPInfo::duality_gap)
.def_readonly("restart", &OSQPInfo::restart)
.def_readonly("iter", &OSQPInfo::iter)
.def_readonly("rho_updates", &OSQPInfo::rho_updates)
.def_readonly("rho_estimate", &OSQPInfo::rho_estimate)
.def_readonly("setup_time", &OSQPInfo::setup_time)
.def_readonly("solve_time", &OSQPInfo::solve_time)
.def_readonly("update_time", &OSQPInfo::update_time)
.def_readonly("polish_time", &OSQPInfo::polish_time)
.def_readonly("run_time", &OSQPInfo::run_time);
.def_readonly("run_time", &OSQPInfo::run_time)
.def_readonly("total_integral", &OSQPInfo::total_integral)
.def_readonly("prim_normalized", &OSQPInfo::prim_normalized)
.def_readonly("dual_normalized", &OSQPInfo::dual_normalized)
.def_readonly("duality_gap_normalized", &OSQPInfo::duality_gap_normalized);

// Solver
py::class_<PyOSQPSolver>(m, "OSQPSolver", py::module_local())
Expand Down
1 change: 1 addition & 0 deletions src/osqp/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ def update_settings(self, **kwargs):
)
settings_changed = True

# print("dictionary: ", self.ext.OSQPSettings.__dict__.keys())
for k in self.ext.OSQPSettings.__dict__:
if not k.startswith('__'):
if k in kwargs:
Expand Down
5 changes: 3 additions & 2 deletions src/osqp/tests/warm_start_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,11 @@ def test_warm_start(self):
y_opt = res.y
tot_iter = res.info.iter

# Warm start with zeros and check if number of iterations is the same
# Warm start with zeros - the iteration count may be different due to rho updates
# persisting from the first solve, which can help convergence
self.model.warm_start(x=np.zeros(self.n), y=np.zeros(self.m))
res = self.model.solve()
assert res.info.iter == tot_iter
assert res.info.iter <= tot_iter # Should take same or fewer iterations

# Warm start with optimal values and check that number of iter < 10
self.model.warm_start(x=x_opt, y=y_opt)
Expand Down
Loading