Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
gurobi_interface.cc File Reference
#include <algorithm>
#include <atomic>
#include <cmath>
#include <cstdint>
#include <iostream>
#include <limits>
#include <memory>
#include <optional>
#include <stdexcept>
#include <string>
#include <utility>
#include <vector>
#include "absl/base/attributes.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
#include "absl/flags/flag.h"
#include "absl/log/check.h"
#include "absl/log/die_if_null.h"
#include "absl/status/status.h"
#include "absl/strings/str_format.h"
#include "absl/synchronization/mutex.h"
#include "absl/time/time.h"
#include "ortools/base/logging.h"
#include "ortools/base/timer.h"
#include "ortools/gurobi/environment.h"
#include "ortools/gurobi/gurobi_util.h"
#include "ortools/linear_solver/linear_solver.h"
#include "ortools/linear_solver/linear_solver_callback.h"
#include "ortools/linear_solver/proto_solver/gurobi_proto_solver.h"
#include "ortools/linear_solver/proto_solver/proto_utils.h"
#include "ortools/util/lazy_mutable_copy.h"
#include "ortools/util/time_limit.h"

Go to the source code of this file.

Classes

class  operations_research::GurobiInterface
 

Namespaces

namespace  operations_research
 In SWIG mode, we don't want anything besides these top-level includes.
 

Functions

 ABSL_FLAG (int, num_gurobi_threads, 0, "Number of threads available for Gurobi.")
 
MPSolverInterfaceoperations_research::BuildGurobiInterface (bool mip, MPSolver *const solver)
 

Function Documentation

◆ ABSL_FLAG()

ABSL_FLAG ( int ,
num_gurobi_threads ,
0 ,
"Number of threads available for Gurobi."  )

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Gurobi backend to MPSolver.

Implementation Notes:

Incrementalism (last updated June 29, 2020): For solving both LPs and MIPs, Gurobi attempts to reuse information from previous solves, potentially giving a faster solve time. MPSolver supports this for the following problem modification types:

  • Adding a variable,
  • Adding a linear constraint,
  • Updating a variable bound,
  • Updating an objective coefficient or the objective offset (note that in Gurobi 7.5 LP solver, there is a bug if you update only the objective offset and nothing else).
  • Updating a coefficient in the constraint matrix.
  • Updating the type of variable (integer, continuous)
  • Changing the optimization direction. Updates of the following types will force a resolve from scratch:
  • Updating the upper or lower bounds of a linear constraint. Note that in MPSolver's model, this includes updating the sense (le, ge, eq, range) of a linear constraint.
  • Clearing a constraint Any model containing indicator constraints is considered "non-incremental" and will always solve from scratch.

The above limitations are largely due MPSolver and this file, not Gurobi.

Warning(rander): the interactions between callbacks and incrementalism are poorly tested, proceed with caution.

Variable Documentation

◆ callback

MPCallback* callback

Definition at line 541 of file gurobi_interface.cc.

◆ context

GurobiMPCallbackContext* context

Definition at line 540 of file gurobi_interface.cc.

◆ gurobi_internal_callback_data

void* gurobi_internal_callback_data

Definition at line 301 of file gurobi_interface.cc.

◆ model

GRBmodel* model

Definition at line 300 of file gurobi_interface.cc.

◆ where

int where

Definition at line 302 of file gurobi_interface.cc.