Skip to content

LP problem mask and QUBO Reformulation#138

Open
tubadzin wants to merge 38 commits into
developfrom
lp-problem-mask
Open

LP problem mask and QUBO Reformulation#138
tubadzin wants to merge 38 commits into
developfrom
lp-problem-mask

Conversation

@tubadzin

Copy link
Copy Markdown
Contributor

@tubadzin tubadzin added the type: enhancement New feature or request label Apr 10, 2025
@tubadzin tubadzin self-assigned this Apr 10, 2025
@zaibod zaibod self-requested a review April 28, 2025 14:42
import edu.kit.provideq.toolbox.mip.MipConfiguration;
import edu.kit.provideq.toolbox.process.ProcessRunner;
import edu.kit.provideq.toolbox.process.PythonProcessRunner;
import edu.kit.provideq.toolbox.sat.SatConfiguration;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused import

@zaibod zaibod left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks very good, just one minor unused import

@Elscrux Elscrux requested a review from Copilot April 29, 2025 08:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR implements a Mixed-Integer-Programming problem mask with two meta-solver-strategies: one using IBM CPLEX and the other using a QUBO reformulation solved via GAMS. Key changes include the addition of test cases for MIP solvers, the introduction of two solver implementations (QUBO-based and CPLEX-based), and the registration/configuration of the MIP problem type.

Reviewed Changes

Copilot reviewed 8 out of 12 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/test/java/edu/kit/provideq/toolbox/api/MipSolversTest.java Adds parameterized tests for exercising the MIP solvers.
src/main/java/edu/kit/provideq/toolbox/mip/solvers/QuboMipSolver.java Introduces a new MIP solver that uses QUBO reformulation with a GAMS process runner.
src/main/java/edu/kit/provideq/toolbox/mip/solvers/MipSolver.java Provides an abstract base class for MIP solvers.
src/main/java/edu/kit/provideq/toolbox/mip/solvers/CplexMip.java Implements a MIP solver using IBM CPLEX invoked via a Python process runner.
src/main/java/edu/kit/provideq/toolbox/mip/MipConfiguration.java Registers the MIP solvers and loads an example problem for the MIP problem type.
solvers/gams/mip/LICENSE.txt Adds an MIT license for the GAMS-based MIP solver component.
solvers/cplex/mip/mip.py Provides a Python script for IBM CPLEX to solve MIP problems using an MPS file.
Files not reviewed (4)
  • solvers/cplex/mip/requirements.txt: Language not supported
  • solvers/gams/mip/mip.gms: Language not supported
  • src/main/resources/application.properties: Language not supported
  • src/main/resources/edu/kit/provideq/toolbox/mip/simple.lp: Language not supported

Comment thread solvers/cplex/mip/mip.py Outdated
Comment on lines +16 to +23
exit()


try:
cpx.solve()
except cplex.exceptions.CplexError as exc:
print("Error during solve:", exc)
exit()

Copilot AI Apr 29, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider replacing 'exit()' with 'sys.exit(1)' to explicitly convey the error exit status and improve clarity in non-interactive environments.

Suggested change
exit()
try:
cpx.solve()
except cplex.exceptions.CplexError as exc:
print("Error during solve:", exc)
exit()
sys.exit(1)
try:
cpx.solve()
except cplex.exceptions.CplexError as exc:
print("Error during solve:", exc)
sys.exit(1)

Copilot uses AI. Check for mistakes.
Comment thread solvers/cplex/mip/mip.py Outdated
cpx.solve()
except cplex.exceptions.CplexError as exc:
print("Error during solve:", exc)
exit()

Copilot AI Apr 29, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider replacing 'exit()' with 'sys.exit(1)' to explicitly indicate an error termination with a proper exit code.

Copilot uses AI. Check for mistakes.

@Elscrux Elscrux left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good already, thanks!

* {@link MipConfiguration#MIP} solver using IBM cplex.
*/
@Component
public class CplexMip extends MipSolver {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be renamed to CplexMipSolver

@@ -0,0 +1,80 @@
$setEnv GAMSINP "%INPUT%"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mip_to_qubo_reformulation and qubo_solve should be named according to what they do. So creating gams representation of mip for the first and for the second gams to qubo formulation


@Override
public String getName() {
return "IBM Cplex Solver for MIP";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename according to new standard

Algorithm (Technology)

Here probably just "Cplex" because the algorithm isn't clear, so we just mention the technology


@Override
public String getDescription() {
return "This solver uses IBM Cplex Solver to solve MIP problems";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description can be as detailed as possible


@Override
public String getName() {
return "Gams Solver for MIP";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename according to new standard

Algorithm (Technology)

For example:
Qubo Transformation (Gams)

@sonarqubecloud

Copy link
Copy Markdown

@koalamitice

Copy link
Copy Markdown
Member

Important Note: Change GAMSQUBO Transformation to GamsPy. This is new and will be better maintained :)

@Elscrux Elscrux force-pushed the develop branch 5 times, most recently from 913cdeb to 918cd23 Compare June 26, 2026 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants