Search in sources :

Example 21 with SeparableMinos

use of searcher.pack.SeparableMinos in project solution-finder by knewjade.

the class MappedBasicSolutionsTest method get3x5.

@Test
void get3x5() throws Exception {
    SizedBit sizedBit = new SizedBit(3, 5);
    SeparableMinos separableMinos = createSeparableMinos(sizedBit);
    BasicSolutionsCalculator calculator = new BasicSolutionsCalculator(separableMinos, sizedBit);
    Map<ColumnField, RecursiveMinoFields> calculate = calculator.calculate();
    BasicSolutions solutions = new MappedBasicSolutions(calculate);
    MinoFields minoFields = solutions.parse(ColumnFieldFactory.createField());
    Stream<? extends MinoField> stream = minoFields.stream();
    assertThat(stream.count()).isEqualTo(260179L);
}
Also used : RecursiveMinoFields(searcher.pack.mino_fields.RecursiveMinoFields) MinoFields(searcher.pack.mino_fields.MinoFields) SeparableMinos(searcher.pack.SeparableMinos) SizedBit(searcher.pack.SizedBit) ColumnField(core.column_field.ColumnField) RecursiveMinoFields(searcher.pack.mino_fields.RecursiveMinoFields) BasicSolutions(searcher.pack.calculator.BasicSolutions) Test(org.junit.jupiter.api.Test)

Example 22 with SeparableMinos

use of searcher.pack.SeparableMinos in project solution-finder by knewjade.

the class MappedBasicSolutionsTest method get2x4.

@Test
void get2x4() throws Exception {
    SizedBit sizedBit = new SizedBit(2, 4);
    SeparableMinos separableMinos = createSeparableMinos(sizedBit);
    BasicSolutionsCalculator calculator = new BasicSolutionsCalculator(separableMinos, sizedBit);
    Map<ColumnField, RecursiveMinoFields> calculate = calculator.calculate();
    BasicSolutions solutions = new MappedBasicSolutions(calculate);
    MinoFields minoFields = solutions.parse(ColumnFieldFactory.createField());
    Stream<? extends MinoField> stream = minoFields.stream();
    assertThat(stream.count()).isEqualTo(1239L);
}
Also used : RecursiveMinoFields(searcher.pack.mino_fields.RecursiveMinoFields) MinoFields(searcher.pack.mino_fields.MinoFields) SeparableMinos(searcher.pack.SeparableMinos) SizedBit(searcher.pack.SizedBit) ColumnField(core.column_field.ColumnField) RecursiveMinoFields(searcher.pack.mino_fields.RecursiveMinoFields) BasicSolutions(searcher.pack.calculator.BasicSolutions) Test(org.junit.jupiter.api.Test)

Example 23 with SeparableMinos

use of searcher.pack.SeparableMinos in project solution-finder by knewjade.

the class MappedBasicSolutionsTest method get2x5.

@Test
void get2x5() throws Exception {
    SizedBit sizedBit = new SizedBit(2, 5);
    SeparableMinos separableMinos = createSeparableMinos(sizedBit);
    BasicSolutionsCalculator calculator = new BasicSolutionsCalculator(separableMinos, sizedBit);
    Map<ColumnField, RecursiveMinoFields> calculate = calculator.calculate();
    BasicSolutions solutions = new MappedBasicSolutions(calculate);
    MinoFields minoFields = solutions.parse(ColumnFieldFactory.createField());
    Stream<? extends MinoField> stream = minoFields.stream();
    assertThat(stream.count()).isEqualTo(19375L);
}
Also used : RecursiveMinoFields(searcher.pack.mino_fields.RecursiveMinoFields) MinoFields(searcher.pack.mino_fields.MinoFields) SeparableMinos(searcher.pack.SeparableMinos) SizedBit(searcher.pack.SizedBit) ColumnField(core.column_field.ColumnField) RecursiveMinoFields(searcher.pack.mino_fields.RecursiveMinoFields) BasicSolutions(searcher.pack.calculator.BasicSolutions) Test(org.junit.jupiter.api.Test)

Example 24 with SeparableMinos

use of searcher.pack.SeparableMinos in project solution-finder by knewjade.

the class MappedBasicSolutionsTest method get3x3.

@Test
void get3x3() throws Exception {
    SizedBit sizedBit = new SizedBit(3, 3);
    SeparableMinos separableMinos = createSeparableMinos(sizedBit);
    BasicSolutionsCalculator calculator = new BasicSolutionsCalculator(separableMinos, sizedBit);
    Map<ColumnField, RecursiveMinoFields> calculate = calculator.calculate();
    BasicSolutions solutions = new MappedBasicSolutions(calculate);
    MinoFields minoFields = solutions.parse(ColumnFieldFactory.createField());
    Stream<? extends MinoField> stream = minoFields.stream();
    assertThat(stream.count()).isEqualTo(278L);
}
Also used : RecursiveMinoFields(searcher.pack.mino_fields.RecursiveMinoFields) MinoFields(searcher.pack.mino_fields.MinoFields) SeparableMinos(searcher.pack.SeparableMinos) SizedBit(searcher.pack.SizedBit) ColumnField(core.column_field.ColumnField) RecursiveMinoFields(searcher.pack.mino_fields.RecursiveMinoFields) BasicSolutions(searcher.pack.calculator.BasicSolutions) Test(org.junit.jupiter.api.Test)

Example 25 with SeparableMinos

use of searcher.pack.SeparableMinos in project solution-finder by knewjade.

the class OnDemandBasicSolutionsTest method get2x3.

@Test
void get2x3() throws Exception {
    SizedBit sizedBit = new SizedBit(2, 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(78L);
}
Also used : MinoShifter(core.mino.MinoShifter) Predicate(java.util.function.Predicate) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) ColumnField(core.column_field.ColumnField) Duration.ofSeconds(java.time.Duration.ofSeconds) ColumnFieldFactory(core.column_field.ColumnFieldFactory) Test(org.junit.jupiter.api.Test) SizedBit(searcher.pack.SizedBit) Stream(java.util.stream.Stream) MinoFactory(core.mino.MinoFactory) SeparableMinos(searcher.pack.SeparableMinos) Duration.ofMinutes(java.time.Duration.ofMinutes) MinoField(searcher.pack.mino_field.MinoField) Assertions.assertTimeout(org.junit.jupiter.api.Assertions.assertTimeout) SeparableMinos(searcher.pack.SeparableMinos) SizedBit(searcher.pack.SizedBit) ColumnField(core.column_field.ColumnField) Test(org.junit.jupiter.api.Test)

Aggregations

ColumnField (core.column_field.ColumnField)33 SeparableMinos (searcher.pack.SeparableMinos)33 SizedBit (searcher.pack.SizedBit)21 Test (org.junit.jupiter.api.Test)18 MinoFactory (core.mino.MinoFactory)13 MinoShifter (core.mino.MinoShifter)13 Field (core.field.Field)12 Predicate (java.util.function.Predicate)12 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)12 RecursiveMinoFields (searcher.pack.mino_fields.RecursiveMinoFields)12 Stream (java.util.stream.Stream)10 SeparableMino (searcher.pack.separable_mino.SeparableMino)10 OnDemandBasicSolutions (searcher.pack.solutions.OnDemandBasicSolutions)10 InOutPairField (searcher.pack.InOutPairField)9 BasicSolutions (searcher.pack.calculator.BasicSolutions)9 SolutionFilter (searcher.pack.memento.SolutionFilter)9 Piece (core.mino.Piece)7 Result (searcher.pack.task.Result)7 TaskResultHelper (searcher.pack.task.TaskResultHelper)7 LockedReachableThreadLocal (concurrent.LockedReachableThreadLocal)6