Example usage for org.apache.commons.math3.optim.linear LinearConstraint getValue

List of usage examples for org.apache.commons.math3.optim.linear LinearConstraint getValue

Introduction

In this page you can find the example usage for org.apache.commons.math3.optim.linear LinearConstraint getValue.

Prototype

public double getValue() 

Source Link

Document

Gets the value of the constraint (right hand side).

Usage

From source file:org.lightjason.agentspeak.action.builtin.TestCActionMathLinearprogram.java

/**
 * test equation constraint/*from   ww  w. j a va 2  s.c  o  m*/
 */
@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());
}