LotSizingDataModel.Solver 2.0.1
Solver-independent modeling, execution, monitoring and adapter infrastructure.
Loading...
Searching...
No Matches
PlspSingleSetupStateConstraintFamilyBuilder.cs
Go to the documentation of this file.
1using LotSizingDataModel.Instance;
5
7
8/// <summary>
9/// PLSP end-of-bucket state: exactly one setup state is carried from every
10/// bucket into the next one.
11/// </summary>
14{
15 public override string ConstraintFamilyId =>
16 "plspSingleSetupState";
17
18 protected override ValueTask BuildConstraintsAsync(
19 LotSizingInstance instance,
22 CancellationToken cancellationToken)
23 {
24 for (
25 int period = 1;
26 period <= instance.PlanningHorizon;
27 period++)
28 {
29 var expression =
31
32 foreach (
33 var routing
34 in instance.SupplyChain.ProductionRoutings)
35 {
36 string key =
39 .Add(
41 routing.Id)
42 .Add(
44 period)
45 .Build();
46
47 expression.Add(
49 context,
50 key));
51 }
52
54 context,
55 $"plspSingleSetupState_t{period}",
56 expression.Build(),
58 1.0,
59 description:
60 "Exactly one PLSP setup state is carried out of each bucket.");
61 }
62
63 return ValueTask.CompletedTask;
64 }
65}
Provides a fluent builder for linear expressions.
Builds stable business-domain keys for mathematical variables and constraints.
MathematicalDomainKeyBuilder Add(string name, string value)
Adds a text segment.
Provides the shared state required while constructing a solver-independent mathematical model.
MathematicalModel Build(bool clone=true)
Builds and validates the mathematical model.
PLSP end-of-bucket state: exactly one setup state is carried from every bucket into the next one.
override ValueTask BuildConstraintsAsync(LotSizingInstance instance, MathematicalModelBuildContext context, StandardLotSizingFormulationOptions options, CancellationToken cancellationToken)
Provides common validation and helper methods for one constraint family of the standard lot-sizing fo...
static MathematicalVariable GetVariable(MathematicalModelBuildContext context, string domainKey)
Resolves a required variable from its canonical domain key.
static void AddConstraint(MathematicalModelBuildContext context, string name, LinearExpression expression, MathematicalConstraintSense sense, double rightHandSide, string domainKey="", string description="")
Adds one linear constraint to the mathematical model.
Configures the standard solver-independent mixed-integer lot-sizing formulation.
Provides the canonical mathematical domain-key categories used to identify lot-sizing decision famili...
const string Setup
Identifies production setup decision variables.
Provides the canonical mathematical domain-key segment names used by lot-sizing variables and constra...
MathematicalConstraintSense
Identifies the relational sense of a mathematical constraint.