List of usage examples for java.lang Double POSITIVE_INFINITY
double POSITIVE_INFINITY
To view the source code for java.lang Double POSITIVE_INFINITY.
Click Source Link
From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.util.weights.RandomGenerator.java
/** * Returns the weights for problems of arbitrary dimension. * // w w w.j av a2s. c om * @return the weights */ private List<double[]> initializeWeightsND() { int N = 50; List<double[]> candidates = new ArrayList<double[]>(numberOfPoints * N); // create random weights for (int i = 0; i < numberOfPoints * N; i++) { double[] weight = new double[numberOfObjectives]; for (int j = 0; j < numberOfObjectives; j++) { weight[j] = PRNG.nextDouble(); } double sum = StatUtils.sum(weight); for (int j = 0; j < numberOfObjectives; j++) { weight[j] /= sum; } candidates.add(weight); } List<double[]> weights = new ArrayList<double[]>(numberOfPoints * N); // add boundary weights (1,0,...,0), (0,1,...,0), ..., (0,...,0,1) for (int i = 0; i < numberOfObjectives; i++) { double[] weight = new double[numberOfObjectives]; weight[i] = 1.0; weights.add(weight); } // fill in remaining weights with the weight vector with the largest // distance from the assigned weights while (weights.size() < numberOfPoints) { double[] weight = null; double distance = Double.NEGATIVE_INFINITY; for (int i = 0; i < candidates.size(); i++) { double d = Double.POSITIVE_INFINITY; for (int j = 0; j < weights.size(); j++) { d = Math.min(d, MathArrays.distance(candidates.get(i), weights.get(j))); } if (d > distance) { weight = candidates.get(i); distance = d; } } weights.add(weight); candidates.remove(weight); } return weights; }
From source file:com.comcast.cdn.traffic_control.traffic_router.core.loc.Geolocation.java
/** * Returns the great circle distance in kilometers between this {@link Geolocation} and the * specified location/*from w w w .ja v a2 s. c o m*/ * * @param other * @return the great circle distance in km */ public double getDistanceFrom(final Geolocation other) { if (other != null) { final double dLat = Math.toRadians(getLatitude() - other.getLatitude()); final double dLon = Math.toRadians(getLongitude() - other.getLongitude()); final double a = (Math.sin(dLat / 2) * Math.sin(dLat / 2)) + (Math.cos(Math.toRadians(getLatitude())) * Math.cos(Math.toRadians(other.getLatitude())) * Math.sin(dLon / 2) * Math.sin(dLon / 2)); final double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); return MEAN_EARTH_RADIUS * c; } else { return Double.POSITIVE_INFINITY; } }
From source file:gedi.util.math.stat.distributions.NormalMixtureDistribution.java
@Override public double getSupportUpperBound() { return Double.POSITIVE_INFINITY; }
From source file:com.rapidminer.operator.preprocessing.filter.InfiniteValueReplenishment.java
@Override public double getReplacedValue() { try {//from w w w .j ava 2 s .c om int chosen = getParameterAsInt(PARAMETER_REPLENISHMENT_WHAT); if (chosen == 0) { return Double.POSITIVE_INFINITY; } } catch (Exception e) { } return Double.NEGATIVE_INFINITY; }
From source file:edu.dfci.cccb.mev.deseq.domain.simple.FileBackedDESeq.java
private Double number(int index, String[] split) { String value = string(index, split); if ("Inf".equals(value)) return Double.POSITIVE_INFINITY; else if ("-Inf".equals(value)) return Double.NEGATIVE_INFINITY; else if ("NA".equals(value)) return Double.NaN; else/*from w w w .j a va 2 s . c o m*/ return parseDouble(value); }
From source file:gdsc.core.clustering.optics.OPTICSResult.java
private void convert(double[] data) { for (int i = data.length; i-- > 0;) if (data[i] == Double.POSITIVE_INFINITY) data[i] = generatingDistance; }
From source file:cl.smartcities.isci.transportinspector.backend.BusTest.java
@Test public void validBusJsonTest2() throws JSONException { JSONObject json = new JSONObject(); try {/*from w w w. j av a2 s .c om*/ json.put("valido", 1); json.put("servicio", SERVICE); json.put("patente", LICENSE_PLATE); json.put("tiempoV2", TIME); json.put("distanciaV2", DISTANCE); json.put("sentido", DIRECTION); json.put("tienePasajeros", PASSENGERS); json.put("color", COLOR); json.put("random", RANDOM); json.put("distanciaMts", DISTANCEV2); json.put("eventos", new JSONArray()); } catch (JSONException e) { e.printStackTrace(); } Bus bus = new Bus(json); assertThat(bus.getService(), is(SERVICE)); assertThat(bus.getLicensePlate(), is(LICENSE_PLATE)); assertThat(bus.getTime(), is(TIME)); assertThat(bus.getFormattedDistance(), is(DISTANCE)); assertThat(bus.getDirection(), is(DIRECTION)); assertThat(bus.getAmountOfReports(), is(0)); assertThat(bus.getPassengerNumber(), is(PASSENGERS)); assertThat(bus.getLatitude(), is(Double.POSITIVE_INFINITY)); assertThat(bus.getLongitude(), is(Double.POSITIVE_INFINITY)); }
From source file:beast.math.distributions.InverseGammaDistribution.java
/** * variance of the Gamma distribution./*from w w w .j a v a 2 s .c o m*/ * * @param shape shape parameter * @param scale scale parameter * @return variance */ public static double variance(double shape, double scale) { if (shape > 2) { return scale * scale / ((shape - 1) * (scale - 1) * (scale - 2)); } return Double.POSITIVE_INFINITY; }
From source file:org.jfree.data.statistics.DefaultMultiValueCategoryDataset.java
/** * Adds a list of values to the dataset (<code>null</code> and Double.NaN * items are automatically removed) and sends a {@link DatasetChangeEvent} * to all registered listeners./*from w ww . jav a 2 s. co m*/ * * @param values a list of values (<code>null</code> not permitted). * @param rowKey the row key (<code>null</code> not permitted). * @param columnKey the column key (<code>null</code> not permitted). */ public void add(List values, Comparable rowKey, Comparable columnKey) { ParamChecks.nullNotPermitted(values, "values"); ParamChecks.nullNotPermitted(rowKey, "rowKey"); ParamChecks.nullNotPermitted(columnKey, "columnKey"); List vlist = new ArrayList(values.size()); Iterator iterator = values.listIterator(); while (iterator.hasNext()) { Object obj = iterator.next(); if (obj instanceof Number) { Number n = (Number) obj; double v = n.doubleValue(); if (!Double.isNaN(v)) { vlist.add(n); } } } Collections.sort(vlist); this.data.addObject(vlist, rowKey, columnKey); if (vlist.size() > 0) { double maxval = Double.NEGATIVE_INFINITY; double minval = Double.POSITIVE_INFINITY; for (int i = 0; i < vlist.size(); i++) { Number n = (Number) vlist.get(i); double v = n.doubleValue(); minval = Math.min(minval, v); maxval = Math.max(maxval, v); } // update the cached range values... if (this.maximumRangeValue == null) { this.maximumRangeValue = new Double(maxval); } else if (maxval > this.maximumRangeValue.doubleValue()) { this.maximumRangeValue = new Double(maxval); } if (this.minimumRangeValue == null) { this.minimumRangeValue = new Double(minval); } else if (minval < this.minimumRangeValue.doubleValue()) { this.minimumRangeValue = new Double(minval); } this.rangeBounds = new Range(this.minimumRangeValue.doubleValue(), this.maximumRangeValue.doubleValue()); } fireDatasetChanged(); }
From source file:com.rapidminer.operator.preprocessing.weighting.EqualLabelWeighting.java
@Override public List<ParameterType> getParameterTypes() { List<ParameterType> types = super.getParameterTypes(); ParameterType type = new ParameterTypeDouble(PARAMETER_TOTAL_WEIGHT, "The total weight distributed over all examples.", Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 1); type.setExpert(false);/*from w ww . j a va 2 s . co m*/ types.add(type); return types; }