use of searcher.pack.solutions.FilterWrappedBasicSolutions in project solution-finder by knewjade.
the class PackSearcherComparingParityBasedOnDemandTest method compareCount.
private void compareCount(int width, int height, List<TestData> testDataList) throws InterruptedException, ExecutionException {
SizedBit sizedBit = new SizedBit(width, height);
SeparableMinos separableMinos = createSeparableMinos(sizedBit);
Predicate<ColumnField> bitCountPredicate = BasicSolutions.createBitCountPredicate(1);
OnDemandBasicSolutions onDemandBasicSolutions = new OnDemandBasicSolutions(separableMinos, sizedBit, bitCountPredicate);
for (TestData data : testDataList) {
// 準備
List<Piece> usingPieces = data.getPieces();
int popCount = usingPieces.size();
Field initField = createSquareEmptyField(height, popCount);
// packで探索
Set<PieceCounter> pieceCounters = Collections.singleton(new PieceCounter(usingPieces));
SolutionFilter solutionFilter = createUsingBlockAndValidKeyMementoFilter(initField, sizedBit, pieceCounters);
BasicSolutions basicSolutions = new FilterWrappedBasicSolutions(onDemandBasicSolutions, solutionFilter);
long packCounter = calculateSRSValidCount(sizedBit, basicSolutions, initField, solutionFilter);
System.out.println(usingPieces);
assertThat(packCounter).isEqualTo(data.getCount());
}
}
Aggregations