Add bindings for update_vector_data and update_matrix_data.#4
Add bindings for update_vector_data and update_matrix_data.#4JonasBreuling wants to merge 4 commits intoqoco-org:mainfrom
Conversation
|
Looks good, but can you add some unit tests to test out the new update functions? |
|
I've added some tests and removed the returns. |
| res2 = prob.solve() | ||
| assert res2.status in ["QOCO_SOLVED", "QOCO_SOLVED_INACCURATE"] | ||
| # Objective should be different after update | ||
| assert abs(res2.obj - obj1) > 1e-6 or True # Allow for some tolerance |
There was a problem hiding this comment.
Wouldn't this always be True since you are asserting (something or True)?
| # Solve updated problem | ||
| res2 = prob.solve() | ||
| assert res2.status in ["QOCO_SOLVED", "QOCO_SOLVED_INACCURATE"] | ||
| # Objective should be different after update |
There was a problem hiding this comment.
The test should be checking whether the modified problem is returning the correct answer as well, not just the objective being different. I would suggest setting up a simple problem with a known optimal objective and checking against that objective.
|
|
||
| # Solve initial problem | ||
| res1 = prob.solve() | ||
| assert res1.status in ["QOCO_SOLVED", "QOCO_SOLVED_INACCURATE"] |
There was a problem hiding this comment.
This should only check against QOCO_SOLVED
|
I will work on the tests. Currently, my workload is huge, so this will take a few weaks. Do you have similar test cases in the C++ code that I can reuse? |
|
I have a few here which are named some variation of "update data test": https://github.com/qoco-org/qoco/blob/main/tests/simple_tests/missing_constraints_test.cpp |
2 similar comments
|
I have a few here which are named some variation of "update data test": https://github.com/qoco-org/qoco/blob/main/tests/simple_tests/missing_constraints_test.cpp |
|
I have a few here which are named some variation of "update data test": https://github.com/qoco-org/qoco/blob/main/tests/simple_tests/missing_constraints_test.cpp |
This PR adds python bindings for update_vector_data and update_matrix_data. It depends on qoco-org/qoco#44 since minor changes to the C-code are required.