ST
- The data type of the solution set.WT
- The data type of the workset (the feedback data set).public class DeltaIteration<ST,WT> extends Object
DataSet.iterateDelta(DataSet, int, int...)
method.Modifier and Type | Class and Description |
---|---|
static class |
DeltaIteration.SolutionSetPlaceHolder<ST>
A
DataSet that acts as a placeholder for the solution set during the iteration. |
static class |
DeltaIteration.WorksetPlaceHolder<WT>
A
DataSet that acts as a placeholder for the workset during the iteration. |
Constructor and Description |
---|
DeltaIteration(ExecutionEnvironment context,
org.apache.flink.api.common.typeinfo.TypeInformation<ST> type,
DataSet<ST> solutionSet,
DataSet<WT> workset,
Keys<ST> keys,
int maxIterations) |
Modifier and Type | Method and Description |
---|---|
DataSet<ST> |
closeWith(DataSet<ST> solutionSetDelta,
DataSet<WT> newWorkset)
Closes the delta iteration.
|
org.apache.flink.api.common.aggregators.AggregatorRegistry |
getAggregators()
Gets the registry for aggregators for the iteration.
|
DataSet<ST> |
getInitialSolutionSet()
Gets the initial solution set.
|
DataSet<WT> |
getInitialWorkset()
Gets the initial workset.
|
String |
getName()
Gets the name from this iteration.
|
int |
getParallelism()
Gets the iteration's parallelism.
|
DeltaIteration.SolutionSetPlaceHolder<ST> |
getSolutionSet()
Gets the solution set of the delta iteration.
|
DeltaIteration.WorksetPlaceHolder<WT> |
getWorkset()
Gets the working set of the delta iteration.
|
boolean |
isSolutionSetUnManaged()
gets whether the solution set is in managed or unmanaged memory.
|
DeltaIteration<ST,WT> |
name(String name)
Sets the name for the iteration.
|
DeltaIteration<ST,WT> |
parallelism(int parallelism)
Sets the parallelism for the iteration.
|
DeltaIteration<ST,WT> |
registerAggregator(String name,
org.apache.flink.api.common.aggregators.Aggregator<?> aggregator)
Registers an
Aggregator for the iteration. |
void |
setSolutionSetUnManaged(boolean solutionSetUnManaged)
Sets whether to keep the solution set in managed memory (safe against heap exhaustion) or unmanaged memory
(objects on heap).
|
public DataSet<ST> closeWith(DataSet<ST> solutionSetDelta, DataSet<WT> newWorkset)
solutionSetDelta
- The delta for the solution set. The delta will be merged into the solution set at the end of
each iteration.newWorkset
- The new workset (feedback data set) that will be fed back to the next iteration.DataSet.iterateDelta(DataSet, int, int...)
public DataSet<ST> getInitialSolutionSet()
Consider the following example:
DataSet<MyType> solutionSetData = ...;
DataSet<AnotherType> worksetData = ...;
DeltaIteration<MyType, AnotherType> iteration = solutionSetData.iteratorDelta(worksetData, 10, ...);
The solutionSetData would be the data set returned by iteration.getInitialSolutionSet();
.public DataSet<WT> getInitialWorkset()
Consider the following example:
DataSet<MyType> solutionSetData = ...;
DataSet<AnotherType> worksetData = ...;
DeltaIteration<MyType, AnotherType> iteration = solutionSetData.iteratorDelta(worksetData, 10, ...);
The worksetData would be the data set returned by iteration.getInitialWorkset();
.public DeltaIteration.SolutionSetPlaceHolder<ST> getSolutionSet()
public DeltaIteration.WorksetPlaceHolder<WT> getWorkset()
public DeltaIteration<ST,WT> name(String name)
name
- The name for the iteration.public String getName()
public DeltaIteration<ST,WT> parallelism(int parallelism)
parallelism
- The parallelism.public int getParallelism()
public DeltaIteration<ST,WT> registerAggregator(String name, org.apache.flink.api.common.aggregators.Aggregator<?> aggregator)
Aggregator
for the iteration. Aggregators can be used to maintain simple statistics during the
iteration, such as number of elements processed. The aggregators compute global aggregates: After each iteration step,
the values are globally aggregated to produce one aggregate that represents statistics across all parallel instances.
The value of an aggregator can be accessed in the next iteration.
Aggregators can be accessed inside a function via the
AbstractRichFunction.getIterationRuntimeContext()
method.
name
- The name under which the aggregator is registered.aggregator
- The aggregator class.public org.apache.flink.api.common.aggregators.AggregatorRegistry getAggregators()
public void setSolutionSetUnManaged(boolean solutionSetUnManaged)
solutionSetUnManaged
- True to keep the solution set in unmanaged memory, false to keep it in managed memory.isSolutionSetUnManaged()
public boolean isSolutionSetUnManaged()
setSolutionSetUnManaged(boolean)
Copyright © 2014–2015 The Apache Software Foundation. All rights reserved.