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 AbstractDyadScaler
scaler
for 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 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
-
-
-
-
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:
size
in interfacejava.util.Collection<N>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacejava.util.Collection<N>
-
contains
public boolean contains(java.lang.Object o)
- Specified by:
contains
in 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:
toArray
in interfacejava.util.Collection<N>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray
in interfacejava.util.Collection<N>
-
remove
public boolean remove(java.lang.Object o)
- Specified by:
remove
in interfacejava.util.Collection<N>
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAll
in 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:
addAll
in interfacejava.util.Collection<N>
-
removeAll
public boolean removeAll(java.util.Collection<?> c)
- Specified by:
removeAll
in interfacejava.util.Collection<N>
-
retainAll
public boolean retainAll(java.util.Collection<?> c)
- Specified by:
retainAll
in interfacejava.util.Collection<N>
-
clear
public void clear()
- Specified by:
clear
in 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:
offer
in interfacejava.util.Queue<N>
-
remove
public org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,?,V> remove()
- Specified by:
remove
in 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:
poll
in interfacejava.util.Queue<N>
-
element
public org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,?,V> element()
- Specified by:
element
in interfacejava.util.Queue<N>
-
peek
public org.api4.java.ai.graphsearch.problem.pathsearch.pathevaluation.IEvaluatedPath<N,?,V> peek()
- Specified by:
peek
in 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)
-
-