Class Rules


  • public class Rules
    extends Object
    A set of rules for RuleStore

    Created by cprudhom on 17/03/15. Project: choco.

    Author:
    Charles Prud'homme
    • Constructor Summary

      Constructors 
      Constructor Description
      Rules​(int i1, int i2)
      Creates a set of rules for RuleStore.
    • Constructor Detail

      • Rules

        public Rules​(int i1,
                     int i2)
        Creates a set of rules for RuleStore. It stores events related to an explanation.
        Parameters:
        i1 - initial size of vmMasks
        i2 - initial size of remVal
    • Method Detail

      • getPaRules

        public boolean getPaRules​(int pid)
        Get the propagator activation rule associated with 'pid'
        Parameters:
        pid - a propagator id
        Returns:
        true if the rule exists
      • paRulesClear

        public void paRulesClear​(int pid)
        Clear the propagator activation rule associated with 'pid'
        Parameters:
        pid - a propagator id
      • addPaRules

        public void addPaRules​(int pid)
        Add a propagator activation rule for 'pid'
        Parameters:
        pid - a propagator id
      • getVmRules

        public int getVmRules​(int vid)
        Get the variable modification rule associated with 'vid'
        Parameters:
        vid - a variable id
        Returns:
        the mask of rules
      • getVmRemval

        public gnu.trove.set.TIntSet getVmRemval​(int vid)
        Get the removed values associated with 'vid'
        Parameters:
        vid - the variable id
        Returns:
        the set of removed values up to now
      • putMask

        public boolean putMask​(int vid,
                               int mask)
        Update the rule mask for a given variable (denoted by its vid)
        Parameters:
        vid - the index of the variable
        mask - the new mask to merge
        Returns:
        true if the mask has been updated (false = already existing mask)
      • clear

        public void clear()
        Clear this
      • intersect

        public boolean intersect​(int i1,
                                 int i2,
                                 int vid)
        Check whether an interval intersects at least one value from a given set
        Parameters:
        i1 - lower bound of the interval (included)
        i2 - upper bound of the interval (included)
        vid - variable id
        Returns:
        true if intersection is not empty
      • or

        public void or​(Rules rules)
        Merge 'rules' into this
        Parameters:
        rules - a set of rules
      • isEmpty

        public boolean isEmpty()
        Returns:
        true if the rules are not valuated, meaning that the explanation is complete