Interface ConstraintVerifier<ConstraintProvider_ extends org.optaplanner.core.api.score.stream.ConstraintProvider,Solution_>

Type Parameters:
ConstraintProvider_ -
Solution_ -
All Known Implementing Classes:
DefaultConstraintVerifier

public interface ConstraintVerifier<ConstraintProvider_ extends org.optaplanner.core.api.score.stream.ConstraintProvider,Solution_>
Implementations must be thread-safe, in order to enable parallel test execution.
  • Method Details

    • build

      static <ConstraintProvider_ extends org.optaplanner.core.api.score.stream.ConstraintProvider, Solution_> ConstraintVerifier<ConstraintProvider_,Solution_> build(ConstraintProvider_ constraintProvider, Class<Solution_> planningSolutionClass, Class<?>... entityClasses)
      Entry point to the API.
      Type Parameters:
      ConstraintProvider_ - type of the ConstraintProvider
      Solution_ - type of the PlanningSolution-annotated class
      Parameters:
      constraintProvider - never null, PlanningEntity used by the PlanningSolution
      planningSolutionClass - never null, PlanningSolution-annotated class associated with the constraints
      entityClasses - never null, at least one, PlanningEntity types used by the PlanningSolution
      Returns:
      never null
    • create

      static <ConstraintProvider_ extends org.optaplanner.core.api.score.stream.ConstraintProvider, Solution_> ConstraintVerifier<ConstraintProvider_,Solution_> create(org.optaplanner.core.config.solver.SolverConfig solverConfig)
      Uses a SolverConfig to build a ConstraintVerifier. Alternative to build(ConstraintProvider, Class, Class[]).
      Type Parameters:
      ConstraintProvider_ - type of the ConstraintProvider
      Solution_ - type of the PlanningSolution-annotated class
      Parameters:
      solverConfig - never null, must have a PlanningSolution class, PlanningEntity classes and a ConstraintProvider configured.
      Returns:
      never null
    • withConstraintStreamImplType

      ConstraintVerifier<ConstraintProvider_,Solution_> withConstraintStreamImplType(org.optaplanner.core.api.score.stream.ConstraintStreamImplType constraintStreamImplType)
      All subsequent calls to verifyThat(BiFunction) and verifyThat() use the given ConstraintStreamImplType.
      Parameters:
      constraintStreamImplType - never null
      Returns:
      this
    • withDroolsAlphaNetworkCompilationEnabled

      ConstraintVerifier<ConstraintProvider_,Solution_> withDroolsAlphaNetworkCompilationEnabled(boolean droolsAlphaNetworkCompilationEnabled)
      Applies only to ConstraintStreamImplType.DROOLS. Do not enable when running in a native image.
      Parameters:
      droolsAlphaNetworkCompilationEnabled - true to enable the alpha network compiler
      Returns:
      this
    • verifyThat

      SingleConstraintVerification<Solution_> verifyThat(BiFunction<ConstraintProvider_,org.optaplanner.core.api.score.stream.ConstraintFactory,org.optaplanner.core.api.score.stream.Constraint> constraintFunction)
      Creates a constraint verifier for a given Constraint of the ConstraintProvider.
      Parameters:
      constraintFunction - never null
      Returns:
      never null
    • verifyThat

      Creates a constraint verifier for all constraints of the ConstraintProvider.
      Returns:
      never null