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

Add tests for MIQP #144

Closed
kibaekkim opened this issue Nov 2, 2020 · 13 comments · Fixed by #143
Closed

Add tests for MIQP #144

kibaekkim opened this issue Nov 2, 2020 · 13 comments · Fixed by #143
Assignees
Milestone

Comments

@kibaekkim
Copy link
Collaborator

We need to add tests and unit tests for QP implementations.

@kibaekkim kibaekkim added this to the MIQCQP milestone Nov 2, 2020
@kibaekkim kibaekkim linked a pull request Nov 2, 2020 that will close this issue
10 tasks
@cheesecakeball
Copy link
Collaborator

Should I add tests written in C code (or some other format)?

@kibaekkim
Copy link
Collaborator Author

Can you try reading QP instances from MPS? I see that Coin-OR supports the quadratic objective with QUADOBJ.

@cheesecakeball
Copy link
Collaborator

Can you try reading QP instances from MPS? I see that Coin-OR supports the quadratic objective with QUADOBJ.

Just double-check: we do not want to modify SMI code directly, right? In order to read smps files with quadratic objectives, I need to add one more function in readsmps function in SMI package.

@kibaekkim
Copy link
Collaborator Author

kibaekkim commented Nov 3, 2020

I was not following this issue (coin-or/Smi#4), but it looks like the functions are already there for quadratic objective.

Quadratic constraints are different, although Gurobi suggests some new cards such as QCMATRIX. This is not even implemented in CoinMpsIO.hpp and thus would require more work to do.

Otherwise, we can start with unit test.

@cheesecakeball
Copy link
Collaborator

I was not following this issue (coin-or/Smi#4), but it looks like the functions are already there for quadratic objective.

Quadratic constraints are different, although Gurobi suggests some new cards such as QCMATRIX. This is not even implemented in CoinMpsIO.hpp and thus would require more work to do.

Otherwise, we can start with unit test.

Yes, the function is there. I tested the readQuadraticMps() function in CoinMPSIO.* before, it worked. But in order to implement in SMI, we need to modify the SMI package itself. We talked about this before. The followings are my thoughts.

  1. Basically it is just adding the readQuadraticMps() function after readMps()(not replace readMps() as answered in the issue (Can Smi read .cor with quadratic objective? coin-or/Smi#4)), so that SMI is able to read .cor file with quadratic objectives.
  2. After the above modification, we need to modify this function (https://github.com/coin-or/Smi/blob/00ed389bd4e758ccd71096bf860cbd8cbbdb6513/Smi/src/SmiSmpsIO.cpp#L178) to read stochastic quadratic objective data in .sto file.

I think it is not hard to implement it by modifying the code in SMI . But in that way, we need to maintain the SMI package. Otherwise, we can derive a new class.

@kibaekkim
Copy link
Collaborator Author

OK. I reopened #58. This might be a less priority to the other tasks you have.

Can you test QP functionalities in unit test?

@cheesecakeball
Copy link
Collaborator

OK. I reopened #58. This might be a less priority to the other tasks you have.

Can you test QP functionalities in unit test?

Sure. I am working on that.

cheesecakeball added a commit that referenced this issue Nov 4, 2020
@cheesecakeball
Copy link
Collaborator

Added unit test for MIQP

Functions: loadQuadraticFirstStage(), loadQuadraticSecondStage(), solveDe()

Check the following cases:
A. With stochastic technology matrices and recourse matrices:

  1. quadratic objectives in the first stage, linear objectives in the second stage
  2. quadratic objectives in the first stage, quadratic objectives in the second stage
  3. linear objectives in the first stage, quadratic objectives in the second stage

B. With stochastic quadratic objectives:

  1. quadratic objectives in the first stage, quadratic objectives in the second stage

@kibaekkim
Copy link
Collaborator Author

@cheesecakeball The test did not pass. Please check that.

@cheesecakeball
Copy link
Collaborator

@cheesecakeball The test did not pass. Please check that.

This is because Gurobi is not available in CI (similar to issue #145). By the way, how did you solve issue #145? Through this commit (636e796)?

@kibaekkim
Copy link
Collaborator Author

If any specific solvers are used, we need to use macro (e.g., DSP_HAS_GRB) in order to enable/disable the code lines. Do you have unit test lines independent to solver?

I resolved #145 by this line: https://github.com/Argonne-National-Laboratory/DSP/blob/master/.travis.yml#L65 But, this does not work for gurobi because the license is activate on a dedicated machine.

@cheesecakeball
Copy link
Collaborator

Thanks for the answer. My unit test lines all depend on Gurobi, because the checking criterion is based on the solution of the sample problem.

@kibaekkim kibaekkim modified the milestones: MIQCQP, v2.0.0 Nov 17, 2020
@cheesecakeball
Copy link
Collaborator

cheesecakeball commented Nov 19, 2020

The unit test should be independent of the solver. I will modify it in dev/qcqp branch

kibaekkim pushed a commit that referenced this issue Feb 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants