net.sourceforge.cilib.entity.topologies.HypercudeNeighbourhood Maven / Gradle / Ivy
package net.sourceforge.cilib.entity.topologies;
import fj.Equal;
import fj.F;
import fj.data.List;
public class HypercudeNeighbourhood extends Neighbourhood {
private int n = 5;
@Override
public List f(final List list, final E current) {
final int index = list.elementIndex(Equal.anyEqual(), current).orSome(-1);
return List.range(0, n).map(new F() {
@Override
public E f(Integer a) {
return list.index(index ^ Double.valueOf(Math.pow(2, a)).intValue());
}
});
}
public void setNeighbourhoodSize(int n) {
this.n = n;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy