Class ADyadRankedNodeQueue<N,​V extends java.lang.Comparable<V>>

  • Type Parameters:
    N - First node parameter
    V - Second node parameter
    All Implemented Interfaces:
    java.lang.Iterable<org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V>>, java.util.Collection<org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V>>, java.util.Queue<org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V>>

    public abstract class ADyadRankedNodeQueue<N,​V extends java.lang.Comparable<V>>
    extends java.lang.Object
    implements java.util.Queue<org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V>>
    A queue whose elements are nodes, sorted by a dyad ranker.
    • Constructor Summary

      Constructors 
      Constructor Description
      ADyadRankedNodeQueue​(org.api4.java.common.math.IVector contextCharacterization)
      Constructs a new DyadRankedNodeQueue that ranks the nodes in the queue according to the given context characterization.
      ADyadRankedNodeQueue​(org.api4.java.common.math.IVector contextCharacterization, IDyadRanker dyadRanker, AbstractDyadScaler scaler)
      Constructs a new DyadRankedNodeQueue that ranks the nodes in the queue according to the given context characterization and given dyad ranker.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean add​(org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V> e)  
      boolean addAll​(java.util.Collection<? extends org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V>> c)  
      protected abstract org.api4.java.common.math.IVector characterize​(org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V> node)
      Provide a characterization of the given node to be used by the dyad ranker.
      void clear()  
      boolean contains​(java.lang.Object o)  
      boolean containsAll​(java.util.Collection<?> c)  
      org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V> element()  
      IDyadRanker getDyadRanker()
      Get the dyad ranker used to rank the nodes.
      AbstractDyadScaler getScaler()  
      boolean isEmpty()  
      java.util.Iterator<org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V>> iterator()  
      boolean offer​(org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V> e)  
      org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V> peek()  
      org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V> poll()  
      org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V> remove()  
      boolean remove​(java.lang.Object o)  
      boolean removeAll​(java.util.Collection<?> c)  
      org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V> removeNodeAtPosition​(int i)  
      boolean retainAll​(java.util.Collection<?> c)  
      void setDyadRanker​(IDyadRanker dyadRanker)
      Set which dyad ranker shall be used to rank the nodes.
      void setScaler​(AbstractDyadScaler scaler)  
      int size()  
      java.lang.Object[] toArray()  
      <T> T[] toArray​(T[] a)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
    • Constructor Detail

      • ADyadRankedNodeQueue

        public ADyadRankedNodeQueue​(org.api4.java.common.math.IVector contextCharacterization)
        Constructs a new DyadRankedNodeQueue that ranks the nodes in the queue according to the given context characterization.
        Parameters:
        contextCharacterization - the characterization of the context the nodes are ranked in
      • ADyadRankedNodeQueue

        public ADyadRankedNodeQueue​(org.api4.java.common.math.IVector contextCharacterization,
                                    IDyadRanker dyadRanker,
                                    AbstractDyadScaler scaler)
        Constructs a new DyadRankedNodeQueue that ranks the nodes in the queue according to the given context characterization and given dyad ranker. Given dyad ranker must be pre-trained.
        Parameters:
        contextCharacterization - the characterization of the context the nodes are ranked in
        dyadRanker - the dyad ranker to be used for the ranking of the nodes
    • Method Detail

      • characterize

        protected abstract org.api4.java.common.math.IVector characterize​(org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V> node)
        Provide a characterization of the given node to be used by the dyad ranker.
        Parameters:
        node - the node to be characterized
        Returns:
        the characterization of the node
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<N>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<N>
      • contains

        public boolean contains​(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<N>
      • iterator

        public java.util.Iterator<org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V>> iterator()
        Specified by:
        iterator in interface java.util.Collection<N>
        Specified by:
        iterator in interface java.lang.Iterable<N>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<N>
      • toArray

        public <T> T[] toArray​(T[] a)
        Specified by:
        toArray in interface java.util.Collection<N>
      • remove

        public boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<N>
      • containsAll

        public boolean containsAll​(java.util.Collection<?> c)
        Specified by:
        containsAll in interface java.util.Collection<N>
      • addAll

        public boolean addAll​(java.util.Collection<? extends org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V>> c)
        Specified by:
        addAll in interface java.util.Collection<N>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<N>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<N>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<N>
      • add

        public boolean add​(org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V> e)
        Specified by:
        add in interface java.util.Collection<N>
        Specified by:
        add in interface java.util.Queue<N>
      • offer

        public boolean offer​(org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V> e)
        Specified by:
        offer in interface java.util.Queue<N>
      • remove

        public org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V> remove()
        Specified by:
        remove in interface java.util.Queue<N>
      • removeNodeAtPosition

        public org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V> removeNodeAtPosition​(int i)
      • poll

        public org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V> poll()
        Specified by:
        poll in interface java.util.Queue<N>
      • element

        public org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V> element()
        Specified by:
        element in interface java.util.Queue<N>
      • peek

        public org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,​?,​V> peek()
        Specified by:
        peek in interface java.util.Queue<N>
      • getDyadRanker

        public IDyadRanker getDyadRanker()
        Get the dyad ranker used to rank the nodes.
        Returns:
        the dyad ranker
      • setDyadRanker

        public void setDyadRanker​(IDyadRanker dyadRanker)
        Set which dyad ranker shall be used to rank the nodes. It is not trained in this class, so it must be pre-trained before setting it as a dyad ranker for this queue!
        Parameters:
        dyadRanker - the dyad ranker