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

An ability to get relative MIP GAP and expose linear solver callbacks API to the .Net #2608

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

CADBIMDeveloper
Copy link
Contributor

Hi!

I added an ability to get relative MIP GAP in the linear solver callback. It is nice to show (1 - relative MIP GAP)*100 to the user as "percentage". He sees that something is happening. So I added MPCallbackContext::GetRelativeMipGap method.

It is also a good opportunity to offer user to select a feasible solution if calculation takes a lot of time. When I played with SCIP solver I noticed, that RunCallback method is invoked several times with the same kMip event, but on some calls the solution either didn't have any variables or the variable values where obviously incorrect. So I introduced MPCallbackContext::HasValidMipSolution method. One another thing was that RunCallback method was invoked several times with the same solution, so I wanted to check if this solution has already been exposed to the caller code. MPCallbackContext::IsNewSolution does this trick.

I also partially expose callbacks API to the .Net world. Now it is read-only and doesn't support adding cuts, constraints or suggesting a solution.

These changes solve my issue #2603

These changes are only for SCIP solver, sorry, my C++ skills are not so good (I took a look at gurobi solver interface and it looks as magic for me :-)) and I don't have Gurobi license to perform tests.

ortools/linear_solver/csharp/SolverHelper.cs Outdated Show resolved Hide resolved
ortools/linear_solver/csharp/linear_solver.i Outdated Show resolved Hide resolved
ortools/linear_solver/linear_solver_swig_helper.h Outdated Show resolved Hide resolved
ortools/linear_solver/scip_interface.cc Outdated Show resolved Hide resolved
@CADBIMDeveloper CADBIMDeveloper requested a review from Mizux June 23, 2021 18:25
@Mizux Mizux added this to the Backlog milestone Sep 15, 2021
@lperron
Copy link
Collaborator

lperron commented Oct 19, 2021

Sorry for the late answer. We will have a look.

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