Hi,
Thanks a lot for the pyoframe development, this is really nice! I today implemented a quadratic regularization, well, claude did ähem. It claims there's something not working with the mosek interface - I havent had time to dive in but probably it's easy for the devs to quickly check (and possibly discard). I can't check unfortunately with any other MIQ solver, not sure it's mosek specific.
mixed linear + quadratic objective produces invalid Q matrix (MSK_RES_ERR_OBJ_Q_NOT_PSD)
Version: pyoframe 1.4.1
Description: When an objective expression contains both linear and quadratic terms, pyoframe produces an invalid Q matrix. The root cause: linear terms are stored in the internal polars DataFrame with __quadratic_variable_id = 0, which is the sentinel for "this is a linear term, not quadratic." However, when pyoframe serializes the objective to the solver backend (POI), it appears to treat _quadratic_variable_id = 0 as an actual variable reference, generating spurious cross-terms q{i,0} in the Q matrix. This makes the matrix indefinite, causing Mosek to reject it as non-PSD and report a solve error.
Minimal example:
import pyoframe as pf
import polars as pl
idx = pl.DataFrame({"gen": ["a", "b", "c"]})
m = pf.Model("mosek")
m.x = pf.Variable(idx, lb=0, ub=10)
m.minimize = (m.x * m.x).sum() + m.x.sum()
m.optimize()
# Mosek: MSK_RES_ERR_OBJ_Q_NOT_PSD
Pure quadratic and pure linear works.
Hi,
Thanks a lot for the pyoframe development, this is really nice! I today implemented a quadratic regularization, well, claude did ähem. It claims there's something not working with the mosek interface - I havent had time to dive in but probably it's easy for the devs to quickly check (and possibly discard). I can't check unfortunately with any other MIQ solver, not sure it's mosek specific.
mixed linear + quadratic objective produces invalid Q matrix (MSK_RES_ERR_OBJ_Q_NOT_PSD)
Version: pyoframe 1.4.1
Description: When an objective expression contains both linear and quadratic terms, pyoframe produces an invalid Q matrix. The root cause: linear terms are stored in the internal polars DataFrame with __quadratic_variable_id = 0, which is the sentinel for "this is a linear term, not quadratic." However, when pyoframe serializes the objective to the solver backend (POI), it appears to treat _quadratic_variable_id = 0 as an actual variable reference, generating spurious cross-terms q{i,0} in the Q matrix. This makes the matrix indefinite, causing Mosek to reject it as non-PSD and report a solve error.
Minimal example:
Pure quadratic and pure linear works.