Example usage for org.apache.commons.math.util FastMath ceil

List of usage examples for org.apache.commons.math.util FastMath ceil

Introduction

In this page you can find the example usage for org.apache.commons.math.util FastMath ceil.

Prototype

public static double ceil(double x) 

Source Link

Document

Get the smallest whole number larger than x.

Usage

From source file:com.polytech4A.cuttingstock.core.method.Result.java

public Result(double[] printings, int sheetCost, int patternCost) {
    int[] buf = new int[printings.length];
    this.cost = 0;
    for (int i = 0; i < printings.length; ++i) {
        buf[i] = (int) FastMath.ceil(printings[i]);
        this.cost += buf[i] * sheetCost;
    }//from w  w w .ja  v  a  2s  .c  om
    this.cost += patternCost * printings.length;
    this.printings = buf;
}

From source file:afest.datastructures.tree.decision.erts.grower.AERTGrower.java

/**
 * Return an extra tree created from the set of points.
 * @param <T> Type of ITrainingPoints used by the Extra Trees.
 * @param set set of points to create the tree from.
 * @return an extra tree created from the set of points.
 *///w  w  w .  j a v a 2s .c o m
public <T extends ITrainingPoint<R, O>> DecisionTree<R, C> growERT(Collection<T> set) {
    // get the attributes present in the points.
    T aElement = set.iterator().next();
    ArrayList<R> attributeList = new ArrayList<R>();
    for (R attribute : aElement.getAttributes()) {
        attributeList.add(attribute);
    }
    // set k to sqrt(number of attributes) if unset
    if (fK == null) {
        fK = (int) FastMath.ceil(FastMath.sqrt(attributeList.size()));
    }

    // Train the tree
    ArrayList<R> constantAttributes = new ArrayList<R>();
    DTNode<R, C> root = buildAnExtraTree(set, constantAttributes, attributeList);
    DecisionTree<R, C> tree = new DecisionTree<R, C>(root);
    return tree;
}

From source file:com.polytech4A.cuttingstock.core.method.LinearResolutionMetodTest.java

@Test
public void testMinimize() {
    LinearResolutionMethod method = new LinearResolutionMethod(context);
    Result result = method.minimize(solution);
    int[] printings = { 123, 443, 200 };
    for (int i = 0; i < printings.length; ++i) {
        assertEquals(printings[i], result.getPrintings()[i]);
    }/*from w w w  .  j  a va 2s  .  c  o m*/
    assertEquals(826, (int) FastMath.ceil(result.getCost()));
}