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 concretePlanningScoretype.ModelInput_- The type of the model input part of theModelRequest.ModelConfigurationOverrides_- The type of the model configuration overrides optionally specified in theModelRequest.SolverModel_- The type of thePlanningSolutionclass to be used by Timefold solver.ModelOutput_- The type of the model output part of theModelResponse.
- 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
ModelInputand theModelConfig(usually obtained from theModelRequest) into theSolverModelusable by the Timefold Solver. - The
SolverModelrepresenting a planning solution into theModelOutput(usually forming a part of theModelResponse).
-
Method Summary
Modifier and TypeMethodDescriptionapplyOutputToInput(ModelInput_ modelInput, ModelOutput_ modelOutput) Applies changes from the givenModelOutput_to the givenModelInput_.toModelOutput(SolverModel_ solverModel) toSolverModel(ModelInput_ modelInput, ModelConfig<ModelConfigurationOverrides_> modelConfig, Optional<ModelOutput_> lastModelOutput) Converts the givenModelInput_andModelConfiginto aSolverModel_instance usable by the Timefold solver.
-
Method Details
-
toSolverModel
SolverModel_ toSolverModel(ModelInput_ modelInput, ModelConfig<ModelConfigurationOverrides_> modelConfig, Optional<ModelOutput_> lastModelOutput) Converts the givenModelInput_andModelConfiginto aSolverModel_instance usable by the Timefold solver.Optionally, the
lastModelOutputparameter can be provided to recover from a previous failure and restart the solving process. In such cases,lastModelOutputrepresents 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 convertedmodelConfig- the model configuration, including any overrides to be appliedlastModelOutput- anOptionalcontaining 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
-
applyOutputToInput
Applies changes from the givenModelOutput_to the givenModelInput_.This method modifies the provided
ModelInput_to create an updatedModelInput_that reflects changes introduced by solving represented in theModelOutput_.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_.
-