All Downloads are FREE. Search and download functionalities are using the official Maven repository.

evodef.SearchSpaceUtil Maven / Gradle / Ivy

There is a newer version: 0.3.0
Show newest version
package evodef;

import java.util.Arrays;
import java.util.Random;

/**
 * Created by simonmarklucas on 24/10/2016.
 */
public class SearchSpaceUtil {


    public static double size(SearchSpace space) {
        double size = 1;
        for (int i=0; i=0; i--) {
            p[i] = ix % space.nValues(i);
            ix /= space.nValues(i);
        }
        return p;

    }

    public static int indexOf(SearchSpace space, int[] p) {

        int fac = 1;
        int tot = 0;
        for (int i=p.length-1; i>=0; i--) {
            tot += p[i] * fac;
            fac *= space.nValues(i);
        }
        return tot;

    }


}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy