Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
f95f9ee
Temp
FBumann Nov 25, 2025
f4b0d20
Temp
FBumann Nov 25, 2025
7a0fb2e
Add plan
FBumann Nov 25, 2025
246196c
Temp
FBumann Nov 25, 2025
53d9654
Temp
FBumann Nov 25, 2025
682cd4f
Add tests
FBumann Nov 25, 2025
8e1dbb6
Fix test
FBumann Nov 25, 2025
007d7fb
Added eremaining tasks
FBumann Nov 25, 2025
9195423
Add example
FBumann Nov 25, 2025
a07d2aa
Add notebook
FBumann Nov 25, 2025
b568e69
Feature/multi dimensional quadratic constraints (#5)
FBumann Nov 25, 2025
04822a0
Feature/netcdf-io (#6)
FBumann Nov 25, 2025
5b54571
Feature/matrix accessor (#4)
FBumann Nov 25, 2025
fa41e9b
Feature/dual-value-retrieval (#1)
FBumann Nov 25, 2025
232e233
Feature/centralize quadratic solvers check (#3)
FBumann Nov 25, 2025
c511453
Feature/mosek direct api (#2)
FBumann Nov 25, 2025
c5c3914
Fixed the quadratic constraint bounds in MOSEK export:
FBumann Nov 26, 2025
bb31430
Feature/defensive checks and tests (#7)
FBumann Nov 26, 2025
9000a11
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 26, 2025
50935c5
Feature/io methods (#8)
FBumann Nov 26, 2025
dcb74c1
satisfy codespell
FBumann Nov 26, 2025
621942b
Fix typehints for mypy
FBumann Nov 26, 2025
3b56437
Added assert isinstance(con_name, str) and assert isinstance(coord, d…
FBumann Nov 26, 2025
e28e358
5. test/test_quadratic_constraint.py: Added assert obj_val is not N…
FBumann Nov 26, 2025
68f63fd
Fixes for CI test failures:
FBumann Nov 26, 2025
df45999
Exclude copt from nonconvex tests
FBumann Nov 26, 2025
0ef0dab
Add NONCONVEX_QUADRATIC_CONSTRAINT_SOLVERS constant and adjust tests
FBumann Nov 26, 2025
149fc78
Fix NONCONVEX_QUADRATIC_CONSTRAINT_SOLVERS
FBumann Nov 26, 2025
10b4884
codespell
FBumann Nov 26, 2025
63aabe1
Improve example and link in docs
FBumann Nov 26, 2025
ac3850c
Add release notes
FBumann Nov 26, 2025
2608b00
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 26, 2025
7c97123
Added to QuadraticConstraints container (linopy/constraints.py):
FBumann Nov 26, 2025
fe958ed
Fixed shape property - Now works correctly, returns shape excluding t…
FBumann Nov 26, 2025
db8e3c1
Added tests for QuadraticExpression groupby, rolling, and cumsum oper…
FBumann Nov 26, 2025
ccf9db1
Improve printing of quadratic expressions
FBumann Nov 26, 2025
16b609f
fix: The shape property is now consistent between LinearExpression an…
FBumann Nov 26, 2025
b6f6755
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Nov 26, 2025
feead69
Fixed test with new shape
FBumann Nov 26, 2025
3c7a48a
Update release notes with new shape property
FBumann Nov 26, 2025
0af591f
1. Moved cumsum, groupby, and rolling methods from BaseExpression t…
FBumann Nov 26, 2025
a22c9f6
Improve the quadratic-constraint.ipynb
FBumann Dec 3, 2025
879b073
Add new api to docs
FBumann Dec 3, 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
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ repos:
hooks:
- id: blackdoc
additional_dependencies: ['black==24.8.0']
exclude: dev-scripts/quadratic_constraints_plan\.md
- repo: https://github.com/codespell-project/codespell
rev: v2.4.1
hooks:
Expand Down
29 changes: 29 additions & 0 deletions dev-scripts/quadratic_constraint_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
"""
Quadratic Constraints Example
"""

import linopy

m = linopy.Model()

# Variables
x = m.add_variables(lower=0, upper=10, name="x")
y = m.add_variables(lower=0, upper=10, name="y")

# Linear constraint
m.add_constraints(x + y <= 8, name="linear_budget")

# Quadratic constraints
m.add_quadratic_constraints(x * x + y * y, "<=", 25, name="circle")
m.add_quadratic_constraints(x * y, "<=", 10, name="mixed_term")

# Objective: maximize x + 2y
m.add_objective(x + 2 * y, sense="max")

# Solve
m.solve(solver_name="gurobi")

# Results
print(f"x = {x.solution.values.item():.4f}")
print(f"y = {y.solution.values.item():.4f}")
print(f"Objective = {m.objective.value:.4f}")
Loading
Loading