Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
cp_model_expand.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_CP_MODEL_EXPAND_H_
15#define OR_TOOLS_SAT_CP_MODEL_EXPAND_H_
16
17#include <stdint.h>
18
19#include <vector>
20
21#include "absl/container/flat_hash_set.h"
22#include "ortools/sat/cp_model.pb.h"
24
25namespace operations_research {
26namespace sat {
27
28// Expands a given CpModelProto by rewriting complex constraints into
29// simpler constraints.
30// This is different from PresolveCpModel() as there are no reduction or
31// simplification of the model. Furthermore, this expansion is mandatory.
32void ExpandCpModel(PresolveContext* context);
33
34// Linear constraint with a complex rhs need to be expanded at the end of the
35// presolve. We do that at the end, because the presolve is allowed to simplify
36// such constraints by updating the rhs. Also the extra variable we create are
37// only linked by a few constraints to the rest of the model and should not be
38// presolvable.
39void FinalExpansionForLinearConstraint(PresolveContext* context);
40
41// Fills and propagates the set of reachable states/labels.
42void PropagateAutomaton(const AutomatonConstraintProto& proto,
43 const PresolveContext& context,
44 std::vector<absl::flat_hash_set<int64_t>>* states,
45 std::vector<absl::flat_hash_set<int64_t>>* labels);
46
47} // namespace sat
48} // namespace operations_research
49
50#endif // OR_TOOLS_SAT_CP_MODEL_EXPAND_H_
CpModelProto proto
The output proto.
GurobiMPCallbackContext * context
void ExpandCpModel(PresolveContext *context)
void FinalExpansionForLinearConstraint(PresolveContext *context)
void PropagateAutomaton(const AutomatonConstraintProto &proto, const PresolveContext &context, std::vector< absl::flat_hash_set< int64_t > > *states, std::vector< absl::flat_hash_set< int64_t > > *labels)
Fills and propagates the set of reachable states/labels.
In SWIG mode, we don't want anything besides these top-level includes.