Interface ModelConvertor<Score_ extends ai.timefold.solver.core.api.score.Score<Score_>, ModelInput_ extends ModelInput, ModelConfigurationOverrides_ extends ModelConfigOverrides, SolverModel_ extends SolverModel<Score_>, ModelOutput_ extends ModelOutput>

Type Parameters:
Score_ - The solver model concrete PlanningScore type.
ModelInput_ - The type of the model input part of the ModelRequest.
ModelConfigurationOverrides_ - The type of the model configuration overrides optionally specified in the ModelRequest.
SolverModel_ - The type of the PlanningSolution class to be used by Timefold solver.
ModelOutput_ - The type of the model output part of the ModelResponse.
All Superinterfaces:
ModelConvertorBase

public non-sealed interface ModelConvertor<Score_ extends ai.timefold.solver.core.api.score.Score<Score_>, ModelInput_ extends ModelInput, ModelConfigurationOverrides_ extends ModelConfigOverrides, SolverModel_ extends SolverModel<Score_>, ModelOutput_ extends ModelOutput> extends ModelConvertorBase
The convertor of:
  • The ModelInput and the ModelConfig (usually obtained from the ModelRequest) into the SolverModel usable by the Timefold Solver.
  • The SolverModel representing a planning solution into the ModelOutput (usually forming a part of the ModelResponse).
  • Method Details

    • toSolverModel

      SolverModel_ toSolverModel(ModelInput_ modelInput, ModelConfig<ModelConfigurationOverrides_> modelConfig, Optional<ModelOutput_> lastModelOutput)
      Converts the given ModelInput_ and ModelConfig into a SolverModel_ instance usable by the Timefold solver.

      Optionally, the lastModelOutput parameter can be provided to recover from a previous failure and restart the solving process. In such cases, lastModelOutput represents the last stored output before the failure, allowing the method to restore or reuse relevant state as needed.

      Parameters:
      modelInput - the model input part of the request, containing the data to be converted
      modelConfig - the model configuration, including any overrides to be applied
      lastModelOutput - an Optional containing the last stored model output before a failure, or empty if not recovering
      Returns:
      the solver model instance to be used by the Timefold solver
    • toModelOutput

      ModelOutput_ toModelOutput(SolverModel_ solverModel)
    • applyOutputToInput

      ModelInput_ applyOutputToInput(ModelInput_ modelInput, ModelOutput_ modelOutput)
      Applies changes from the given ModelOutput_ to the given ModelInput_.

      This method modifies the provided ModelInput_ to create an updated ModelInput_ that reflects changes introduced by solving represented in the ModelOutput_.

      The updated ModelInput_ can be used as a basis for new datasets by applying external changes.

      Parameters:
      modelInput - The model input to be updated.
      modelOutput - The model output containing changes to be applied to the model input.
      Returns:
      Reference to the updated ModelInput_.