2using MetaheuristicsPlatform.Constraints;
3using MetaheuristicsPlatform.Core;
4using MetaheuristicsPlatform.SearchSpaces.Continuous;
9 IContinuousConstrainedOptimizationProblem
20 double equalityTolerance = 1.0e-6)
22 ArgumentNullException.ThrowIfNull(
25 ArgumentNullException.ThrowIfNull(
30 equalityTolerance < 0.0)
32 throw new ArgumentOutOfRangeException(
33 nameof(equalityTolerance));
48 if (_encoding.ModelDimension !=
51 throw new InvalidOperationException(
52 "Metaheuristic encoding and mathematical model dimensions differ.");
59 constraint.IsEnabled &&
72 constraint.IsEnabled &&
85 _encoding.SearchSpace;
87 public OptimizationSense
Sense =>
88 _model.Objective.Sense
switch
91 OptimizationSense.Minimize,
94 OptimizationSense.Maximize,
97 throw new NotSupportedException(
98 $
"Objective sense '{_model.Objective.Sense}' is not supported by the MetaheuristicsPlatform bridge.")
102 _inequalities.Length;
113 ReadOnlySpan<double> solution)
119 return _evaluator.EvaluateObjective(
124 ReadOnlySpan<double> solution,
125 Span<double> inequalities,
126 Span<double> equalities)
128 if (inequalities.Length !=
133 throw new ArgumentException(
134 "Constraint output dimensions do not match the mathematical model.");
142 index < _inequalities.Length;
145 inequalities[index] =
146 _evaluator.EvaluateCanonicalConstraintResidual(
147 _inequalities[index],
152 index < _equalities.Length;
156 _evaluator.EvaluateCanonicalConstraintResidual(
163 ReadOnlySpan<double> solution)
165 return _encoding.Decode(
170 ReadOnlySpan<double> solution)
176 return _evaluator.IsFeasible(
Represents one linear constraint in a mathematical optimization model.
Represents a solver-independent mathematical optimization model.
void EnsureValid()
Validates the complete mathematical model.
@ Maximize
The objective value must be maximized.
@ Minimize
The objective value must be minimized.
MathematicalConstraintSense
Identifies the relational sense of a mathematical constraint.