SIANXKE-473: implement solver that directly uses the Gurobi API - #13
SIANXKE-473: implement solver that directly uses the Gurobi API#13MLackenbucher wants to merge 5 commits into
Conversation
Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 4 to 5. - [Release notes](https://github.com/actions/setup-dotnet/releases) - [Commits](actions/setup-dotnet@v4...v5) --- updated-dependencies: - dependency-name: actions/setup-dotnet dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #13 +/- ##
==========================================
+ Coverage 76.69% 79.79% +3.10%
==========================================
Files 45 46 +1
Lines 811 980 +169
Branches 92 118 +26
==========================================
+ Hits 622 782 +160
- Misses 144 158 +14
+ Partials 45 40 -5 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](actions/checkout@v4...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
4c2f431 to
a9068ae
Compare
…tions/checkout-6 Bump actions/checkout from 4 to 6
…tions/setup-dotnet-5 Bump actions/setup-dotnet from 4 to 5
9368d31 to
83baf76
Compare
|
@melaniesi @sarahkatharina gerne auch mal drüber schauen und Anmerkungen geben wenn ihr noch welche habt |
ef0ddef to
003a7e4
Compare
| - name: Verify commit exists in origin/main | ||
| run: | | ||
| git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* | ||
| git branch --remote --contains | grep origin/main | ||
|
|
There was a problem hiding this comment.
we should keep this check
|
|
||
| <ItemGroup> | ||
| <PackageReference Update="Google.OrTools" Version="9.15.6755" /> | ||
| <PackageReference Update="Google.OrTools" Version="9.14.6206" /> |
There was a problem hiding this comment.
OR Tools 9.15.x has problems with Gurobi 13.
| GRB.Status.OPTIMAL => objectiveValue is null || bestBound is null | ||
| ? throw new MathematicalProgramException("Mathematical program could not be solved.") | ||
| : SolverResult(SolverResultStatus.Optimal, false, solutionValues, objectiveValue, | ||
| bestBound, true, true), | ||
| GRB.Status.SUBOPTIMAL => objectiveValue is null || bestBound is null | ||
| ? throw new MathematicalProgramException("Mathematical program could not be solved.") | ||
| : SolverResult(SolverResultStatus.Feasible, false, solutionValues, objectiveValue, | ||
| bestBound, true), | ||
| GRB.Status.TIME_LIMIT => objectiveValue is null || bestBound is null | ||
| ? throw new MathematicalProgramException("Mathematical program could not be solved.") | ||
| : SolverResult(SolverResultStatus.Timelimit, false, solutionValues, objectiveValue, | ||
| bestBound, true), | ||
| GRB.Status.INTERRUPTED => objectiveValue is null || bestBound is null | ||
| ? throw new MathematicalProgramException("Mathematical program could not be solved.") | ||
| : SolverResult(SolverResultStatus.CancelledByUser, false, solutionValues, objectiveValue, | ||
| bestBound, true), | ||
| GRB.Status.MEM_LIMIT => objectiveValue is null || bestBound is null | ||
| ? throw new MathematicalProgramException("Mathematical program could not be solved.") | ||
| : SolverResult(SolverResultStatus.UnknownStatus, false, solutionValues, objectiveValue, | ||
| bestBound, true), | ||
| GRB.Status.UNBOUNDED => objectiveValue is null || bestBound is null | ||
| ? throw new MathematicalProgramException("Mathematical program could not be solved.") | ||
| : SolverResult<TVariable, TCoefficient, TVariableInterval>(SolverResultStatus.Unbounded, false), | ||
| GRB.Status.INFEASIBLE => SolverResult<TVariable, TCoefficient, TVariableInterval>( | ||
| SolverResultStatus.Infeasible, false, isFeasible: false), |
There was a problem hiding this comment.
I think when can check objectiveValue is null || bestBound is null once before the switch
| if (solverParameter.ExportModelFilePath is not null) | ||
| { | ||
| logger?.LogInformation("Exporting model to {ExportModelFilePath}", solverParameter.ExportModelFilePath); | ||
|
|
||
| gurobiModel.Write(solverParameter.ExportModelFilePath); | ||
| } |
There was a problem hiding this comment.
for long running models it might be sensible to move this export before the optimization
| using Google.OrTools.ModelBuilder; | ||
| using Gurobi; | ||
| using Microsoft.Extensions.Logging; | ||
| using static Google.OrTools.Init.operations_research_init; |
There was a problem hiding this comment.
does any of these tests provide any value/insight/whatsoever?
There was a problem hiding this comment.
Asserts correct solver initialization
| { | ||
| try | ||
| { | ||
| var env = new GRBEnv(true); |
There was a problem hiding this comment.
| var env = new GRBEnv(true); | |
| using var env = new GRBEnv(true); |
|
|
||
| env.Start(); | ||
|
|
||
| var gurobiModel = new GRBModel(env); |
There was a problem hiding this comment.
| var gurobiModel = new GRBModel(env); | |
| using var gurobiModel = new GRBModel(env); |
003a7e4 to
6dbb108
Compare
No description provided.