dwavesystems / dwavesystems/dwave-optimization

LP symbol returns incorrect value

Open
#575 0 comments 1 reaction 0 assignees View on GitHub
bug
Dominant language
C++
Stars
31
Forks
36
Avg merge
16h 55m
Merged PRs (30d)
8

Description

[lp.zip](https://github.com/user-attachments/files/29389754/lp.zip)
```python

import numpy as np
import scipy.optimize

import dwave.optimization

arrays = np.load("lp.npz")
c = arrays["c"]
A_ub = arrays["A_ub"]
b_ub = arrays["b_ub"]
A_eq = arrays["A_eq"]
b_eq = arrays["b_eq"]
lb = arrays["lb"]
ub = arrays["ub"]

# Solve it with scipy
res = scipy.optimize.linprog(
c=c,
A_ub=A_ub,
b_ub=b_ub,
A_eq=A_eq,
b_eq=b_eq,
bounds=list(zip(lb, ub)),
)
scipy_x = res.x
scipy_fun = res.fun

# Solve it with dwave-optimization
model = dwave.optimization.Model()
res = dwave.optimization.linprog(
c=model.constant(c),
A_ub=model.constant(A_ub),
b_ub=model.constant(b_ub),
A_eq=model.constant(A_eq),
b_eq=model.constant(b_eq),
lb=model.constant(lb),
ub=model.constant(ub),
)
_ = res.x
__ = res.fun
model.states.resize(1)
with model.lock():
dwopt_x = res.x.state()
dwopt_fun = res.fun.state()

print(scipy_fun, dwopt_fun)
```
```bash
47779.29074832177 33603159.675
```

Contributor guide

Open the contributing guide

Research direction

Run the attached lp.zip reproduction with Python, comparing scipy.optimize.linprog against dwave.optimization.linprog and their res.x/res.fun state values. Trace the LP result from that entry point and verify the reported objective and solution agree with SciPy for the supplied data; done means the reproduction no longer reports 47779.29074832177 versus 33603159.675.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.