use of searcher.pack.SeparableMinos in project solution-finder by knewjade.
the class OnDemandBasicSolutionsTest method get3x4.
@Test
void get3x4() throws Exception {
SizedBit sizedBit = new SizedBit(3, 4);
SeparableMinos separableMinos = createSeparableMinos(sizedBit);
Predicate<ColumnField> memorizedPredicate = columnField -> true;
OnDemandBasicSolutions solutions = new OnDemandBasicSolutions(separableMinos, sizedBit, memorizedPredicate);
Stream<? extends MinoField> stream = solutions.parse(ColumnFieldFactory.createField()).stream();
assertThat(stream.count()).isEqualTo(8516L);
}
use of searcher.pack.SeparableMinos in project solution-finder by knewjade.
the class OnDemandBasicSolutionsTest method get3x3.
@Test
void get3x3() throws Exception {
SizedBit sizedBit = new SizedBit(3, 3);
SeparableMinos separableMinos = createSeparableMinos(sizedBit);
Predicate<ColumnField> memorizedPredicate = columnField -> true;
OnDemandBasicSolutions solutions = new OnDemandBasicSolutions(separableMinos, sizedBit, memorizedPredicate);
Stream<? extends MinoField> stream = solutions.parse(ColumnFieldFactory.createField()).stream();
assertThat(stream.count()).isEqualTo(278L);
}
use of searcher.pack.SeparableMinos in project solution-finder by knewjade.
the class OnDemandBasicSolutionsTest method get2x4.
@Test
void get2x4() throws Exception {
SizedBit sizedBit = new SizedBit(2, 4);
SeparableMinos separableMinos = createSeparableMinos(sizedBit);
Predicate<ColumnField> memorizedPredicate = columnField -> true;
OnDemandBasicSolutions solutions = new OnDemandBasicSolutions(separableMinos, sizedBit, memorizedPredicate);
Stream<? extends MinoField> stream = solutions.parse(ColumnFieldFactory.createField()).stream();
assertThat(stream.count()).isEqualTo(1239L);
}
use of searcher.pack.SeparableMinos 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());
}
}
use of searcher.pack.SeparableMinos in project solution-finder by knewjade.
the class PackSearcherTest method createMappedBasicSolutions.
private BasicSolutions createMappedBasicSolutions(SizedBit sizedBit) {
SeparableMinos separableMinos = SeparableMinos.createSeparableMinos(minoFactory, minoShifter, sizedBit);
BasicSolutionsCalculator calculator = new BasicSolutionsCalculator(separableMinos, sizedBit);
Map<ColumnField, RecursiveMinoFields> calculate = calculator.calculate();
return new MappedBasicSolutions(calculate);
}
Aggregations