Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
set_cover_mip.h
Go to the documentation of this file.
1// Copyright 2010-2024 Google LLC
2// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14#ifndef OR_TOOLS_ALGORITHMS_SET_COVER_MIP_H_
15#define OR_TOOLS_ALGORITHMS_SET_COVER_MIP_H_
16
17#include "absl/types/span.h"
20
21namespace operations_research {
22enum class SetCoverMipSolver : int {
23 SCIP = 0,
24 SAT = 1,
25 GUROBI = 2,
26 GLOP = 3,
27 PDLP = 4
28};
29
31 public:
32 // Simpler constructor that uses SCIP by default.
34 : inv_(inv), mip_solver_(SetCoverMipSolver::SCIP) {}
35
36 // The constructor takes a SetCoverInvariant that will store the resulting
37 // variable choices, and a MIP Solver.
39 : inv_(inv), mip_solver_(mip_solver) {}
40
41 // Returns true if a solution was found.
42 // If use_integers is false, lower_bound_ is populated with a linear
43 // lower bound.
44 // time_limit_in_seconds is a (rather soft) time limit for the execution time.
45 // TODO(user): Add time-outs and exit with a partial solution. This seems
46 // unlikely, though.
47 bool NextSolution(bool use_integers, double time_limit_in_seconds);
48
49 // Computes the next partial solution considering only the subsets whose
50 // indices are in focus.
51 bool NextSolution(absl::Span<const SubsetIndex> focus, bool use_integers,
52 double time_limit_in_seconds);
53
54 // Returns the lower bound of the linear relaxation of the problem.
55 double lower_bound() const { return lower_bound_; }
56
57 private:
58 // The invariant used to maintain the state of the problem.
60
61 // The MIP solver flavor used by the instance.
62 SetCoverMipSolver mip_solver_;
63
64 // The lower bound of the problem, when use_integers is false. The MIP with
65 // continuous variables becomes a computationally simpler linear program.
66 double lower_bound_;
67};
68} // namespace operations_research
69
70#endif // OR_TOOLS_ALGORITHMS_SET_COVER_MIP_H_
bool NextSolution(bool use_integers, double time_limit_in_seconds)
double lower_bound() const
Returns the lower bound of the linear relaxation of the problem.
SetCoverMip(SetCoverInvariant *inv)
Simpler constructor that uses SCIP by default.
SetCoverMip(SetCoverInvariant *inv, SetCoverMipSolver mip_solver)
In SWIG mode, we don't want anything besides these top-level includes.