We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 01c59d6 commit f2e89acCopy full SHA for f2e89ac
tests/test_qp.py
@@ -66,3 +66,24 @@ def test_shuffle_qp_objective(model_interface):
66
obj_values = np.array(obj_values)
67
# test all values are the same
68
assert np.all(np.abs(obj_values - obj_values[0]) < 1e-8)
69
+
70
71
+def test_duplicated_quadratic_terms(model_interface):
72
+ model = model_interface
73
74
+ x = model.add_m_variables(2, lb=1.0)
75
76
+ obj = (
77
+ x[0] * x[0]
78
+ + x[0] * x[0]
79
+ + x[1] * x[1]
80
+ + 2 * x[1] * x[1]
81
+ + 0.5 * x[0] * x[1]
82
+ + 0.1 * x[1] * x[0]
83
+ )
84
85
+ model.set_objective(obj)
86
87
+ model.optimize()
88
+ obj_value = model.get_model_attribute(poi.ModelAttribute.ObjectiveValue)
89
+ assert obj_value == approx(5.6)
0 commit comments