-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support assigned values for Recommendations as well (#1136)
- Loading branch information
Showing
22 changed files
with
1,575 additions
and
261 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
core/src/main/java/ai/timefold/solver/core/api/solver/RecommendedAssignment.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package ai.timefold.solver.core.api.solver; | ||
|
||
import java.util.function.Function; | ||
|
||
import ai.timefold.solver.core.api.score.Score; | ||
import ai.timefold.solver.core.api.score.analysis.ConstraintAnalysis; | ||
import ai.timefold.solver.core.api.score.analysis.MatchAnalysis; | ||
import ai.timefold.solver.core.api.score.analysis.ScoreAnalysis; | ||
|
||
/** | ||
* Represents the result of the Assignment Recommendation API, | ||
* see {@link SolutionManager#recommendFit(Object, Object, Function)}. | ||
* | ||
* <p> | ||
* In order to be fully serializable to JSON, propositions must be fully serializable to JSON. | ||
* For deserialization from JSON, the user needs to provide the deserializer themselves. | ||
* This is due to the fact that, once the proposition is received over the wire, | ||
* we no longer know which type was used. | ||
* The user has all of that information in their domain model, | ||
* and so they are the correct party to provide the deserializer. | ||
* See also {@link ScoreAnalysis} Javadoc for additional notes on serializing and deserializing that type. | ||
* | ||
* @param <Proposition_> the generic type of the proposition as returned by the proposition function | ||
* @param <Score_> the generic type of the score | ||
*/ | ||
public interface RecommendedAssignment<Proposition_, Score_ extends Score<Score_>> { | ||
|
||
/** | ||
* Returns the proposition as returned by the proposition function. | ||
* This is the actual assignment recommended to the user. | ||
* | ||
* @return null if proposition function required null | ||
*/ | ||
Proposition_ proposition(); | ||
|
||
/** | ||
* Difference between the original score and the score of the solution with the recommendation applied. | ||
* | ||
* <p> | ||
* If {@link SolutionManager#recommendAssignment(Object, Object, Function, ScoreAnalysisFetchPolicy)} was called with | ||
* {@link ScoreAnalysisFetchPolicy#FETCH_ALL}, | ||
* the analysis will include {@link MatchAnalysis constraint matches} | ||
* inside its {@link ConstraintAnalysis constraint analysis}; | ||
* otherwise it will not. | ||
* | ||
* @return never null; {@code fittedScoreAnalysis - originalScoreAnalysis} as defined by | ||
* {@link ScoreAnalysis#diff(ScoreAnalysis)} | ||
*/ | ||
ScoreAnalysis<Score_> scoreAnalysisDiff(); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.