Google OR-Tools v9.14
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-2025 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_SET_COVER_SET_COVER_MIP_H_
15#define OR_TOOLS_SET_COVER_SET_COVER_MIP_H_
16
17#include "absl/strings/string_view.h"
18#include "absl/types/span.h"
23
24namespace operations_research {
25enum class SetCoverMipSolver : int {
26 SCIP = 0,
27 SAT = 1,
28 GUROBI = 2,
29 GLOP = 3,
30 PDLP = 4
31};
32
34 public:
35 // Simpler constructors that uses SCIP by default.
37 : SetCoverMip(inv, "SetCoverMip") {}
38
41 inv, SetCoverInvariant::ConsistencyLevel::kCostAndCoverage, "Mip",
42 name),
43 mip_solver_(SetCoverMipSolver::SCIP),
44 use_integers_(true) {}
45
47 mip_solver_ = mip_solver;
48 return *this;
49 }
50
51 SetCoverMip& UseIntegers(bool use_integers) {
52 use_integers_ = use_integers;
56 return *this;
57 }
58
59 MPSolver::ResultStatus solve_status() const { return solve_status_; }
60
62
63 // Computes the next partial solution considering only the subsets whose
64 // indices are in focus.
65 bool NextSolution(absl::Span<const SubsetIndex> focus) final;
66
67 private:
68 // The MIP solver flavor used by the instance.
69 SetCoverMipSolver mip_solver_;
70
71 // Whether to use integer variables in the MIP.
72 bool use_integers_;
73
74 // The status of the last solve.
75 MPSolver::ResultStatus solve_status_;
76};
77} // namespace operations_research
78
79#endif // OR_TOOLS_SET_COVER_SET_COVER_MIP_H_
bool NextSolution() final
Virtual methods that must be implemented by derived classes.
SetCoverMip & UseMipSolver(SetCoverMipSolver mip_solver)
SetCoverMip(SetCoverInvariant *inv)
Simpler constructors that uses SCIP by default.
SetCoverMip & UseIntegers(bool use_integers)
SetCoverMip(SetCoverInvariant *inv, absl::string_view name)
MPSolver::ResultStatus solve_status() const
SetCoverInvariant::ConsistencyLevel consistency_level_
The consistency needed by the solution generator.
std::string name() const
Returns the name of the heuristic.
SubsetListBasedSolutionGenerator(SetCoverInvariant *inv, SetCoverInvariant::ConsistencyLevel consistency_level, absl::string_view class_name, absl::string_view name)
bool NextSolution(absl::Span< const SubsetIndex > _) override
In SWIG mode, we don't want anything besides these top-level includes.