|
std::ostream & | operations_research::sat::operator<< (std::ostream &os, const BoolVar &var) |
|
BoolVar | operations_research::sat::Not (BoolVar x) |
|
std::ostream & | operations_research::sat::operator<< (std::ostream &os, const IntVar &var) |
|
std::ostream & | operations_research::sat::operator<< (std::ostream &os, const LinearExpr &e) |
|
std::ostream & | operations_research::sat::operator<< (std::ostream &os, const DoubleLinearExpr &e) |
|
std::ostream & | operations_research::sat::operator<< (std::ostream &os, const IntervalVar &var) |
|
template<typename H > |
H | operations_research::sat::AbslHashValue (H h, const IntVar &i) |
| – ABSL HASHING SUPPORT --------------------------------------------------—
|
|
template<typename H > |
H | operations_research::sat::AbslHashValue (H h, const IntervalVar &i) |
|
int64_t | operations_research::sat::SolutionIntegerValue (const CpSolverResponse &r, const LinearExpr &expr) |
| Evaluates the value of an linear expression in a solver response.
|
|
bool | operations_research::sat::SolutionBooleanValue (const CpSolverResponse &r, BoolVar x) |
| Evaluates the value of a Boolean literal in a solver response.
|
|
std::string | operations_research::sat::VarDebugString (const CpModelProto &proto, int index) |
|
LinearExpr | operations_research::sat::operator- (LinearExpr expr) |
|
LinearExpr | operations_research::sat::operator+ (const LinearExpr &lhs, const LinearExpr &rhs) |
|
LinearExpr | operations_research::sat::operator+ (LinearExpr &&lhs, const LinearExpr &rhs) |
|
LinearExpr | operations_research::sat::operator+ (const LinearExpr &lhs, LinearExpr &&rhs) |
|
LinearExpr | operations_research::sat::operator+ (LinearExpr &&lhs, LinearExpr &&rhs) |
|
LinearExpr | operations_research::sat::operator- (const LinearExpr &lhs, const LinearExpr &rhs) |
|
LinearExpr | operations_research::sat::operator- (LinearExpr &&lhs, const LinearExpr &rhs) |
|
LinearExpr | operations_research::sat::operator- (const LinearExpr &lhs, LinearExpr &&rhs) |
|
LinearExpr | operations_research::sat::operator- (LinearExpr &&lhs, LinearExpr &&rhs) |
|
LinearExpr | operations_research::sat::operator* (LinearExpr expr, int64_t factor) |
|
LinearExpr | operations_research::sat::operator* (int64_t factor, LinearExpr expr) |
|
DoubleLinearExpr | operations_research::sat::operator- (DoubleLinearExpr expr) |
| For DoubleLinearExpr.
|
|
DoubleLinearExpr | operations_research::sat::operator+ (const DoubleLinearExpr &lhs, const DoubleLinearExpr &rhs) |
|
DoubleLinearExpr | operations_research::sat::operator+ (DoubleLinearExpr &&lhs, const DoubleLinearExpr &rhs) |
|
DoubleLinearExpr | operations_research::sat::operator+ (const DoubleLinearExpr &lhs, DoubleLinearExpr &&rhs) |
|
DoubleLinearExpr | operations_research::sat::operator+ (DoubleLinearExpr &&lhs, DoubleLinearExpr &&rhs) |
|
DoubleLinearExpr | operations_research::sat::operator+ (DoubleLinearExpr expr, double rhs) |
|
DoubleLinearExpr | operations_research::sat::operator+ (double lhs, DoubleLinearExpr expr) |
|
DoubleLinearExpr | operations_research::sat::operator- (const DoubleLinearExpr &lhs, const DoubleLinearExpr &rhs) |
|
DoubleLinearExpr | operations_research::sat::operator- (DoubleLinearExpr &&lhs, const DoubleLinearExpr &rhs) |
|
DoubleLinearExpr | operations_research::sat::operator- (const DoubleLinearExpr &lhs, DoubleLinearExpr &&rhs) |
|
DoubleLinearExpr | operations_research::sat::operator- (DoubleLinearExpr &&lhs, DoubleLinearExpr &&rhs) |
|
DoubleLinearExpr | operations_research::sat::operator- (DoubleLinearExpr epxr, double rhs) |
|
DoubleLinearExpr | operations_research::sat::operator- (double lhs, DoubleLinearExpr expr) |
|
DoubleLinearExpr | operations_research::sat::operator* (DoubleLinearExpr expr, double factor) |
|
DoubleLinearExpr | operations_research::sat::operator* (double factor, DoubleLinearExpr expr) |
|
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
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.
This file implements a wrapper around the CP-SAT model proto.
Here is a minimal example that shows how to create a model, solve it, and print out the solution.
CpModelBuilder cp_model;
const Domain all_animals(0, 20);
const IntVar rabbits = cp_model.NewIntVar(all_animals).WithName("rabbits");
const IntVar pheasants = cp_model.NewIntVar(all_animals).WithName("pheasants");
cp_model.AddEquality(rabbits + pheasants, 20);
cp_model.AddEquality(4 * rabbits + 2 * pheasants, 56);
const CpSolverResponse response = Solve(cp_model.Build());
if (response.status() == CpSolverStatus::OPTIMAL) {
LOG(INFO) << SolutionIntegerValue(response, rabbits)
<< " rabbits, and " << SolutionIntegerValue(response, pheasants)
<< " pheasants.";
}
Definition in file cp_model.h.