Package com.heatonresearch.aifh.distance

Examples of com.heatonresearch.aifh.distance.CalculateDistance


     * This makes sure that is true.
     */
    @Test
    public void testAllEqual() {
        final Equilateral eq = new Equilateral(10, -1, 1);
        final CalculateDistance dc = new EuclideanDistance();
        double compareDist = 0;

        for (int x = 0; x < 10; x++) {
            double[] baseClass = eq.encode(x);
            for (int y = 0; y < 10; y++) {
                if (x != y) {
                    double[] otherClass = eq.encode(y);
                    double dist = dc.calculate(baseClass, otherClass);
                    if (compareDist < AIFH.DEFAULT_PRECISION) {
                        compareDist = dist;
                    } else {
                        assertEquals(compareDist, dist, AIFH.DEFAULT_PRECISION);
                    }
View Full Code Here


        final DiscreteAnnealSubclass anneal = new DiscreteAnnealSubclass(1000, 400, 1);
        while (!anneal.done()) {
            anneal.iteration();
        }

        final CalculateDistance dist = new EuclideanDistance();

        assertEquals(1000, anneal.getK());
        assertEquals(0, dist.calculate(anneal.getBest(), DiscreteAnnealSubclass.IDEAL), AIFH.DEFAULT_PRECISION);
        assertEquals(0, anneal.getBestScore(), AIFH.DEFAULT_PRECISION);
    }
View Full Code Here

TOP

Related Classes of com.heatonresearch.aifh.distance.CalculateDistance

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.