Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
rins.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_SAT_RINS_H_
15#define OR_TOOLS_SAT_RINS_H_
16
17#include <cstdint>
18#include <string>
19#include <utility>
20#include <vector>
21
22#include "absl/random/bit_gen_ref.h"
23#include "ortools/sat/integer.h"
25#include "ortools/sat/model.h"
28
29namespace operations_research {
30namespace sat {
31
32// A RINS Neighborhood is actually just a generic neighborhood where the domain
33// of some variable have been reduced (fixed or restricted in [lb, ub]).
34//
35// Important: It might be possible that the value of the variables here are
36// outside the domains of these variables! This happens for RENS type of
37// neighborhood in the presence of holes in the domains because the LP
38// relaxation ignore those.
40 // A variable will appear only once and not in both vectors.
41 std::vector<std::pair</*model_var*/ int, /*value*/ int64_t>> fixed_vars;
42 std::vector<
43 std::pair</*model_var*/ int, /*domain*/ std::pair<int64_t, int64_t>>>
45 std::string source_info;
46};
47
48// Helper method to create a RINS neighborhood by fixing variables with same
49// values in relaxation solution and the current best solution in the
50// response_manager. Prioritizes repositories in following order to get a
51// neighborhood.
52// 1. incomplete_solutions
53// 2. lp_solutions
54//
55// If response_manager has no solution, this generates a RENS neighborhood by
56// ignoring the solutions and using the relaxation values. The domain of the
57// variables are reduced to integer values around relaxation values. If the
58// relaxation value is integer, then we fix the domain of the variable to that
59// value.
61 const SharedResponseManager* response_manager,
62 const SharedLPSolutionRepository* lp_solutions,
63 SharedIncompleteSolutionManager* incomplete_solutions, double difficulty,
64 absl::BitGenRef random);
65
66// Adds the current LP solution to the pool.
68
69} // namespace sat
70} // namespace operations_research
71
72#endif // OR_TOOLS_SAT_RINS_H_
GRBmodel * model
ReducedDomainNeighborhood GetRinsRensNeighborhood(const SharedResponseManager *response_manager, const SharedLPSolutionRepository *lp_solutions, SharedIncompleteSolutionManager *incomplete_solutions, double difficulty, absl::BitGenRef random)
Definition rins.cc:174
void RecordLPRelaxationValues(Model *model)
Adds the current LP solution to the pool.
Definition rins.cc:38
In SWIG mode, we don't want anything besides these top-level includes.
std::vector< std::pair< int, std::pair< int64_t, int64_t > > > reduced_domain_vars
Definition rins.h:44
std::vector< std::pair< int, int64_t > > fixed_vars
A variable will appear only once and not in both vectors.
Definition rins.h:41