Skip to content

Commit 8693728

Browse files
authored
Merge pull request #10 from ZedongPeng/feature-qp
Update to version 0.2.0
2 parents 826fee4 + 4659cc4 commit 8693728

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

mpax/mp_io.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -411,13 +411,17 @@ def create_qp_from_gurobi(
411411
constraint_matrix.data = jnp.where(
412412
leq_nzval_mask, -constraint_matrix.data, constraint_matrix.data
413413
)
414-
objective_matrix = 2 * BCOO.from_scipy_sparse(model.getQ())
414+
objective_matrix = 2 * BCOO.from_scipy_sparse(
415+
(model.getQ() + model.getQ().T) / 2
416+
)
415417
else:
416418
constraint_matrix = jnp.array(model.getA().toarray())
417419
constraint_matrix = constraint_matrix.at[leq_mask].set(
418420
-constraint_matrix[leq_mask]
419421
)
420-
objective_matrix = 2 * jnp.array(model.getQ().toarray())
422+
objective_matrix = 2 * jnp.array(
423+
((model.getQ() + model.getQ().T) / 2).toarray()
424+
)
421425
is_lp = model.getQ().nnz == 0
422426
if sharding is not None:
423427
constraint_matrix = jax.device_put(constraint_matrix, sharding)

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "mpax"
3-
version = "0.1.2"
3+
version = "0.2.0"
44
description = "MPAX: Mathematical Programming in JAX"
55
authors = ["Zedong Peng <[email protected]>"]
66
license = "MIT"

0 commit comments

Comments
 (0)