List of usage examples for org.apache.commons.math.optimization.linear LinearObjectiveFunction getCoefficients
public RealVector getCoefficients()
From source file:com.polytech4A.cuttingstock.core.method.LinearResolutionMetodTest.java
@Test public void testUpdateFunction() throws NoSuchFieldException, IllegalAccessException { LinearResolutionMethod method = new LinearResolutionMethod(context); method.updateFunction(solution);// www . j av a 2 s . c om // To avoid set attributes in public, we get the field function. Field field = method.getClass().getDeclaredField("function"); field.setAccessible(true); LinearObjectiveFunction f = (LinearObjectiveFunction) field.get(method); // Test of the function // Coefficients value = sheet cost for (double d : f.getCoefficients().getData()) { assertEquals((double) context.getSheetCost(), d); } // Number of coefficients has to equal the number of patterns of the solution. assertEquals(solution.getPatterns().size(), f.getCoefficients().getDimension()); }