Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appsi_highs: allow solving quadratic problems #3431

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
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
12 changes: 2 additions & 10 deletions pyomo/contrib/appsi/solvers/highs.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,12 +397,8 @@ def _add_constraints(self, cons: List[ConstraintData]):

for con in cons:
repn = generate_standard_repn(
con.body, quadratic=False, compute_values=False
con.body, quadratic=True, compute_values=False
)
if repn.nonlinear_expr is not None:
raise DegreeError(
f'Highs interface does not support expressions of degree {repn.polynomial_degree()}'
)

starts.append(len(coef_values))
for ndx, coef in enumerate(repn.linear_coefs):
Expand Down Expand Up @@ -589,12 +585,8 @@ def _set_objective(self, obj):
)

repn = generate_standard_repn(
obj.expr, quadratic=False, compute_values=False
obj.expr, quadratic=True, compute_values=False
)
if repn.nonlinear_expr is not None:
raise DegreeError(
f'Highs interface does not support expressions of degree {repn.polynomial_degree()}'
)

for coef, v in zip(repn.linear_coefs, repn.linear_vars):
v_id = id(v)
Expand Down