Class ADyadRankedNodeQueue<N,V extends java.lang.Comparable<V>>
- java.lang.Object
-
- ai.libs.jaicore.ml.ranking.dyad.learner.search.ADyadRankedNodeQueue<N,V>
-
- Type Parameters:
N- First node parameterV- 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.
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractDyadScalerscalerfor scaling the dyads
-
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 booleanadd(org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,?,V> e)booleanaddAll(java.util.Collection<? extends org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,?,V>> c)protected abstract org.api4.java.common.math.IVectorcharacterize(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.voidclear()booleancontains(java.lang.Object o)booleancontainsAll(java.util.Collection<?> c)org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,?,V>element()IDyadRankergetDyadRanker()Get the dyad ranker used to rank the nodes.AbstractDyadScalergetScaler()booleanisEmpty()java.util.Iterator<org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,?,V>>iterator()booleanoffer(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()booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,?,V>removeNodeAtPosition(int i)booleanretainAll(java.util.Collection<?> c)voidsetDyadRanker(IDyadRanker dyadRanker)Set which dyad ranker shall be used to rank the nodes.voidsetScaler(AbstractDyadScaler scaler)intsize()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
-
-
-
-
Field Detail
-
scaler
protected AbstractDyadScaler scaler
for scaling the dyads
-
-
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 indyadRanker- 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:
sizein interfacejava.util.Collection<N>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfacejava.util.Collection<N>
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
containsin interfacejava.util.Collection<N>
-
iterator
public java.util.Iterator<org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,?,V>> iterator()
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArrayin interfacejava.util.Collection<N>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArrayin interfacejava.util.Collection<N>
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
removein interfacejava.util.Collection<N>
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAllin interfacejava.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:
addAllin interfacejava.util.Collection<N>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAllin interfacejava.util.Collection<N>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAllin interfacejava.util.Collection<N>
-
clear
public void clear()
- Specified by:
clearin interfacejava.util.Collection<N>
-
add
public boolean add(org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,?,V> e)
-
offer
public boolean offer(org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,?,V> e)
- Specified by:
offerin interfacejava.util.Queue<N>
-
remove
public org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,?,V> remove()
- Specified by:
removein interfacejava.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:
pollin interfacejava.util.Queue<N>
-
element
public org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,?,V> element()
- Specified by:
elementin interfacejava.util.Queue<N>
-
peek
public org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,?,V> peek()
- Specified by:
peekin interfacejava.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
-
getScaler
public AbstractDyadScaler getScaler()
-
setScaler
public void setScaler(AbstractDyadScaler scaler)
-
-