MCPcopy Create free account
hub / github.com/Gecode/gecode / BoolVar

Class BoolVar

gecode/int.hh:515–597  ·  view source on GitHub ↗

* \brief Boolean integer variables * * \ingroup TaskModelIntVars */

Source from the content-addressed store, hash-verified

513 * \ingroup TaskModelIntVars
514 */
515 class BoolVar : public VarImpVar<Int::BoolVarImp> {
516 friend class BoolVarArray;
517 friend class BoolVarArgs;
518 private:
519 using VarImpVar<Int::BoolVarImp>::x;
520 /**
521 * \brief Initialize Boolean variable with range domain
522 *
523 * The variable is created with a domain ranging from \a min
524 * to \a max. No exceptions are thrown.
525 */
526 void _init(Space& home, int min, int max);
527 public:
528 /// \name Constructors and initialization
529 //@{
530 /// Default constructor
531 BoolVar(void);
532 /// Initialize from Boolean variable \a y
533 BoolVar(const BoolVar& y);
534 /// Initialize from Boolean view \a y
535 BoolVar(const Int::BoolView& y);
536 /**
537 * \brief Initialize Boolean variable with range domain
538 *
539 * The variable is created with a domain ranging from \a min
540 * to \a max. The following exceptions might be thrown:
541 * - If \a min is greater than \a max, an exception of type
542 * Gecode::Int::VariableEmptyDomain is thrown.
543 * - If \a min is less than 0 or \a max is greater than 1,
544 * an exception of type
545 * Gecode::Int::NotZeroOne is thrown.
546 */
547 GECODE_INT_EXPORT BoolVar(Space& home, int min, int max);
548 //@}
549
550 /// \name Value access
551 //@{
552 /// Return minimum of domain
553 int min(void) const;
554 /// Return maximum of domain
555 int max(void) const;
556 /// Return median of domain (greatest element not greater than the median)
557 int med(void) const;
558 /**
559 * \brief Return assigned value
560 *
561 * Throws an exception of type Int::ValOfUnassignedVar if variable
562 * is not yet assigned.
563 *
564 */
565 int val(void) const;
566
567 /// Return size (cardinality) of domain
568 unsigned int size(void) const;
569 /// Return width of domain (distance between maximum and minimum)
570 unsigned int width(void) const;
571 /// Return regret of domain minimum (distance to next larger value)
572 unsigned int regret_min(void) const;

Callers 3

setForAllMethod · 0.50
QCSPNimFiboMethod · 0.50
SteelMillMethod · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected