Пример #1
0
    def predict_outcome(self, task_state, params):
        outcomes = []
        success_prob = self.predict_success(task_state, params)

        # success
        outcome = Outcome()
        outcome.success = 1
        outcome.probability = success_prob
        # cost
        outcome.cost = self.predict_cost(task_state, params)
        outcome.task_state_update = CTaskStateUpdate(
            task_state,
            True,  # is_pos_update
            task_state.get_subpath_xy()[-1],
            task_state.get_subpath_ij()[-1],
            "NUDGE",
            "S",
        )
        outcomes.append(outcome)
        # failure
        outcome = Outcome()
        outcome.success = 0
        outcome.probability = 1 - success_prob
        # cost
        outcome.cost = self.predict_cost(task_state, params)
        outcome.task_state_update = CTaskStateUpdate(
            task_state,
            False,  # is_pos_update
            None,
            None,
            "NUDGE",
            "F",
        )
        outcomes.append(outcome)
        return outcomes
Пример #2
0
    def predict_outcome(self, task_state, params):
        """ if crawling failed, the likelihood of a non-permissive agent is high """
        outcomes = []
        success_prob = self.predict_success(task_state, params)

        # success
        outcome = Outcome()
        outcome.success = 1
        outcome.probability = success_prob
        # cost
        outcome.cost = self.predict_cost(task_state, params)
        outcome.task_state_update = CTaskStateUpdate(
            task_state,
            True,  # is_pos_update
            task_state.get_subpath_xy()[-1],
            task_state.get_subpath_ij()[-1],
            "CRAWL",
            "S",
        )
        outcomes.append(outcome)
        # failure
        outcome = Outcome()
        outcome.success = 0
        outcome.probability = 1 - success_prob
        # cost
        outcome.cost = self.predict_cost(task_state, params)
        outcome.task_state_update = CTaskStateUpdate(
            task_state,
            False,  # is_pos_update
            None,
            None,
            "CRAWL",
            "F",
        )
        outcomes.append(outcome)
        return outcomes