use of searcher.pack.SizedBit in project solution-finder by knewjade.
the class OnDemandBasicSolutionsFactoryTest method create3x3.
@Test
void create3x3() throws Exception {
SizedBit sizedBit = new SizedBit(3, 3);
int expectedSolutions = 254;
int expectedSolutionItems = 3972;
assertCache(sizedBit, expectedSolutions, expectedSolutionItems);
}
use of searcher.pack.SizedBit in project solution-finder by knewjade.
the class OnDemandBasicSolutionsFactoryTest method create2x6.
@Test
@LongTest
void create2x6() throws Exception {
SizedBit sizedBit = new SizedBit(2, 6);
int expectedSolutions = 3490;
int expectedSolutionItems = 8380826;
assertCache(sizedBit, expectedSolutions, expectedSolutionItems);
}
use of searcher.pack.SizedBit in project solution-finder by knewjade.
the class OnDemandBasicSolutionsTest method get3x5.
@Test
void get3x5() throws Exception {
assertTimeout(ofMinutes(1), () -> {
SizedBit sizedBit = new SizedBit(3, 5);
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(260179L);
});
}
use of searcher.pack.SizedBit in project solution-finder by knewjade.
the class OnDemandBasicSolutionsTest method get2x5.
@Test
void get2x5() throws Exception {
SizedBit sizedBit = new SizedBit(2, 5);
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(19375L);
}
use of searcher.pack.SizedBit in project solution-finder by knewjade.
the class PackSearcherComparingParityBasedTest 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);
BasicSolutionsCalculator calculator = new BasicSolutionsCalculator(separableMinos, sizedBit);
Map<ColumnField, RecursiveMinoFields> calculate = calculator.calculate();
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 MappedBasicSolutions(calculate, solutionFilter);
long packCounter = calculateSRSValidCount(sizedBit, basicSolutions, initField, solutionFilter);
System.out.println(usingPieces);
assertThat(packCounter).isEqualTo(data.getCount());
}
}
Aggregations