@Override public State<T, U> call() { double v = fn.apply(state.getPayload(), state.getMappedParams()); state.setValue(v); return state; } });
/** * Returns a transformed parameter. * @param i The parameter to return. * @return The value of the parameter. */ public double get(int i) { Mapping m = maps[i]; return m == null ? params[i] : m.apply(params[i]); }
public static void freeze(State<Wrapper, CrossFoldLearner> s) { // radically decrease learning rate double[] params = s.getParams(); params[1] -= 10; // and cause evolution to hold (almost) s.setOmni(s.getOmni() / 20); double[] step = s.getStep(); for (int i = 0; i < step.length; i++) { step[i] /= 20; } }
/** * Creates an evolutionary optimization framework with specified threadiness, * population size and initial state. * @param threadCount How many threads to use in parallelDo * @param populationSize How large a population to use * @param seed An initial population member */ public EvolutionaryProcess(int threadCount, int populationSize, State<T, U> seed) { this.populationSize = populationSize; setThreadCount(threadCount); initializePopulation(populationSize, seed); }
Abstract Class GameObject { private State previous_state; private State current_state; private State draw_state; void Update(float dt) { previous_state = current_state.copy(); current_state = current_state + dt; } void Draw(float dt) { draw_state = interpolate(previous_state, current_state, dt); //Do opengl commands to draw draw_state } }
/** * Maps results to themselves. * @return The original value. */ public static Mapping identity() { return new Identity(); } }
/** * Maps input to the open interval (min, max) with 0 going to the mean of min and * max. When scale is large, a larger proportion of values are mapped to points * near the boundaries. * @see #softLimit(double, double, double) * @param min The largest lower bound on values to be returned. * @param max The least upper bound on values to be returned. * @return A mapping that satisfies the desired constraint. */ public static Mapping softLimit(double min, double max) { return softLimit(min, max, 1); }
/** * Maps input to the open interval (min, max) with 0 going to the mean of min and * max. When scale is large, a larger proportion of values are mapped to points * near the boundaries. When scale is small, a larger proportion of values are mapped to * points well within the boundaries. * @param min The largest lower bound on values to be returned. * @param max The least upper bound on values to be returned. * @param scale Defines how sharp the boundaries are. * @return A mapping that satisfies the desired constraint. */ public static Mapping softLimit(double min, double max, double scale) { return new SoftLimit(min, max, scale); }
/** * Maps results to positive values. * @param scale If large, then large values are more likely. * @return A positive value. */ public static Mapping exponential(double scale) { return new Exponential(scale); }
@Override public State<T, U> call() { double v = fn.apply(state.getPayload(), state.getMappedParams()); state.setValue(v); return state; } });
public static void freeze(State<Wrapper, CrossFoldLearner> s) { // radically decrease learning rate double[] params = s.getParams(); params[1] -= 10; // and cause evolution to hold (almost) s.setOmni(s.getOmni() / 20); double[] step = s.getStep(); for (int i = 0; i < step.length; i++) { step[i] /= 20; } }
/** * Maps results to themselves. * @return The original value. */ public static Mapping identity() { return new Identity(); } }
/** * Returns a transformed parameter. * @param i The parameter to return. * @return The value of the parameter. */ public double get(int i) { Mapping m = maps[i]; return m == null ? params[i] : m.apply(params[i]); }
/** * Maps input to the open interval (min, max) with 0 going to the mean of min and * max. When scale is large, a larger proportion of values are mapped to points * near the boundaries. * @see #softLimit(double, double, double) * @param min The largest lower bound on values to be returned. * @param max The least upper bound on values to be returned. * @return A mapping that satisfies the desired constraint. */ public static Mapping softLimit(double min, double max) { return softLimit(min, max, 1); }
@Override public State<T, U> call() { double v = fn.apply(state.getPayload(), state.getMappedParams()); state.setValue(v); return state; } });
public static void freeze(State<Wrapper, CrossFoldLearner> s) { // radically decrease learning rate double[] params = s.getParams(); params[1] -= 10; // and cause evolution to hold (almost) s.setOmni(s.getOmni() / 20); double[] step = s.getStep(); for (int i = 0; i < step.length; i++) { step[i] /= 20; } }
/** * Maps results to themselves. * @return The original value. */ public static Mapping identity() { return new Identity(); } }