Exemplo n.º 1
0
 public TaskDescription getTaskSpec() {
   int numCompartments = arm.getCompartments().size();
   int numFood = allFood.size();
   int numStateVars = 2 + 4 * (2 * numCompartments + numFood);
   int numActionVars = 3 * numCompartments;
   return new TaskDescription(numStateVars, numActionVars);
 }
Exemplo n.º 2
0
 public ChoiceTracker(ChoiceSpec spec) {
   subObjectives = new HashSet<ObjectiveTracker>();
   for (ObjectiveSpec os : spec.getObjective()) {
     subObjectives.add(makeObjectiveTracker(os));
   }
   selected = null;
   accomplished = false;
 }
Exemplo n.º 3
0
  private String makeTaskSpec() {
    double minXPos = -12.0d;
    double maxXPos = 12.0d;

    double minYPos = -12.0d;
    double maxYPos = 6.0d;

    double minVel = -1.0d;
    double maxVel = 1.0d;
    double minAction = 0.0d;
    double maxAction = 1.0d;

    TaskDescription ts = getTaskSpec();

    TaskSpecVRLGLUE3 theTaskSpecObject = new TaskSpecVRLGLUE3();
    theTaskSpecObject.setEpisodic();
    theTaskSpecObject.setDiscountFactor(1.0d);
    // Angle of the arm
    theTaskSpecObject.addContinuousObservation(new DoubleRange(-4.0d * Math.PI, 4.0d * Math.PI));
    // Angular Velocity
    theTaskSpecObject.addContinuousObservation(new DoubleRange(-1.0d, 1.0d));
    // Now we want to add the variable for all the compartments
    for (int i = 0; i < 4 * (2 * arm.getCompartments().size() + allFood.size()); i++) {
      if (i % 4 == 0) {
        theTaskSpecObject.addContinuousObservation(new DoubleRange(minXPos, maxXPos));
      }
      if (i % 4 == 1) {
        theTaskSpecObject.addContinuousObservation(new DoubleRange(minYPos, maxYPos));
      }
      if (i % 4 == 2 || i % 4 == 3) {
        theTaskSpecObject.addContinuousObservation(new DoubleRange(minVel, maxVel));
      }
    }
    int NDA = 8;

    if (useDiscreteActions) {
      theTaskSpecObject.addDiscreteAction(new IntRange(0, NDA - 1));
    } else {
      theTaskSpecObject.addContinuousAction(
          (new DoubleRange(minAction, maxAction, ts.getNumActionVariables())));
    }
    theTaskSpecObject.setRewardRange(new DoubleRange(-1, 20));

    String newTaskSpecString = theTaskSpecObject.toTaskSpec();
    TaskSpec.checkTaskSpec(newTaskSpecString);

    return newTaskSpecString;
  }