Tabnine Logo
DPrint
Code IndexAdd Tabnine to your IDE (free)

How to use
DPrint
in
burlap.debugtools

Best Java code snippets using burlap.debugtools.DPrint (Showing top 20 results out of 315)

origin: jmacglashan/burlap

/**
 * 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);
}
origin: jmacglashan/burlap

/**
 * 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");
}

origin: jmacglashan/burlap

@Override
public void agent_end(double v) {
  DPrint.cl(this.debugCode, "Got agent end message");
  synchronized (nextStateReference) {
    this.lastReward = v;
    this.curStateIsTerminal = true;
    nextStateReference.val = curState;
    nextStateReference.notifyAll();
  }
}
origin: jmacglashan/burlap

  w.join(a);
  agentNameToId.put(a.agentName(), me.agentId);
  DPrint.c(debugId, me.agentId + " ");
DPrint.cl(debugId, "");
origin: jmacglashan/burlap

DPrint.cl(this.debugCode, "Beginning trial " + (i+1) + "/" + this.nTrials);
DPrint.toggleCode(w.getDebugId(), false);
w.addWorldObserver(this.plotter);
int id = 0;
origin: jmacglashan/burlap

/**
 * 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");
}

origin: jmacglashan/burlap

DPrint.cl(DEBUG_CODE_SCORE, "Score: "+tHistory[i]);
  DPrint.c(DEBUG_CODE_RF_WEIGHTS, z + ": " + featureWeights.weights[z] + "; ");
DPrint.cl(DEBUG_CODE_RF_WEIGHTS, "");
origin: jmacglashan/burlap

/**
 * Blocks the calling thread until a state is provided by the RLGlue server or the RLGlue experiment has ended.
 */
public void blockUntilStateReceived(){
  synchronized(nextStateReference){
    while(this.nextStateReference.val == null && !this.rlGlueExperimentFinished){
      try{
        DPrint.cl(debugCode, "Waiting for state from RLGlue Server...");
        nextStateReference.wait();
      } catch(InterruptedException ex){
        ex.printStackTrace();
      }
    }
  }
}
origin: jmacglashan/burlap

@Override
public void toggleDebugPrinting(boolean toggle){
  DPrint.toggleCode(debugCode, toggle);
}
origin: jmacglashan/burlap

  DPrint.c(DEBUG_CODE_RF_WEIGHTS, z + ": " + featureWeights.weights[z] + "; ");
DPrint.cl(DEBUG_CODE_RF_WEIGHTS, "");
DPrint.cl(DEBUG_CODE_SCORE, "Score: "+tHistory[i]);
origin: jmacglashan/burlap

/**
 * Sets the height and number of transition dynamics samples in a way that ensure epsilon optimality.
 * @param rmax the maximum reward value of the MDP
 * @param epsilon the epsilon optimality (amount that the estimated value function may diverge from the true optimal)
 * @param numActions the maximum number of actions that could be applied from a state
 */
public void setHAndCByMDPError(double rmax, double epsilon, int numActions){
  double lambda = epsilon * (1. - this.gamma) * (1. - this.gamma) / 4.;
  double vmax = rmax / (1. - this.gamma);
  
  this.h = (int)logbase(this.gamma, lambda / vmax) + 1;
  this.c = (int)( (vmax*vmax / (lambda*lambda)) * (2 * this.h * Math.log(numActions*this.h * vmax * vmax / (lambda * lambda) + Math.log(rmax/lambda))) );
  
  DPrint.cl(this.debugCode, "H = " + this.h);
  DPrint.cl(this.debugCode, "C = " + this.c);
}

origin: jmacglashan/burlap

/**
 * Sets whether information during learning is printed to the terminal. Will automatically toggle the debug printing
 * for the underlying MLIRL that runs.
 * @param printDebug if true, information is printed to the terminal; if false then it is silent.
 */
public void toggleDebugPrinting(boolean printDebug){
  DPrint.toggleCode(this.debugCode, printDebug);
  this.mlirlInstance.toggleDebugPrinting(printDebug);
}
origin: jmacglashan/burlap

/**
 * Runs value iteration. Note that if the state samples have not been set, it will throw a runtime exception.
 */
public void runVI(){
  for(int i = 0; i < this.maxIterations || this.maxIterations == -1; i++){
    double change = this.runIteration();
    DPrint.cl(this.debugCode, "Finished iteration " + i + "; max change: " + change);
    if(change < this.maxDelta){
      break;
    }
  }
}
origin: jmacglashan/burlap

/**
 * Loads this RLGlue {@link org.rlcommunity.rlglue.codec.AgentInterface} into RLGlue and runs its event loop in a
 * separate thread.
 */
public void loadAgent(){
  DPrint.toggleCode(debugCode, this.printDebug);
  final AgentLoader loader = new AgentLoader(this);
  Thread eventThread = new Thread(new Runnable() {
    @Override
    public void run() {
      loader.run();
    }
  });
  eventThread.start();
}
origin: jmacglashan/burlap

/**
 * Plans from the input state and then returns a {@link burlap.behavior.policy.GreedyQPolicy} that greedily
 * selects the action with the highest Q-value and breaks ties uniformly randomly.
 * @param initialState the initial state of the planning problem
 * @return a {@link burlap.behavior.policy.GreedyQPolicy}.
 */
@Override
public GreedyQPolicy planFromState(State initialState) {

  DPrint.cl(this.debugCode, "Beginning Planning.");
  int nr = 0;
  while(this.runRollout(initialState) > this.maxDiff && (nr < this.maxRollouts || this.maxRollouts == -1)){
    nr++;
  }
  
  
  DPrint.cl(this.debugCode, "Finished planning with a total of " + this.numBellmanUpdates + " backups.");
  return new GreedyQPolicy(this);
}

origin: jmacglashan/burlap

/**
 * Loads this RLGlue {@link org.rlcommunity.rlglue.codec.AgentInterface} into RLGlue using the specified host address and port
 * nd runs its event loop in a separate thread.
 * @param hostAddress the RLGlue host address.
 * @param portString the port on which to connect to RLGlue.
 */
public void loadAgent(String hostAddress, String portString){
  DPrint.toggleCode(debugCode, this.printDebug);
  final AgentLoader loader = new AgentLoader(hostAddress, portString, this);
  Thread eventThread = new Thread(new Runnable() {
    @Override
    public void run() {
      loader.run();
    }
  });
  eventThread.start();
}
origin: jmacglashan/burlap

@Override
public Action agent_start(Observation observation) {
  DPrint.cl(debugCode, "got agent start message, launching agent.");
  synchronized (nextStateReference) {
    this.curStateIsTerminal = false;
    this.lastReward = 0.;
    final State s = RLGlueDomain.stateFromObservation(observation);
    this.curState = s;
    this.nextStateReference.val = s;
    nextStateReference.notifyAll();
  }
  Action toRet;
  synchronized (nextAction) {
    while(nextAction.val == null){
      try{
        DPrint.cl(debugCode, "Waiting for action...");
        nextAction.wait();
      } catch(InterruptedException ex){
        ex.printStackTrace();
      }
    }
    toRet = getRLGlueAction(nextAction.val);
    nextAction.val = null;
  }
  DPrint.cl(debugCode, "Returning first action.");
  return toRet;
}
origin: jmacglashan/burlap

/**
 * Sets whether information during learning is printed to the terminal. Will automatically toggle the debug printing
 * for the underlying valueFunction as well.
 * @param printDebug if true, information is printed to the terminal; if false then it is silent.
 */
public void toggleDebugPrinting(boolean printDebug){
  DPrint.toggleCode(this.debugCode, printDebug);
  this.request.getPlanner().toggleDebugPrinting(printDebug);
}
origin: jmacglashan/burlap

DPrint.cl(this.debugCode, "Finished writing step csv file to: " + filePath);
origin: jmacglashan/burlap

DPrint.toggleCode(w.getDebugId(), false);
burlap.debugtoolsDPrint

Javadoc

A class for managing debug print statements. Different debug print statements can be associated with different debug ids and enabling or disabling print commands for that debug id can be performed from any class

Most used methods

  • toggleCode
    Enables/disables print commands to the given debug code
  • c
    A print command for the given debug code. If that debug code is set to false, then the print will no
  • cl
    A print line command for the given debug code. If that debug code is set to false, then the print wi
  • u
    A universal print whose behavior is determined by the universalPrint field

Popular in Java

  • Finding current android device location
  • getApplicationContext (Context)
  • addToBackStack (FragmentTransaction)
  • scheduleAtFixedRate (Timer)
  • Point (java.awt)
    A point representing a location in (x,y) coordinate space, specified in integer precision.
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • JCheckBox (javax.swing)
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Top Sublime Text plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now