evodef.SearchSpaceUtil Maven / Gradle / Ivy
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;
}
}