Ben McCann commented on MATH-246:
That constructor was made so that constraints such as x + 2y <= 3x + 4y could be expressed instead of just scalars on the right hand side (x + 2y <= 9). The user doesn't have to care about the implementation details which cause one side to be subtracted from the other, but only needs to know how to express their constraint. I actually would propose a different change to the constructor, which would be to change it to:
public LinearEquation(RealVector leftHandSide, double lhsConstantTerm, Relationship relationship, RealVector rightHandSide, double rhsConstantTerm)
That would make it more flexible and allow for constraints such as x + 2y + 7 <= 3x + 4y + 6 which I originally overlooked. You're correct that the user could do this him/herself, but it seems a common use case (one I will be using frequently to say the least), so I thought it wise to provide the extra convenience.
And perhaps adding some JavaDocs would clear up any potential confusion that I had not envisioned:
* @param leftHandSide The coefficients of the linear expression on the left hand side of the constraint
* @param lhsConstantTerm The constant term of the linear expression on the left hand side of the constraint
* @param relationship The type of (in)equality used in the constraint
* @param rightHandSide The coefficients of the linear expression on the right hand side of the constraint
* @param rhsConstantTerm The constant term of the linear expression on the right hand side of the constraint
> Simplex Method Implementation
> Key: MATH-246
> URL: https://issues.apache.org/jira/browse/MATH-246 > Project: Commons Math
> Issue Type: New Feature
> Reporter: Benjamin McCann
> Assignee: Luc Maisonobe
> Fix For: 2.0
> Attachments: newfiles.zip
> I've created an implementation of the Simplex algorithm for optimizing systems of constrained linear equations that I'd like to contribute.
This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.