![]() |
Google OR-Tools v9.15
a fast and portable software suite for combinatorial optimization
|
Wrapper class around the cp_model proto.
This class provides two types of methods:
Definition at line 735 of file cp_model.h.
#include <cp_model.h>
Public Member Functions | |
| *Sets the name of the model void | SetName (absl::string_view name) |
| *Creates an integer variable with the given domain IntVar | NewIntVar (const Domain &domain) |
| *Creates a Boolean variable BoolVar | NewBoolVar () |
| *Creates a constant variable This is a shortcut for * | NewVariable (Domain(value)).but it will return the same variable if used *twice with the same const ant. IntVar NewConstant(int64_t value) |
| *Creates an always true Boolean variable *If this is called multiple the same variable will always be *returned BoolVar | TrueVar () |
| *Creates an always false Boolean variable *If this is called multiple the same variable will always be *returned BoolVar | FalseVar () |
| *Creates an interval variable from affine expressions IntervalVar | NewIntervalVar (const LinearExpr &start, const LinearExpr &size, const LinearExpr &end) |
| *Creates an interval variable with a fixed size IntervalVar | NewFixedSizeIntervalVar (const LinearExpr &start, int64_t size) |
| *Creates an optional interval variable from affine expressions and a *Boolean variable IntervalVar | NewOptionalIntervalVar (const LinearExpr &start, const LinearExpr &size, const LinearExpr &end, BoolVar presence) |
| *Creates an optional interval variable with a fixed size IntervalVar | NewOptionalFixedSizeIntervalVar (const LinearExpr &start, int64_t size, BoolVar presence) |
| *It is sometime convenient when building a model to create a bunch of *variables that will later be fixed Instead of doing | AddEquality (var, *value) which add a const raint |
| *It is sometime convenient when building a model to create a bunch of *variables that will later be fixed Instead of doing these functions modify directly the *underlying variable domain *note this ignore completely the original variable domain and just fix *the given variable to the given even if it was outside the given *variable domain You can still use | AddEquality () if this is not what you *want. void FixVariable(IntVar var |
| void | FixVariable (BoolVar var, bool value) |
| *Adds the constraint that at least one of the literals must be true Constraint | AddBoolOr (absl::Span< const BoolVar > literals) |
| *Same as | AddBoolOr (). Sum literals > |
| *At most one literal is true Sum literals<=1. Constraint AddAtMostOne(absl::Span< const BoolVar > literals); *Exactly one literal is true. Sum literals==1. Constraint AddExactlyOne(absl::Span< const BoolVar > literals); *Adds the constraint that all literals must be true. Constraint AddBoolAnd(absl::Span< const BoolVar > literals); *Adds the constraint that an odd number of literals is true. Constraint AddBoolXor(absl::Span< const BoolVar > literals); *Adds a=> b Constraint | AddImplication (BoolVar a, BoolVar b) |
| *Adds left right Constraint | AddGreaterThan (const LinearExpr &left, const LinearExpr &right) |
Public Attributes | |
| *Creates an always true Boolean variable *If this is called multiple | times |
| *Creates an always false Boolean variable *If this is called multiple | times |
| *It is sometime convenient when building a model to create a bunch of *variables that will later be fixed Instead of doing these functions modify directly the *underlying variable domain *note this ignore completely the original variable domain and just fix *the given variable to the given | value |
| *It is sometime convenient when building a model to create a bunch of *variables that will later be fixed Instead of doing these functions modify directly the *underlying variable domain *note this ignore completely the original variable domain and just fix *the given variable to the given even if it was outside the given *variable domain You can still use int64_t | value |
| *Adds | implication: if all lhs vars are true then all rhs vars must be true. Constraint AddImplication(absl::Span<const BoolVar> lhs |
| *Adds absl::Span< const BoolVar > | rhs |
| *Adds | left |
| *Same as operations_research::sat::CpModelBuilder::AddBoolOr | ( | ) |
| Constraint operations_research::sat::CpModelBuilder::AddBoolOr | ( | absl::Span< const BoolVar > | literals | ) |
Definition at line 781 of file cp_model.cc.
| *It is sometime convenient when building a model to create a bunch of *variables that will later be fixed Instead of doing these functions modify directly the *underlying variable domain *note this ignore completely the original variable domain and just fix *the given variable to the given even if it was outside the given *variable domain You can still use operations_research::sat::CpModelBuilder::AddEquality | ( | ) |
| *It is sometime convenient when building a model to create a bunch of *variables that will later be fixed Instead of doing operations_research::sat::CpModelBuilder::AddEquality | ( | var | , |
| * | value ) const |
| Constraint operations_research::sat::CpModelBuilder::AddGreaterThan | ( | const LinearExpr & | left, |
| const LinearExpr & | right ) |
Definition at line 870 of file cp_model.cc.
|
inline |
Definition at line 810 of file cp_model.h.
| BoolVar operations_research::sat::CpModelBuilder::FalseVar | ( | ) |
Definition at line 712 of file cp_model.cc.
| void operations_research::sat::CpModelBuilder::FixVariable | ( | BoolVar | var, |
| bool | value ) |
Definition at line 767 of file cp_model.cc.
| BoolVar operations_research::sat::CpModelBuilder::NewBoolVar | ( | ) |
Definition at line 696 of file cp_model.cc.
| IntervalVar operations_research::sat::CpModelBuilder::NewFixedSizeIntervalVar | ( | const LinearExpr & | start, |
| int64_t | size ) |
Definition at line 728 of file cp_model.cc.
| IntervalVar operations_research::sat::CpModelBuilder::NewIntervalVar | ( | const LinearExpr & | start, |
| const LinearExpr & | size, | ||
| const LinearExpr & | end ) |
Definition at line 716 of file cp_model.cc.
Definition at line 686 of file cp_model.cc.
| IntervalVar operations_research::sat::CpModelBuilder::NewOptionalFixedSizeIntervalVar | ( | const LinearExpr & | start, |
| int64_t | size, | ||
| BoolVar | presence ) |
Definition at line 754 of file cp_model.cc.
| IntervalVar operations_research::sat::CpModelBuilder::NewOptionalIntervalVar | ( | const LinearExpr & | start, |
| const LinearExpr & | size, | ||
| const LinearExpr & | end, | ||
| BoolVar | presence ) |
Definition at line 740 of file cp_model.cc.
| *Creates a constant variable This is a shortcut for * operations_research::sat::CpModelBuilder::NewVariable | ( | Domain(value) | ) | const |
| void operations_research::sat::CpModelBuilder::SetName | ( | absl::string_view | name | ) |
Definition at line 650 of file cp_model.cc.
| BoolVar operations_research::sat::CpModelBuilder::TrueVar | ( | ) |
Definition at line 708 of file cp_model.cc.
| * Adds operations_research::sat::CpModelBuilder::implication |
Definition at line 814 of file cp_model.h.
| *Adds operations_research::sat::CpModelBuilder::left |
Definition at line 820 of file cp_model.h.
| * Adds absl::Span<const BoolVar> operations_research::sat::CpModelBuilder::rhs |
Definition at line 816 of file cp_model.h.
| * Creates an always false Boolean variable* If this is called multiple operations_research::sat::CpModelBuilder::times |
Definition at line 757 of file cp_model.h.
| * Creates an always true Boolean variable* If this is called multiple operations_research::sat::CpModelBuilder::times |
Definition at line 752 of file cp_model.h.
| *It is sometime convenient when building a model to create a bunch of *variables that will later be fixed Instead of doing these functions modify directly the *underlying variable domain *note this ignore completely the original variable domain and just fix *the given variable to the given even if it was outside the given *variable domain You can still use int64_t operations_research::sat::CpModelBuilder::value |
Definition at line 788 of file cp_model.h.
| *It is sometime convenient when building a model to create a bunch of *variables that will later be fixed Instead of doing these functions modify directly the* underlying variable domain* note this ignore completely the original variable domain and just fix* the given variable to the given operations_research::sat::CpModelBuilder::value |
Definition at line 785 of file cp_model.h.