Skip to content

Adds java gurobi knapsack example#113

Merged
merschformann merged 9 commits intodevelopfrom
merschformann/add-gurobi-java-example
Jun 4, 2025
Merged

Adds java gurobi knapsack example#113
merschformann merged 9 commits intodevelopfrom
merschformann/add-gurobi-java-example

Conversation

@merschformann
Copy link
Copy Markdown
Member

@merschformann merschformann commented Jun 2, 2025

Description

Adds an example project using Gurobi Maven package directly for modeling a simple knapsack problem.

Changes

  • Adds java-gurobi-knapsack app.
    • Implemented in Java using Maven.
    • Uses com.gurobi.gurobi Maven package.
    • Uses the knapsack problem as an example.
  • Fixes small readme issues in other java apps.
  • Fixes a severe bug in java OR-Tools example.
    • Output was messed up and it did not read capacity correctly.

@merschformann merschformann marked this pull request as ready for review June 3, 2025 22:27
@merschformann merschformann requested a review from Copilot June 3, 2025 22:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds a new Java example project for solving a knapsack problem using the Gurobi Maven package. Key changes include:

  • A new application (java-gurobi-knapsack) implementing the knapsack problem.
  • Updates to README files in existing Java apps to correctly reference the new Java source paths.
  • Supporting changes in Maven configuration, workspace files, and test scripts.

Reviewed Changes

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

Show a summary per file
File Description
java-ortools-routing/README.md Updated to reference the Java main class instead of main.py.
java-ortools-knapsack/README.md Updated to reference the Java main class instead of main.py.
java-gurobi-knapsack/src/main/java/com/nextmv/example/Output.java New output class implementation with nested classes.
java-gurobi-knapsack/src/main/java/com/nextmv/example/Options.java New options parsing code for the Gurobi knapsack example.
java-gurobi-knapsack/src/main/java/com/nextmv/example/Main.java Main program implementation for the knapsack solver.
java-gurobi-knapsack/src/main/java/com/nextmv/example/Item.java New Item class to represent knapsack items.
java-gurobi-knapsack/src/main/java/com/nextmv/example/Input.java New input parsing class using Gson for JSON input.
java-gurobi-knapsack/pom.xml Maven configuration for building the Java Gurobi example.
Other files (code-workspace, input.json, app.yaml, README.md, LICENSE, devcontainer, and workflow files) Supporting configurations and documentation for development and CI.

Comment thread java-gurobi-knapsack/src/main/java/com/nextmv/example/Main.java Outdated
Comment thread java-gurobi-knapsack/src/main/java/com/nextmv/example/Output.java
@merschformann merschformann merged commit c2c419c into develop Jun 4, 2025
40 checks passed
@merschformann merschformann deleted the merschformann/add-gurobi-java-example branch June 4, 2025 16:06
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 this pull request may close these issues.

3 participants