-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix objective size when setting quadratic term (#25)
* fix resize * add test
- Loading branch information
1 parent
8a45606
commit 074e1cf
Showing
2 changed files
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import ilpy | ||
|
||
|
||
def test_resize() -> None: | ||
obj = ilpy.Objective() | ||
assert len(obj) == 0 | ||
|
||
obj.set_coefficient(0, 2) # linear term (2x) | ||
assert len(obj) == 1 | ||
|
||
obj.set_quadratic_coefficient(1, 1, 3) # quadratic term (3y^2) | ||
assert len(obj) == 2 | ||
|
||
obj2 = ilpy.Objective() | ||
obj2.set_quadratic_coefficient(0, 0, 1) # quadratic term (x^2) | ||
assert len(obj2) == 1 |