OR-Tools  8.2
ReservoirConstraint

Detailed Description

Specialized reservoir constraint.

This constraint allows adding emptying/refilling events to the reservoir constraint incrementally.

Definition at line 514 of file cp_model.h.

Public Member Functions

void AddEvent (IntVar time, int64 demand)
 Adds a mandatory event. More...
 
void AddOptionalEvent (IntVar time, int64 demand, BoolVar is_active)
 Adds a optional event. More...
 
Constraint OnlyEnforceIf (absl::Span< const BoolVar > literals)
 The constraint will be enforced iff all literals listed here are true. More...
 
Constraint OnlyEnforceIf (BoolVar literal)
 See OnlyEnforceIf(absl::Span<const BoolVar> literals). More...
 
Constraint WithName (const std::string &name)
 Sets the name of the constraint. More...
 
const std::string & Name () const
 Returns the name of the constraint (or the empty string if not set). More...
 
const ConstraintProto & Proto () const
 Returns the underlying protobuf object (useful for testing). More...
 
ConstraintProto * MutableProto () const
 Returns the mutable underlying protobuf object (useful for model edition). More...
 

Protected Attributes

ConstraintProto * proto_ = nullptr
 

Member Function Documentation

◆ AddEvent()

void AddEvent ( IntVar  time,
int64  demand 
)

Adds a mandatory event.

It will increase the used capacity by c demand at timec time.

Definition at line 248 of file cp_model.cc.

◆ AddOptionalEvent()

void AddOptionalEvent ( IntVar  time,
int64  demand,
BoolVar  is_active 
)

Adds a optional event.

If c is_active is true, It will increase the used capacity byc demand at time `c time.

Definition at line 255 of file cp_model.cc.

◆ MutableProto()

ConstraintProto* MutableProto ( ) const
inlineinherited

Returns the mutable underlying protobuf object (useful for model edition).

Definition at line 436 of file cp_model.h.

◆ Name()

const std::string & Name ( ) const
inherited

Returns the name of the constraint (or the empty string if not set).

Definition at line 211 of file cp_model.cc.

◆ OnlyEnforceIf() [1/2]

Constraint OnlyEnforceIf ( absl::Span< const BoolVar literals)
inherited

The constraint will be enforced iff all literals listed here are true.

If this is empty, then the constraint will always be enforced. An enforced constraint must be satisfied, and an un-enforced one will simply be ignored.

This is also called half-reification. To have an equivalence between a literal and a constraint (full reification), one must add both a constraint (controlled by a literal l) and its negation (controlled by the negation of l).

Important: as of September 2018, only a few constraint support enforcement:

  • bool_or, bool_and, linear: fully supported.
  • interval: only support a single enforcement literal.
  • other: no support (but can be added on a per-demand basis).

Definition at line 213 of file cp_model.cc.

◆ OnlyEnforceIf() [2/2]

Constraint OnlyEnforceIf ( BoolVar  literal)
inherited

◆ Proto()

const ConstraintProto& Proto ( ) const
inlineinherited

Returns the underlying protobuf object (useful for testing).

Definition at line 433 of file cp_model.h.

◆ WithName()

Constraint WithName ( const std::string &  name)
inherited

Sets the name of the constraint.

Definition at line 206 of file cp_model.cc.

Member Data Documentation

◆ proto_

ConstraintProto* proto_ = nullptr
protectedinherited

Definition at line 443 of file cp_model.h.


The documentation for this class was generated from the following files: