2using System.Collections.Generic;
39 double recommendedScoreThreshold =
41 .DefaultRecommendedScoreThreshold,
42 bool includeIncompatibleMethods =
true)
44 ArgumentNullException.ThrowIfNull(instance);
53 recommendedScoreThreshold,
54 includeIncompatibleMethods);
82 double recommendedScoreThreshold =
84 .DefaultRecommendedScoreThreshold,
85 bool includeIncompatibleMethods =
true)
87 ArgumentNullException.ThrowIfNull(instance);
88 ArgumentNullException.ThrowIfNull(catalog);
90 ValidateRecommendedScoreThreshold(
91 recommendedScoreThreshold);
95 string supplyChainFingerprint =
100 IReadOnlyList<SolutionMethodRecommendation>
105 recommendedScoreThreshold,
106 includeIncompatibleMethods);
116 supplyChainFingerprint:
117 supplyChainFingerprint,
118 recommendedScoreThreshold:
119 recommendedScoreThreshold);
121 report.ReplaceRecommendations(
124 report.EnsureValid();
150 double recommendedScoreThreshold =
152 .DefaultRecommendedScoreThreshold,
153 bool includeIncompatibleMethods =
true)
155 ArgumentNullException.ThrowIfNull(instance);
160 recommendedScoreThreshold,
161 includeIncompatibleMethods);
195 double recommendedScoreThreshold =
197 .DefaultRecommendedScoreThreshold,
198 bool includeIncompatibleMethods =
true)
200 ArgumentNullException.ThrowIfNull(instance);
201 ArgumentNullException.ThrowIfNull(catalog);
207 recommendedScoreThreshold,
208 includeIncompatibleMethods);
231 ArgumentNullException.ThrowIfNull(instance);
232 ArgumentNullException.ThrowIfNull(report);
236 string currentFingerprint =
244 throw new InvalidOperationException(
245 "The solution-method recommendation report " +
246 "does not match the current supply-chain " +
271 ArgumentNullException.ThrowIfNull(instance);
278 string currentFingerprint =
310 double recommendedScoreThreshold =
312 .DefaultRecommendedScoreThreshold,
313 bool includeIncompatibleMethods =
true)
315 ArgumentNullException.ThrowIfNull(instance);
317 ValidateRecommendedScoreThreshold(
318 recommendedScoreThreshold);
323 bool reportIsCurrent =
327 recommendedScoreThreshold) &&
331 StringComparison.Ordinal) &&
336 StringComparison.Ordinal) &&
341 StringComparison.Ordinal);
350 recommendedScoreThreshold,
351 includeIncompatibleMethods);
370 ArgumentNullException.ThrowIfNull(instance);
384 private static bool NearlyEqual(
388 return Math.Abs(left - right) <= 1e-12;
391 private static void ValidateRecommendedScoreThreshold(
392 double recommendedScoreThreshold)
394 if (!
double.IsFinite(recommendedScoreThreshold) ||
395 recommendedScoreThreshold < 0.0 ||
396 recommendedScoreThreshold > 1.0)
398 throw new ArgumentOutOfRangeException(
399 nameof(recommendedScoreThreshold),
400 recommendedScoreThreshold,
401 "The recommended-score threshold must be " +
402 "finite and lie between zero and one.");
Creates lot-sizing problem instances and initializes their automatically derived metadata.
static string ComputeSupplyChainFingerprint(SupplyChain supplyChain)
Calculates a SHA-256 fingerprint of a supply-chain object using its compact XML serialization.
Creates, applies and refreshes solution-method recommendation reports for lot-sizing instances.
static SolutionMethodRecommendationReport CreateStandardReport(LotSizingInstance instance, double recommendedScoreThreshold=SolutionMethodAdvisor .DefaultRecommendedScoreThreshold, bool includeIncompatibleMethods=true)
Creates a recommendation report using the standard solution-method catalog.
static SolutionMethodRecommendationReport CreateReport(LotSizingInstance instance, SolutionMethodCatalog catalog, double recommendedScoreThreshold=SolutionMethodAdvisor .DefaultRecommendedScoreThreshold, bool includeIncompatibleMethods=true)
Creates a recommendation report using a supplied solution-method catalog.
static SolutionMethodRecommendationReport CreateAndApplyStandardReport(LotSizingInstance instance, double recommendedScoreThreshold=SolutionMethodAdvisor .DefaultRecommendedScoreThreshold, bool includeIncompatibleMethods=true)
Creates a report from the standard catalog and stores it in the instance.
static SolutionMethodRecommendationReport CreateAndApplyReport(LotSizingInstance instance, SolutionMethodCatalog catalog, double recommendedScoreThreshold=SolutionMethodAdvisor .DefaultRecommendedScoreThreshold, bool includeIncompatibleMethods=true)
Creates a report from a supplied catalog and stores it in the instance.
static bool RefreshStandardReportIfRequired(LotSizingInstance instance, double recommendedScoreThreshold=SolutionMethodAdvisor .DefaultRecommendedScoreThreshold, bool includeIncompatibleMethods=true)
Regenerates the standard report when it is absent, outdated or based on another advisor or catalog ve...
static void ApplyReport(LotSizingInstance instance, SolutionMethodRecommendationReport report)
Stores an existing recommendation report in an instance after checking its fingerprint.
static bool HasCurrentReport(LotSizingInstance instance)
Determines whether the report stored in an instance is current for its supply-chain data.
static bool ClearOutdatedReport(LotSizingInstance instance)
Clears a stored report when it does not match the current supply-chain fingerprint.
Adds explicit closed-loop return streams to a lot-sizing instance without changing the historical Sup...
SolutionMethodRecommendationReport SolutionMethodRecommendationReport
Gets or sets the solution-method recommendation report generated for this problem instance.
void ClearSolutionMethodRecommendationReport()
Clears the complete solution-method recommendation report.
bool HasSolutionMethodRecommendationReport
Gets a value indicating whether a recommendation report has been generated or contains recommendation...
void Touch()
Updates the last-modification date of the instance.
bool SolutionMethodRecommendationsMatchFingerprint(string currentSupplyChainFingerprint)
Determines whether the recommendation report was generated for the supplied supply-chain fingerprint.
void ReplaceSolutionMethodRecommendationReport(SolutionMethodRecommendationReport report)
Replaces the complete solution-method recommendation report.
SupplyChain SupplyChain
Gets or sets the supply-chain model represented by the instance.
Evaluates and ranks solution methods for lot-sizing problem instances.
static IReadOnlyList< SolutionMethodRecommendation > Recommend(LotSizingInstance instance, SolutionMethodCatalog catalog, double recommendedScoreThreshold=DefaultRecommendedScoreThreshold, bool includeIncompatibleMethods=true)
Evaluates and ranks every usable method contained in a solution-method catalog.
const string CurrentVersion
Gets the current version of the solution-method advisor evaluation semantics.
Creates predefined catalogs of solution methods for lot-sizing problem instances.
const string StandardCatalogVersion
Gets the current version of the standard solution-method catalog.
const string StandardCatalogName
Gets the name of the standard solution-method catalog.
static SolutionMethodCatalog CreateStandardCatalog()
Creates the standard catalog of lot-sizing solution methods.
Represents an extensible catalog of solution methods that may be evaluated for lot-sizing problem ins...
void EnsureValid()
Validates the catalog and throws an exception when at least one error is found.
string CatalogVersion
Gets or sets the version of the catalog contents and compatibility semantics.
string CatalogName
Gets or sets the human-readable name of the catalog.
Stores the solution-method recommendations generated for one lot-sizing problem instance.
void EnsureValid()
Validates the report and throws an exception when at least one error is found.
double RecommendedScoreThreshold
Gets or sets the score threshold used to mark a directly compatible method as recommended.
string CatalogName
Gets or sets the name of the solution-method catalog used during evaluation.
string AdvisorVersion
Gets or sets the version of the advisor used to produce the recommendations.
bool MatchesSupplyChainFingerprint(string currentFingerprint)
Determines whether the report was generated for the supplied supply-chain fingerprint.
string CatalogVersion
Gets or sets the version of the solution-method catalog used during evaluation.