src/engine/Engine.js
function processCycleObservations() {
    let activeObservations = new LiteralTreeMap();

    if (_observations[_currentTime] === undefined) {
      // no observations for current time
      return activeObservations;
    }
    let cloneProgram = _program.clone();
    cloneProgram.setExecutedActions(activeObservations);

    const nextTime = _currentTime + 1;

    // process observations for the current time
    _observations[_currentTime].forEach((ob) => {
      let action = ob.action;

      let tempTreeMap = new LiteralTreeMap();
      tempTreeMap.add(action);

      activeObservations.add(action);

      let postCloneProgram = cloneProgram.clone();
      let postState = postCloneProgram.getState();
      postCloneProgram.setExecutedActions(new LiteralTreeMap());
      updateStateWithFluentActors(
        this,
        tempTreeMap,
        postState
      );
      postCloneProgram.setState(postState);

      // perform pre-check and post-check
      if (!checkConstraintSatisfaction.call(this, cloneProgram)
          || !checkConstraintSatisfaction.call(this, postCloneProgram)) {
        // reject the observed event
        // to keep model true
        activeObservations.remove(action);

        // warning
        _engineEventManager.notify('warning', {
          type: 'observation.reject',
          message: stringLiterals(
            'engine.rejectObservationWarning',
            action,
            _currentTime,
            nextTime
          )
        });
      }

      // if the given observation endTime has not ended
      // propagate to the next cycle's
      if (ob.endTime > nextTime) {
        if (_observations[nextTime] === undefined) {
          _observations[nextTime] = [];
        }
        _observations[nextTime].push(ob);
      }
    });

    return activeObservations;
  }
function processCycleObservations() {
    let activeObservations = new LiteralTreeMap();

    if (_observations[_currentTime] === undefined) {
      // no observations for current time
      return activeObservations;
    }
    let cloneProgram = _program.clone();
    cloneProgram.setExecutedActions(activeObservations);

    const nextTime = _currentTime + 1;

    // process observations for the current time
    _observations[_currentTime].forEach((ob) => {
      let action = ob.action;

      let tempTreeMap = new LiteralTreeMap();
      tempTreeMap.add(action);

      activeObservations.add(action);

      let postCloneProgram = cloneProgram.clone();
      let postState = postCloneProgram.getState();
      postCloneProgram.setExecutedActions(new LiteralTreeMap());
      updateStateWithFluentActors(
        this,
        tempTreeMap,
        postState
      );
      postCloneProgram.setState(postState);

      // perform pre-check and post-check
      if (!checkConstraintSatisfaction.call(this, cloneProgram)
          || !checkConstraintSatisfaction.call(this, postCloneProgram)) {
        // reject the observed event
        // to keep model true
        activeObservations.remove(action);

        // warning
        _engineEventManager.notify('warning', {
          type: 'observation.reject',
          message: stringLiterals(
            'engine.rejectObservationWarning',
            action,
            _currentTime,
            nextTime
          )
        });
      }

      // if the given observation endTime has not ended
      // propagate to the next cycle's
      if (ob.endTime > nextTime) {
        if (_observations[nextTime] === undefined) {
          _observations[nextTime] = [];
        }
        _observations[nextTime].push(ob);
      }
    });

    return activeObservations;
  }
Process observations for the current cycle
@return {LiteralTreeMap} Returns the set of observed event for the current time.