Class PrioritySearch<T extends Var>

  • Type Parameters:
    T - type of variable being used in the Search.
    All Implemented Interfaces:
    Search<T>

    public class PrioritySearch<T extends Var>
    extends DepthFirstSearch<T>
    PrioritySearch selects first a row in the matrix based on metric of the variable at the pririty vector. As soon as a row is choosen, variables are selected for indomain method. The row selection is done with the help of pririty variable comparators. Two comparators can be employed main and tiebreaking one. If two are not sufficient to differentiate two rows than the lexigraphical ordering is used. Based on paper "Priority Search with MiniZinc" by Thibaut Feydy, Adrian Goldwaser, Andreas Schutt, Peter J. Stuckey,and Kenneth D. Young, in ModRef'2017: The Sixtenth International Workshop on Constraint Modelling and Reformulation at CP 2017.
    Version:
    4.8
    • Constructor Detail

      • PrioritySearch

        public PrioritySearch​(T[] priority,
                              ComparatorVariable<T> comparator,
                              DepthFirstSearch<T>[] dfs)
        It constructs a PrioritySearch variable ordering.
        Parameters:
        priority - prority variables used to select a sub-vector of vars (row)
        dfs - vector of depth first searches to be selected from; they must have SelectChoicePoint set.
        comparator - the variable comparator to choose the proper sub.search. // * @param indomain variable ordering value to be used to determine value for a given variable.
    • Method Detail

      • labeling

        public boolean labeling​(Store store,
                                SelectChoicePoint<T> select)
        Description copied from interface: Search
        It performs search using supplied choice point selection heuristic.
        Specified by:
        labeling in interface Search<T extends Var>
        Overrides:
        labeling in class DepthFirstSearch<T extends Var>
        Parameters:
        store - the store within which the search is conducted.
        select - the selection choice point heuristic.
        Returns:
        true if the solution was found.
      • labeling

        public boolean labeling​(Store store)
      • labeling

        public boolean labeling​(Store store,
                                SelectChoicePoint<T> select,
                                Var costVar)
        Description copied from interface: Search
        It performs search using supplied choice point selection heuristic, as well as costVariable as aim at finding an optimal solution.
        Specified by:
        labeling in interface Search<T extends Var>
        Overrides:
        labeling in class DepthFirstSearch<T extends Var>
        Parameters:
        store - constraint store which will be used by labeling.
        select - the selection choice point heuristic.
        costVar - variable to specify cost.
        Returns:
        true if the solution was found.
      • labeling

        public boolean labeling​(Store store,
                                Var costVar)
      • labeling

        public boolean labeling()
        Description copied from class: DepthFirstSearch
        It is a labeling function called if the search is a sub-search being called from the parent search. It never assigns a solution as it will be immediately retracted by search calling this one.
        Specified by:
        labeling in interface Search<T extends Var>
        Overrides:
        labeling in class DepthFirstSearch<T extends Var>
        Returns:
        true if the solution was found.
      • label

        public boolean label​(int n)
        Description copied from class: DepthFirstSearch
        This function is called recursively to assign variables one by one.
        Specified by:
        label in interface Search<T extends Var>
        Overrides:
        label in class DepthFirstSearch<T extends Var>
        Parameters:
        n - the index to the first variable which has not been grounded yet.
        Returns:
        true if the solution was found.
      • getStatistics

        public void getStatistics()
      • statistics

        java.lang.String statistics()
      • setCostVariable

        public void setCostVariable​(Var cost)
      • getSubSearch

        int getSubSearch()
      • setSolutionLimit

        public void setSolutionLimit​(int no)
      • noSolutions

        public int noSolutions()