LinearConstraint

data class LinearConstraint(val equation: Map<String, Double>, var rhsValue: Double = 0.0, val inequalityType: InequalityType = InequalityType.LESS_THAN) : ConstraintIfc

Represents a linear-constraint for a ProblemDefinition.

Parameters

equation

the variable name and the coefficient in the equation. The names of the input variables must not be blank.

rhsValue

the right-hand side value of the constraint. The default is 0.0.

inequalityType

the type of inequality, less-than or greater-than. The default is InequalityType.LESS_THAN

Constructors

Link copied to clipboard
constructor(equation: Map<String, Double>, rhsValue: Double = 0.0, inequalityType: InequalityType = InequalityType.LESS_THAN)

Properties

Link copied to clipboard

The coefficients associated with each input variable name within the equation. These are adjusted for the direction of the inequality to ensure an A*x < b orientation.

Link copied to clipboard

The coefficients associated with each input variable name within the equation. These are not adjusted for the direction of the inequality.

Link copied to clipboard
Link copied to clipboard

Used to turn greater than inequalities to less than inequalities

Link copied to clipboard
open override val inequalityType: InequalityType
Link copied to clipboard
open val ltRHSValue: Double

The right-hand side of the constraint adjusted for the direction of the inequality to ensure a less-than constraint

Link copied to clipboard

The input variable names that are in the equation ordered based on appearance in the equation.

Link copied to clipboard
open override var rhsValue: Double

Functions

Link copied to clipboard
Link copied to clipboard
fun coefficients(inputNames: List<String>): DoubleArray

Returns the coefficients associated with the left-hand side of the constraint based on the supplied input names. The coefficients are not adjusted for the direction of the inequality.

Link copied to clipboard

Computes the value of the left-hand side of the constraint based on the supplied values for each input variable in the equation. Assumes that the values are ordered in the same order as the input names. The returned value has been adjusted to ensure a less-than constraint orientation.

open override fun computeLHS(values: Map<String, Double>): Double

Computes the value of the left-hand side of the constraint based on the supplied values for each input variable in the equation. The returned value has been adjusted to ensure a less-than constraint orientation.

Link copied to clipboard

Computes the value of the left-hand side of the constraint based on the supplied values for each input variable in the equation and checks if the constraint is satisfied.

open override fun isSatisfied(values: Map<String, Double>): Boolean

Computes the value of the left-hand side of the constraint based on the supplied inputs for each input variable in the equation and checks if the constraint is satisfied.

Link copied to clipboard
open fun slack(inputs: Map<String, Double>): Double

The slack associated with the constraint based on the provided inputs. This is the difference between the right-hand side value and the left-hand side value.

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard
open fun violation(inputs: Map<String, Double>): Double