package pacman.entries.pacman; import pacman.utils.DataFile; /** * A linear function of the feature values. */ public class QFunction { private double[] weights; // Weight vector private double bias; // For a constant feature private double[] eligibility; // Traces private double ebias; // For a constant feature /** Start with everything at zero. */ public QFunction(FeatureSet prototype) { weights = new double[prototype.size()]; eligibility = new double[prototype.size()]; } /** Load initial settings from a file. */ public QFunction(FeatureSet prototype, String filename) { this(prototype); DataFile file = new DataFile(filename); bias = Double.parseDouble(file.nextLine()); for (int i=0; i