Example usage for java.lang Double MAX_VALUE

List of usage examples for java.lang Double MAX_VALUE

Introduction

In this page you can find the example usage for java.lang Double MAX_VALUE.

Prototype

double MAX_VALUE

To view the source code for java.lang Double MAX_VALUE.

Click Source Link

Document

A constant holding the largest positive finite value of type double , (2-2-52)·21023.

Usage

From source file:peakml.util.jfreechart.FastTimePlot.java

public void clear() {
    xmin = Double.MAX_VALUE;
    xmax = Double.MIN_VALUE;// www. ja  v  a2 s . co m
    ymin = Double.MAX_VALUE;
    ymax = Double.MIN_VALUE;
    dataseries.clear();

    this.fireChangeEvent();
}

From source file:edu.asu.ca.kaushik.algorithms.derandomized.pe.structures.ExtInteractionGraph.java

private Interaction findBestInteraction(int coverage) {
    double maxEstExpCoverage = -Double.MAX_VALUE;
    ColGroup bColGr = null;/*  w  ww  . ja  v  a 2 s .co  m*/
    SymTuple bSymTup = null;

    Iterator<ColGroup> colGrIt = this.iSet.keySet().iterator();
    while (colGrIt.hasNext()) {
        ColGroup colGr = colGrIt.next();

        Iterator<IFitness> iFitnessSetIt = this.iSet.get(colGr).iterator();
        if (iFitnessSetIt.hasNext()) {
            IFitness iFitness = iFitnessSetIt.next();
            this.updateOverlapCount(colGr, iFitness, coverage);
            double estExpCoverage = this.estimateExpCoverage(iFitness);
            if (estExpCoverage > maxEstExpCoverage) {
                maxEstExpCoverage = estExpCoverage;
                bColGr = colGr;
                bSymTup = iFitness.getSymTup();

            }
        }
    }

    return new Interaction(bColGr, bSymTup);
}

From source file:ai.grakn.graql.internal.analytics.GraknMapReduce.java

final Number maxValue() {
    return usingLong() ? Long.MAX_VALUE : Double.MAX_VALUE;
}

From source file:com.redhat.lightblue.metadata.types.IntegerTypeTest.java

@Test
public void testEqualsFalse() {
    assertFalse(integerType.equals(Double.MAX_VALUE));
}

From source file:es.udc.gii.common.eaf.plugin.parameter.jade.JADECRAdaptiveParameter.java

@Override
public double get(EvolutionaryAlgorithm algorithm) {

    double meana_cr;
    double cr_i;//from w  w  w  . j a  v a  2 s.  c  om
    List<Individual> individuals;
    int cr_individuals;
    double cr_ind;

    //Hay que "chequear" que los individuos sean del tipo JADE:

    if (algorithm.getGenerations() > this.alg_generation) {

        //Calculamos mu;
        individuals = algorithm.getPopulation().getIndividuals();

        meana_cr = 0.0;
        cr_individuals = 0;
        for (Individual i : individuals) {

            if (i instanceof JADEIndividual) {

                cr_ind = ((JADEIndividual) i).getCR();
                if (cr_ind != -Double.MAX_VALUE) {
                    meana_cr += cr_ind;
                    cr_individuals++;
                }
            } else {
                throw new ConfigurationException(
                        "JADECRAdaptiveParameter requires individuals of type JADEIndividual");
            }

        }

        meana_cr /= cr_individuals;

        if (!Double.isNaN(meana_cr) && !Double.isInfinite(meana_cr)) {
            this.mu_cr = (1.0 - this.c) * this.mu_cr + this.c * meana_cr;

            this.mu_cr = (this.mu_cr > 1.0 ? 1.0 : (this.mu_cr < 0.0 ? 0.0 : this.mu_cr));
        }
        this.alg_generation++;
        //System.out.println(this.mu_cr);

    }

    cr_i = 0.0;
    NormalDistributionImpl n = new NormalDistributionImpl(this.mu_cr, this.std_cr);
    try {
        double r = EAFRandom.nextDouble();
        cr_i = n.inverseCumulativeProbability(r);
        cr_i = (cr_i > 1.0 ? 1.0 : (cr_i < 0.0 ? 0.0 : cr_i));
    } catch (MathException ex) {
        Logger.getLogger(JADECRAdaptiveParameter.class.getName()).log(Level.SEVERE, null, ex);
    }

    return cr_i;
}

From source file:org.tsho.dmc2.ui.bifurcation.BifurcationControlForm2.java

public BifurcationControlForm2(final Model model, AbstractPlotComponent frame) {
    super(frame);
    setOpaque(true);/*from   w  w  w. ja  v  a2 s .co  m*/

    this.model = model;

    type = TYPE_DOUBLE;

    parFields = FormHelper.createFields(model.getParNames(), "parameter");
    varFields = FormHelper.createFields(model.getVarNames(), "initial value");

    box1 = new JComboBox(model.getParNames());
    box2 = new JComboBox(model.getParNames());
    MyListener myListener = new MyListener();
    box1.addItemListener(myListener);
    box2.addItemListener(myListener);

    transientsField = new GetInt("transients", FormHelper.FIELD_LENGTH, new Range(0, Integer.MAX_VALUE));

    iterationsField = new GetInt("iterations", FormHelper.FIELD_LENGTH, new Range(1, Integer.MAX_VALUE));

    periodField = new GetInt("maximal period", FormHelper.FIELD_LENGTH,
            new Range(0, DefaultDrawingSupplier.DEFAULT_PAINT_SEQUENCE.length));

    epsilonField = new GetFloat("epsilon", FormHelper.FIELD_LENGTH, new Range(0, Double.MAX_VALUE));

    infinityField = new GetFloat("infinity", FormHelper.FIELD_LENGTH, new Range(0, Double.MAX_VALUE));

    lFirstParRange = new GetFloat("first parameter lower value", FormHelper.FIELD_LENGTH);
    uFirstParRange = new GetFloat("first parameter upper value", FormHelper.FIELD_LENGTH);
    lSecondParRange = new GetFloat("second parameter upper value", FormHelper.FIELD_LENGTH);
    uSecondParRange = new GetFloat("second parameter upper value", FormHelper.FIELD_LENGTH);

    lowerVRangeField = new GetFloat("lower vertical range", FormHelper.FIELD_LENGTH);
    upperVRangeField = new GetFloat("upper vertical range", FormHelper.FIELD_LENGTH);

    verticalBox = new JComboBox(model.getVarNames());

    timeField = new GetFloat("time", FormHelper.FIELD_LENGTH);
    stepField = new GetFloat("step", FormHelper.FIELD_LENGTH);
    hyperplaneCoeffField = new GetVector("hyperplane coefficients", model.getNVar() + 1);

    FormLayout layout = new FormLayout("f:p:n", "");

    setLayout(layout);
    layout.appendRow(new RowSpec("f:p:n"));
    add(createPanel(), new CellConstraints(1, 1));

    if (model.getNPar() >= 2) {
        box1.setSelectedIndex(0);
        box2.setSelectedIndex(1);
        item1 = (String) box1.getSelectedItem();
        item2 = (String) box2.getSelectedItem();
    }
}

From source file:com.redhat.lightblue.metadata.types.BooleanTypeTest.java

@Test
public void testEqualsFalse() {
    assertFalse(booleanType.equals(Double.MAX_VALUE));
}

From source file:com.redhat.lightblue.metadata.types.DoubleTypeTest.java

@Test
public void testCompareEqual() {
    assertEquals(doubleType.compare((Object) Double.MAX_VALUE, (Object) Double.MAX_VALUE), 0);
}

From source file:me.ziccard.secureit.async.upload.PeriodicPositionUploaderTask.java

@Override
protected Void doInBackground(Void... params) {

    while (true) {

        Log.i("PeriodicPositionUploaderTask", "Started");

        if (isCancelled()) {
            return null;
        }//from   www.  j a  v  a 2s.c  om

        HttpClient client = new DefaultHttpClient();

        /*
         * Send the last
         * detected position to /phone/phoneId/position [POST]
         */
        HttpPost request = new HttpPost(Remote.HOST + Remote.PHONES + "/" + phoneId + Remote.UPLOAD_POSITION);

        /*
         * Adding latitude and longitude
         */
        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
        nameValuePairs.add(new BasicNameValuePair("lat", "" + lat));
        nameValuePairs.add(new BasicNameValuePair("long", "" + lng));
        try {
            request.setEntity(new UrlEncodedFormEntity(nameValuePairs));

            /*
             * Access token
             */
            request.setHeader("access_token", accessToken);

            /*
             * We send position only if Gps/Network fixed
             */

            if (lat != Double.MAX_VALUE && lng != Double.MAX_VALUE) {
                dataSent = true;
                HttpResponse response = client.execute(request);

                BufferedReader reader = new BufferedReader(
                        new InputStreamReader(response.getEntity().getContent(), "UTF-8"));
                StringBuilder builder = new StringBuilder();
                for (String line = null; (line = reader.readLine()) != null;) {
                    builder.append(line).append("\n");
                }

                Log.i("PeriodicPositionUploaderTask", "Response:\n" + builder.toString());

                if (response.getStatusLine().getStatusCode() != 200) {
                    throw new HttpException();
                }
            } else {
                Log.i("PeriodicPositionUploaderTask", "We have no position data yet");
                dataSent = false;
            }
        } catch (Exception e) {
            Log.e("DataUploaderTask", "Error uploading location");
            /*
             * We check if we still have connectivity, if this is not true
             * we start BluetoothPeriodicPositionUploader
             */
            ConnectivityManager cm = (ConnectivityManager) context
                    .getSystemService(Context.CONNECTIVITY_SERVICE);
            NetworkInfo activeNetwork = cm.getActiveNetworkInfo();
            boolean isConnected = activeNetwork.isConnectedOrConnecting();
            if (!isConnected) {
                bluetoothTask = new BluetoothPeriodicPositionUploaderTask(context);
                bluetoothTask.execute();
                locationManager.removeUpdates(this);
                return null;
            }
        }

        try {
            if (dataSent)
                Thread.sleep(3600 * 1000);
            else
                Thread.sleep(60 * 1000);
        } catch (InterruptedException e) {
            return null;
        }
    }
}

From source file:com.ibm.bi.dml.yarn.ropt.ResourceOptimizer.java

/**
 * //from ww w.  j ava 2  s .c  o  m
 * @param prog
 * @param cc
 * @param cptype
 * @param mrtype
 * @return
 * @throws DMLRuntimeException
 */
public synchronized static ResourceConfig optimizeResourceConfig(ArrayList<ProgramBlock> prog,
        YarnClusterConfig cc, GridEnumType cptype, GridEnumType mrtype) throws DMLRuntimeException {
    ResourceConfig ROpt = null;

    try {
        //init statistics and counters
        Timing time = new Timing(true);
        initStatistics();

        //get constraints (yarn-specific: force higher min to limit degree of parallelism)
        long max = (long) (YarnOptimizerUtils.toB(cc.getMaxAllocationMB()) / DMLYarnClient.MEM_FACTOR);
        long minCP = (long) Math.max(YarnOptimizerUtils.toB(cc.getMinAllocationMB()) / DMLYarnClient.MEM_FACTOR,
                MIN_CP_BUDGET);
        long minMR = YarnOptimizerUtils.computeMinContraint(minCP, max, cc.getAvgNumCores());

        //enumerate grid points for given types (refers to jvm max heap)
        ArrayList<Long> SRc = enumerateGridPoints(prog, minCP, max, cptype);
        ArrayList<Long> SRm = enumerateGridPoints(prog, minMR, max, mrtype);

        //init resource config and global costs
        ROpt = new ResourceConfig(prog, minMR);
        double costOpt = Double.MAX_VALUE;

        for (Long rc : SRc) //enumerate CP memory rc
        {
            //baseline compile and pruning
            ArrayList<ProgramBlock> B = compileProgram(prog, null, rc, minMR); //unrolled Bp
            ArrayList<ProgramBlock> Bp = pruneProgramBlocks(B);
            LOG.debug("Enum (rc=" + rc + "): |B|=" + B.size() + ", |Bp|=" + Bp.size());

            //init local memo table [resource, cost]
            double[][] memo = initLocalMemoTable(Bp, minMR);

            for (int i = 0; i < Bp.size(); i++) //for all relevant blocks
            {
                ProgramBlock pb = Bp.get(i);

                for (Long rm : SRm) //for each MR memory 
                {
                    //recompile program block 
                    recompileProgramBlock(pb, rc, rm);

                    //local costing and memo table maintenance (cost entire program to account for 
                    //in-memory status of variables and loops)
                    double lcost = getProgramCosts(pb);
                    if (lcost < memo[i][1]) { //accept new local opt
                        memo[i][0] = rm;
                        memo[i][1] = lcost;
                        //LOG.debug("Enum (rc="+rc+"): found new local opt w/ cost="+lcost);         
                    }
                    //LOG.debug("Enum (rc="+rc+", rm="+rm+"): lcost="+lcost+", mincost="+memo[i][1]);                  
                }
            }

            //global costing 
            double[][] gmemo = initGlobalMemoTable(B, Bp, memo, minMR);
            recompileProgramBlocks(B, rc, gmemo);
            double gcost = getProgramCosts(B.get(0).getProgram());
            if (gcost < costOpt) { //accept new global opt
                ROpt.setCPResource(rc.longValue());
                ROpt.setMRResources(B, gmemo);
                costOpt = gcost;
                LOG.debug("Enum (rc=" + rc + "): found new opt w/ cost=" + gcost);
            }
        }

        //print optimization summary
        LOG.info("Optimization summary:");
        LOG.info("-- optimal plan (rc, rm): " + YarnOptimizerUtils.toMB(ROpt.getCPResource()) + "MB, "
                + YarnOptimizerUtils.toMB(ROpt.getMaxMRResource()) + "MB");
        LOG.info("-- costs of optimal plan: " + costOpt);
        LOG.info("-- # of block compiles:   " + _cntCompilePB);
        LOG.info("-- # of block costings:   " + _cntCostPB);
        LOG.info("-- optimization time:     " + String.format("%.3f", (double) time.stop() / 1000) + " sec.");
        LOG.info("-- optimal plan details:  " + ROpt.serialize());
    } catch (Exception ex) {
        throw new DMLRuntimeException(ex);
    }

    return ROpt;
}