List of usage examples for org.apache.commons.math3.optim.linear LinearConstraint getCoefficients
public RealVector getCoefficients()
From source file:org.lightjason.agentspeak.action.builtin.TestCActionMathLinearprogram.java
/** * test equation constraint//from w w w. java 2 s.c om */ @Test public final void equationconstraint() { final LinearConstraint l_result = new LinearConstraint(new double[] { 2, 7, 12 }, 19.0, Relationship.EQ, new double[] { 1, 2, 3 }, 5.0); new CEquationConstraint().execute(false, IContext.EMPTYPLAN, Stream.of(m_linearprogram, 2, 7, 12, 19.0, "=", 1, 2, 3, 5.0).map(CRawTerm::from) .collect(Collectors.toList()), Collections.emptyList()); Assert.assertEquals(m_linearprogram.getRight().size(), 1); Assert.assertArrayEquals( Stream.of(l_result.getValue(), l_result.getRelationship(), l_result.getCoefficients()).toArray(), Stream.of(m_linearprogram.getRight().iterator().next().getValue(), m_linearprogram.getRight().iterator().next().getRelationship(), m_linearprogram.getRight().iterator().next().getCoefficients()).toArray()); }