Examples of MachineState


Examples of com.dianping.cat.home.utilization.entity.MachineState

    double fullgc = computeDuration(m_fullGcs);
    double load = computeAvg(m_loads);

    Domain current = m_report.findOrCreateDomain(m_domain);

    MachineState newGcState = current.findOrCreateMachineState("newGc");
    MachineState fullGcState = current.findOrCreateMachineState("fullGc");
    MachineState loadState = current.findOrCreateMachineState("load");

    updateMachineState(newGcState, newgc, newgc);
    updateMachineState(fullGcState, fullgc, fullgc);
    updateMachineState(loadState, load, findMax(m_loads));
  }
View Full Code Here

Examples of com.elastisys.scale.cloudadapers.api.types.MachineState

  @Override
  public Machine apply(Instance instance) {
    Preconditions.checkArgument(instance != null, "received null instance");

    String id = instance.getInstanceId();
    MachineState state = new InstanceStateToMachineState().apply(instance
        .getState());
    DateTime launchtime = new DateTime(instance.getLaunchTime(),
        DateTimeZone.UTC);
    List<String> publicIps = Lists.newArrayList();
    List<String> privateIps = Lists.newArrayList();
View Full Code Here

Examples of com.elastisys.scale.cloudadapers.api.types.MachineState

  /**
   * Converts a {@link Server} from the OpenStack API to its {@link Machine}
   * representation.
   */
  private static Machine asMachine(Server server) {
    MachineState state = convertState(server.getStatus());
    DateTime launchTime = new DateTime(server.getCreated(),
        DateTimeZone.UTC);

    List<String> publicIps = Lists.newArrayList();
    List<String> privateIps = Lists.newArrayList();
View Full Code Here

Examples of com.elastisys.scale.cloudadapers.api.types.MachineState

  @Override
  public Machine apply(Instance instance) {
    Preconditions.checkArgument(instance != null, "received null instance");

    String id = instance.getInstanceId();
    MachineState state = new InstanceStateToMachineState().apply(instance
        .getState());
    DateTime launchtime = new DateTime(instance.getLaunchTime(),
        DateTimeZone.UTC);
    List<String> publicIps = Lists.newArrayList();
    List<String> privateIps = Lists.newArrayList();
View Full Code Here

Examples of org.ggp.base.util.statemachine.MachineState

  private int stepCount = 1;
  @Override
  public void observe(Event event) {
    if (event instanceof ServerNewGameStateEvent)
    {
          MachineState s = ((ServerNewGameStateEvent)event).getState();
          // TODO: Perhaps this should run in a separate thread, as in the
          // VisualizationPanel, in case these states are very large.
          JPanel statePanel = new JPanel();
          List<String> sentences = new ArrayList<String>();
          for(GdlSentence sentence : s.getContents())
            sentences.add(sentence.toString());
          //The list of sentences is more useful when sorted alphabetically.
          Collections.sort(sentences);
          StringBuffer sentencesList = new StringBuffer();
          for(String sentence : sentences)
View Full Code Here

Examples of org.ggp.base.util.statemachine.MachineState

  private int stepCount = 1;
  @Override
  public void observe(Event event)
  {
      if (event instanceof ServerNewGameStateEvent) {
          MachineState s = ((ServerNewGameStateEvent)event).getState();
          rt.submit(s, stepCount++);
      } else if (event instanceof ServerTimeEvent) {
          timerBar.time(((ServerTimeEvent) event).getTime(), 500);
      } else if (event instanceof ServerCompletedMatchEvent) {
          rt.finish();
          timerBar.stop();
      } else if (event instanceof ServerNewMatchEvent) {
          MachineState s = ((ServerNewMatchEvent) event).getInitialState();
          rt.submit(s, stepCount);
    }
  }
View Full Code Here

Examples of org.ggp.base.util.statemachine.MachineState

        frame.setVisible(true);

        StateMachine theMachine = new CachedStateMachine(new ProverStateMachine());
        theMachine.initialize(theGame.getRules());
        try {
            MachineState theCurrentState = theMachine.getInitialState();
            do {
                theVisual.observe(new ServerNewGameStateEvent(theCurrentState));
                theCurrentState = theMachine.getRandomNextState(theCurrentState);
                Thread.sleep(250);
                System.out.println("State: " + theCurrentState);
View Full Code Here

Examples of org.ggp.base.util.statemachine.MachineState

     *
     * @param newStateMachine the new state machine
     */
    protected final void switchStateMachine(StateMachine newStateMachine) {
        try {
            MachineState newCurrentState = newStateMachine.getInitialState();
            Role newRole = newStateMachine.getRoleFromConstant(getRoleName());

            // Attempt to run through the game history in the new machine
            List<List<GdlTerm>> theMoveHistory = getMatch().getMoveHistory();
            for(List<GdlTerm> nextMove : theMoveHistory) {
View Full Code Here

Examples of org.ggp.base.util.statemachine.MachineState

        // have one legal move, and so calling "getRandomJointMove" with our move
        // fixed will always return the joint move consisting of our move and the
        // opponent's no-op. In a simultaneous-action game, however, the opponent
        // may have many moves, and so we will randomly pick one of our opponent's
        // possible actions and assume they do that.
        MachineState nextState = theMachine.getNextState(getCurrentState(), theMachine.getRandomJointMove(getCurrentState(), getRole(), moveUnderConsideration));

        // Does the move under consideration end the game? If it does, do we win
        // or lose? If we lose, don't bother considering it. If we win, then we
        // definitely want to take this move. If its goal is better than our current
        // best goal, go ahead and tentatively select it
        if(theMachine.isTerminal(nextState)) {
            if(theMachine.getGoal(nextState, getRole()) == 0) {
                continue;
            } else if(theMachine.getGoal(nextState, getRole()) == 100) {
                  selection = moveUnderConsideration;
                  break;
            } else {
              if (theMachine.getGoal(nextState, getRole()) > maxGoal)
              {
                selection = moveUnderConsideration;
                maxGoal = theMachine.getGoal(nextState, getRole());
              }
              continue;
            }
        }

        // Check whether any of the legal joint moves from this state lead to
        // a loss for us. Again, this only makes sense in the context of an alternating
        // play zero-sum game, in which this is the opponent's move and they are trying
        // to make us lose, and so if they are offered any move that will make us lose
        // they will take it.
        boolean forcedLoss = false;
        for(List<Move> jointMove : theMachine.getLegalJointMoves(nextState)) {
            MachineState nextNextState = theMachine.getNextState(nextState, jointMove);
            if(theMachine.isTerminal(nextNextState)) {
                if(theMachine.getGoal(nextNextState, getRole()) == 0) {
                    forcedLoss = true;
                    break;
                }
View Full Code Here

Examples of org.ggp.base.util.statemachine.MachineState

  private int[] depth = new int[1];
  int performDepthChargeFromMove(MachineState theState, Move myMove) {
      StateMachine theMachine = getStateMachine();
      try {
            MachineState finalState = theMachine.performDepthCharge(theMachine.getRandomNextState(theState, getRole(), myMove), depth);
            return theMachine.getGoal(finalState, getRole());
        } catch (Exception e) {
            e.printStackTrace();
            return 0;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.