LotSizingDataModel.Solver 2.0.1
Solver-independent modeling, execution, monitoring and adapter infrastructure.
Loading...
Searching...
No Matches
GlspSchedulingFormulation.cs
Go to the documentation of this file.
1using LotSizingDataModel.Instance;
3
5
7{
8 public const string FormulationIdValue = "macro-micro-glsp";
9
10 private readonly IStandardLotSizingVariableBuilder _variableBuilder;
11 private readonly IStandardLotSizingObjectiveBuilder _objectiveBuilder;
12 private readonly IStandardLotSizingConstraintBuilder _constraintBuilder;
13 private readonly StandardLotSizingFormulationOptions _options;
14 private readonly GlspSchedulingApplicabilityService _applicability;
15
22 {
23 _variableBuilder = variableBuilder ?? throw new ArgumentNullException(nameof(variableBuilder));
24 _objectiveBuilder = objectiveBuilder ?? throw new ArgumentNullException(nameof(objectiveBuilder));
25 _constraintBuilder = constraintBuilder ?? throw new ArgumentNullException(nameof(constraintBuilder));
26 _options = options?.Clone() ?? throw new ArgumentNullException(nameof(options));
27 _applicability = applicability ?? throw new ArgumentNullException(nameof(applicability));
28 _options.EnsureValid();
29 }
30
31 public override string FormulationId => FormulationIdValue;
32 public override string Name => "GLSP macro/micro MILP formulation";
33 public override string Description =>
34 "Solver-independent single-resource GLSP with variable-length micro-periods, exact setup states and sequence-dependent changeovers.";
35 public override bool CanBuild(LotSizingInstance instance) => _applicability.CanBuild(instance);
36
37 protected override string CreateModelName(LotSizingInstance instance) =>
38 string.IsNullOrWhiteSpace(instance.Name) ? FormulationId : $"{instance.Name.Trim()} - {FormulationId}";
39
40 protected override ValueTask BuildVariablesAsync(
41 LotSizingInstance instance,
43 CancellationToken cancellationToken) =>
44 _variableBuilder.BuildAsync(instance, context, _options, cancellationToken);
45
46 protected override ValueTask BuildObjectiveAsync(
47 LotSizingInstance instance,
49 CancellationToken cancellationToken) =>
50 _objectiveBuilder.BuildAsync(instance, context, _options, cancellationToken);
51
52 protected override ValueTask BuildConstraintsAsync(
53 LotSizingInstance instance,
55 CancellationToken cancellationToken) =>
56 _constraintBuilder.BuildAsync(instance, context, _options, cancellationToken);
57}
Provides the shared state required while constructing a solver-independent mathematical model.
GlspSchedulingFormulation(IStandardLotSizingVariableBuilder variableBuilder, IStandardLotSizingObjectiveBuilder objectiveBuilder, IStandardLotSizingConstraintBuilder constraintBuilder, StandardLotSizingFormulationOptions options, GlspSchedulingApplicabilityService applicability)
override string FormulationId
Gets the unique formulation identifier.
override string Description
Gets the formulation description.
override string CreateModelName(LotSizingInstance instance)
Creates the mathematical model name.
override ValueTask BuildObjectiveAsync(LotSizingInstance instance, MathematicalModelBuildContext context, CancellationToken cancellationToken)
override bool CanBuild(LotSizingInstance instance)
Determines whether the formulation supports a lot-sizing instance.
override ValueTask BuildVariablesAsync(LotSizingInstance instance, MathematicalModelBuildContext context, CancellationToken cancellationToken)
override ValueTask BuildConstraintsAsync(LotSizingInstance instance, MathematicalModelBuildContext context, CancellationToken cancellationToken)
override string Name
Gets the human-readable formulation name.
Provides a reusable base implementation for solver-independent lot-sizing formulations.
Configures the standard solver-independent mixed-integer lot-sizing formulation.
StandardLotSizingFormulationOptions Clone()
Creates an independent copy.
Defines the constraint-construction component used by the standard solver-independent lot-sizing form...
Defines the objective-construction component used by the standard solver-independent lot-sizing formu...
Defines the variable-construction component used by the standard solver-independent lot-sizing formul...