for (int i = 0; i < afs.length; i++) {
afs[i] = af;
}
final double c = this.maxWeight / (1.0 - this.minWeight);
final MLData input = new BasicMLData(cppn.getInputCount());
// First create all of the non-bias links.
for (final SubstrateLink link : substrate.getLinks()) {
final SubstrateNode source = link.getSource();
final SubstrateNode target = link.getTarget();
int index = 0;
for (final double d : source.getLocation()) {
input.setData(index++, d);
}
for (final double d : target.getLocation()) {
input.setData(index++, d);
}
final MLData output = cppn.compute(input);
double weight = output.getData(0);
if (Math.abs(weight) > this.minWeight) {
weight = (Math.abs(weight) - this.minWeight) * c
* Math.signum(weight);
linkList.add(new NEATLink(source.getId(), target.getId(),
weight));
}
}
// now create biased links
input.clear();
final int d = substrate.getDimensions();
final List<SubstrateNode> biasedNodes = substrate.getBiasedNodes();
for (final SubstrateNode target : biasedNodes) {
for (int i = 0; i < d; i++) {
input.setData(d + i, target.getLocation()[i]);
}
final MLData output = cppn.compute(input);
double biasWeight = output.getData(1);