FileDataSource solutionSetInput = new FileDataSource(new DummyInputFormat(), IN_FILE, "Solution Set");
FileDataSource worksetInput = new FileDataSource(new DummyInputFormat(), IN_FILE, "Workset");
FileDataSource invariantInput = new FileDataSource(new DummyInputFormat(), IN_FILE, "Invariant Input");
DeltaIteration iteration = new DeltaIteration(0, ITERATION_NAME);
iteration.setInitialSolutionSet(solutionSetInput);
iteration.setInitialWorkset(worksetInput);
iteration.setMaximumNumberOfIterations(100);
JoinOperator joinWithInvariant = JoinOperator.builder(new DummyMatchStub(), LongValue.class, 0, 0)
.input1(iteration.getWorkset())
.input2(invariantInput)
.name(JOIN_WITH_INVARIANT_NAME)
.build();
JoinOperator joinWithSolutionSet = JoinOperator.builder(
joinPreservesSolutionSet ? new DummyMatchStub() : new DummyNonPreservingMatchStub(), LongValue.class, 0, 0)
.input1(iteration.getSolutionSet())
.input2(joinWithInvariant)
.name(JOIN_WITH_SOLUTION_SET)
.build();
ReduceOperator nextWorkset = ReduceOperator.builder(new IdentityReduce(), LongValue.class, 0)
.input(joinWithSolutionSet)
.name(NEXT_WORKSET_REDUCER_NAME)
.build();
if (mapBeforeSolutionDelta) {
MapOperator mapper = MapOperator.builder(new IdentityMap())
.input(joinWithSolutionSet)
.name(SOLUTION_DELTA_MAPPER_NAME)
.build();
iteration.setSolutionSetDelta(mapper);
} else {
iteration.setSolutionSetDelta(joinWithSolutionSet);
}
iteration.setNextWorkset(nextWorkset);
FileDataSink sink = new FileDataSink(new DummyOutputFormat(), OUT_FILE, iteration, "Sink");
Plan plan = new Plan(sink);
plan.setDefaultParallelism(DEFAULT_PARALLELISM);