LotSizingDataModel.Core 2.0.1
Core domain model, shared abstractions and XML-serializable entities.
Loading...
Searching...
No Matches
OptimizationObjectiveCriterion.cs
Go to the documentation of this file.
1using System;
2using System.Xml.Serialization;
4
6
7/// <summary>
8/// Declares one business optimization criterion in an objective policy.
9/// </summary>
10[Serializable]
11[XmlType(TypeName = "optimizationObjectiveCriterion")]
12public sealed class OptimizationObjectiveCriterion :
14{
15 private OptimizationObjectiveKind _kind =
17
18 private bool _isEnabled = true;
19 private double _weight = 1.0;
20 private int _priority;
21
22 [XmlAttribute("kind")]
24 {
25 get => _kind;
26 set => SetProperty(ref _kind, value);
27 }
28
29 [XmlAttribute("enabled")]
30 public bool IsEnabled
31 {
32 get => _isEnabled;
33 set => SetProperty(ref _isEnabled, value);
34 }
35
36 [XmlAttribute("weight")]
37 public double Weight
38 {
39 get => _weight;
40 set
41 {
42 if (
43 !double.IsFinite(value) ||
44 value < 0.0)
45 {
46 throw new ArgumentOutOfRangeException(
47 nameof(value),
48 value,
49 "An objective weight must be finite and non-negative.");
50 }
51
52 SetProperty(
53 ref _weight,
54 value);
55 }
56 }
57
58 [XmlAttribute("priority")]
59 public int Priority
60 {
61 get => _priority;
62 set
63 {
64 if (value < 0)
65 {
66 throw new ArgumentOutOfRangeException(
67 nameof(value),
68 value,
69 "An objective priority cannot be negative.");
70 }
71
72 SetProperty(
73 ref _priority,
74 value);
75 }
76 }
77}
Base class for model objects that notify listeners when one of their properties changes.
Declares one business optimization criterion in an objective policy.
OptimizationObjectiveKind
Business-level optimization criterion family.