/** * Initializes the mechanics for the given domain and sets the semi-wall pass through probability to 0.5; * @param d the domain object */ public GridGameStandardMechanics(Domain d){ rand = RandomFactory.getMapped(0); domain = d; pMoveThroughSWall = 0.5; }
/** * Returns the random generator with the associated id or creates it if it does not yet exist * @param id the id of the random generator * @return the random generator */ public static Random getMapped(int id){ return factory.ingetMapped(id); }
/** * Seeds and returns the random generator with the associated String id or creates it if it does not yet exist * @param id the id of the random generator * @param seed the seed to use * @return the random generator */ public static Random seedMapped(String id, long seed){ return factory.inseedMapped(id, seed); }
public class Main { public static void main(String[] args) { MyTimer myTimer = new MyTimer(300000,30000); myTimer.startTimer(); } }
timer = new MyTimer() { void alarm() { // do cool things } }; timer.setDelay(10000).start();
/** * Creates a new timer and starts it if start=true. * @param start if true, then start the timer; if false then don't start the timer. */ public MyTimer(boolean start){ timing = false; numTimers = 0; sumTime = 0; this.start(); }
/** * Toggles whether debug information should be printed * @param printDebug whether to print debug logs or not */ public void toggleDebug(boolean printDebug){ this.printDebug = printDebug; DPrint.toggleCode(this.debugCode, this.printDebug); }
/** * A print line command for the given debug code. If that debug code is set to false, then the print will not occur. * @param c the debug code under which printing should be performed * @param s the string to print */ public static void cl(int c, String s){ c(c, s+"\n"); }
/** * Sets the seed of the default random number generator * @param seed the seed to use * @return the default random number generator */ public static Random seedDefault(long seed){ return factory.inseedDefault(seed); }
/** * A universal print line whose behavior is determined by the <code>universalPrint</code> field * @param s the string to print */ public static void ul(String s){ u(s+"\n"); }
/** * Either returns the random generator for the given id or creates if with the given seed it does not yet exit * @param id the id of the random generator * @param seed the seed to use * @return the random generator */ public static Random getOrSeedMapped(int id, long seed){ return factory.ingetOrSeedMapped(id, seed); }
/** * Returns the default random number generator. * @return the default random number generator. */ public static Random getDefault(){ return factory.ingetDefault(); }
/** * Initializes with the QComputablePlanner to use and the value of epsilon to use, where epsilon is the probability of taking a random action. * @param planner the QComputablePlanner to use * @param epsilon the probability of taking a random action. */ public EpsilonGreedy(QProvider planner, double epsilon) { qplanner = planner; this.epsilon = epsilon; rand = RandomFactory.getMapped(0); }
/** * Returns the random generator with the associated String id or creates it if it does not yet exist * @param id the id of the random generator * @return the random generator */ public static Random getMapped(String id){ return factory.ingetMapped(id); }
/** * Seeds and returns the random generator with the associated id or creates it if it does not yet exist * @param id the id of the random generator * @param seed the seed to use * @return the random generator */ public static Random seedMapped(int id, long seed){ return factory.inseedMapped(id, seed); }
/** * Initializes with a QComputablePlanner * @param planner the QComputablePlanner to use */ public GreedyQPolicy(QProvider planner){ qplanner = planner; rand = RandomFactory.getMapped(0); }
/** * Initializes a graph action object for the given domain and for the action of the given number. * The name of this action will be the constant BASEACTIONNAMEi where i is the action number specified. * @param aId the action identifier number * @param transitionDynamics the underlying transition dynamics that also define the action preconditions */ public GraphActionType(int aId, Map<Integer, Map<Integer, Set<NodeTransitionProbability>>> transitionDynamics){ this.aId = aId; rand = RandomFactory.getMapped(0); this.transitionDynamics = transitionDynamics; }
/** * Initializes the mechanics for the given domain and sets the semi-wall pass through probability to semiWallPassThroughProb. * @param d d the domain object * @param semiWallPassThroughProb the probability that an agent will pass through a semi-wall. */ public GridGameStandardMechanics(Domain d, double semiWallPassThroughProb){ rand = RandomFactory.getMapped(0); domain = d; pMoveThroughSWall = semiWallPassThroughProb; }
/** * Initializes for the {@link MountainCar} {@link Domain} object for which states will be generated. By default, the random x and velocity ranges will be * the full range used by the domain. * @param params the mountain car physics parameters specifying the boundaries */ public MCRandomStateGenerator(MountainCar.MCPhysicsParams params){ this.xmin = params.xmin; this.xmax = params.xmax; this.vmin = params.vmin; this.vmax = params.vmax; this.rand = RandomFactory.getMapped(0); }
/** * Initializes with the value of epsilon, where epsilon is the probability of taking a random action. * @param epsilon the probability of taking a random action. */ public EpsilonGreedy(double epsilon) { qplanner = null; this.epsilon = epsilon; rand = RandomFactory.getMapped(0); }