Class Expression

All Implemented Interfaces:
Comparable<Expression>, Optimisation, Optimisation.Constraint, Optimisation.Objective

public final class Expression extends ModelEntity<Expression>

Think of an Expression as one constraint or a component to the objective function. An expression becomes a linear expression as soon as you set a linear factor. Setting a quadratic factor turns it into a quadratic expression. If you set both linear and quadratic factors it is a compound expression, and if you set neither it is an empty expression. Currently the solvers supplied by ojAlgo can only handle linear constraint expressions. The objective function can be linear, quadratic or compound. Empty expressions makes no sense...

An expression is turned into a constraint by setting a lower and/or upper limit. Use ModelEntity.lower(Comparable), ModelEntity.upper(Comparable) or ModelEntity.level(Comparable). An expression is made part of (contributing to) the objective function by setting a contribution weight. Use ModelEntity.weight(Comparable). The contribution weight can be set to anything except zero (0.0). Often you may just want to set it to one (1.0). Other values can be used to balance multiple expressions contributing to the objective function.