Search in sources :

Example 1 with GeneArrayModel

use of ntuple.GeneArrayModel in project SimpleAsteroids by ljialin.

the class PairedDifferenceLearner method learn.

@Override
public int[] learn(List<ScoredVec> scoredVecs, NoisySolutionEvaluator evaluator) {
    int n = evaluator.searchSpace().nDims();
    fitness = new double[scoredVecs.size()];
    GeneArrayModel geneArrayModel = new GeneArrayModel(evaluator.searchSpace());
    for (int i = 0; i < scoredVecs.size(); i++) {
        for (int j = 0; j < i; j++) {
            // System.out.println(i + " <> " + j);
            ScoredVec svi = scoredVecs.get(i);
            ScoredVec svj = scoredVecs.get(j);
            if (diffUpdate) {
                geneArrayModel.updateModelDiff(svi, svj);
            } else {
                if (svi.score > svj.score) {
                    geneArrayModel.updateModel(svi, svj);
                } else {
                    geneArrayModel.updateModel(svj, svi);
                }
            }
        }
        fitness[i] = evaluator.trueFitness(geneArrayModel.argMax());
    }
    // geneArrayModel.report();
    return geneArrayModel.argMax();
}
Also used : GeneArrayModel(ntuple.GeneArrayModel) ScoredVec(ntuple.ScoredVec)

Aggregations

GeneArrayModel (ntuple.GeneArrayModel)1 ScoredVec (ntuple.ScoredVec)1