![]() |
Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
|
Declaration of the core objects for the constraint solver.
The literature around constraint programming is extremely dense but one can find some basic introductions in the following links:
Here is a very simple Constraint Programming problem:
If we see 56 legs and 20 heads, how many two-legged pheasants and four-legged rabbits are we looking at?
Here is some simple Constraint Programming code to find out:
which outputs:
rabbits -> 8, pheasants -> 12
Solver(name = "pheasant",
state = OUTSIDE_SEARCH,
branches = 0,
fails = 0,
decisions = 0
propagation loops = 11,
demons Run = 25,
Run time = 0 ms)
Definition in file constraint_solver.h.
#include <stddef.h>#include <stdint.h>#include <deque>#include <functional>#include <memory>#include <ostream>#include <random>#include <string>#include <utility>#include <vector>#include "absl/base/attributes.h"#include "absl/base/log_severity.h"#include "absl/container/flat_hash_map.h"#include "absl/container/flat_hash_set.h"#include "absl/flags/declare.h"#include "absl/flags/flag.h"#include "absl/log/check.h"#include "absl/random/random.h"#include "absl/strings/str_format.h"#include "absl/strings/string_view.h"#include "absl/time/time.h"#include "absl/types/span.h"#include "ortools/base/base_export.h"#include "ortools/base/logging.h"#include "ortools/base/map_util.h"#include "ortools/base/timer.h"#include "ortools/base/types.h"#include "ortools/constraint_solver/search_stats.pb.h"#include "ortools/constraint_solver/solver_parameters.pb.h"#include "ortools/util/piecewise_linear_function.h"#include "ortools/util/saturated_arithmetic.h"#include "ortools/util/sorted_interval_list.h"#include "ortools/util/tuple_set.h"Go to the source code of this file.
Namespaces | |
| namespace | operations_research |
| OR-Tools root namespace. | |
Functions | |
| OR_DLL | ABSL_DECLARE_FLAG (int64_t, cp_random_seed) |
| OR_DLL | ABSL_DECLARE_FLAG (bool, cp_disable_solve) |
| int64_t | operations_research::CpRandomSeed () |
| std::ostream & | operations_research::operator<< (std::ostream &out, const Solver *const s) |
| int64_t | operations_research::Zero () |
| NOLINT. | |
| int64_t | operations_research::One () |
| This method returns 1. | |
| std::ostream & | operations_research::operator<< (std::ostream &out, const BaseObject *const o) |
| std::ostream & | operations_research::operator<< (std::ostream &out, const Assignment &assignment) |
| void | operations_research::SetAssignmentFromAssignment (Assignment *target_assignment, const std::vector< IntVar * > &target_vars, const Assignment *source_assignment, const std::vector< IntVar * > &source_vars) |
| NOLINT. | |
| OR_DLL ABSL_DECLARE_FLAG | ( | bool | , |
| cp_disable_solve | ) |
| OR_DLL ABSL_DECLARE_FLAG | ( | int64_t | , |
| cp_random_seed | ) |