Skip to content

Commit 891483e

Browse files
add back mutable vs non mutable handling
1 parent 6c4b7b1 commit 891483e

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

Diff for: pyomo/contrib/solver/solvers/highs.py

+2
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,7 @@ def _set_objective(self, obj):
600600
if self._last_results_object is not None:
601601
self._last_results_object.solution_loader.invalidate()
602602
n = len(self._pyomo_var_to_solver_var_map)
603+
indices = np.arange(n)
603604
costs = np.zeros(n, dtype=np.double)
604605

605606
# Initialize empty lists for all coefficient types
@@ -658,6 +659,7 @@ def _set_objective(self, obj):
658659
)
659660

660661
self._solver_model.changeObjectiveSense(sense)
662+
self._solver_model.changeColsCost(n, indices, costs)
661663
self._mutable_objective = _MutableObjective(
662664
self._solver_model,
663665
mutable_constant,

Diff for: pyomo/contrib/solver/tests/solvers/test_highs.py

-5
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,10 @@
99
# This software is distributed under the 3-clause BSD License.
1010
# ___________________________________________________________________________
1111

12-
import subprocess
13-
import sys
14-
1512
import pyomo.common.unittest as unittest
1613
import pyomo.environ as pe
1714

1815
from pyomo.contrib.solver.solvers.highs import Highs
19-
from pyomo.common.log import LoggingIntercept
20-
from pyomo.common.tee import capture_output
2116

2217
opt = Highs()
2318
if not opt.available():

0 commit comments

Comments
 (0)