def monte_carlo_estimation(self, state: State):
        """
        Perform Monte Carlo estimation for state by generating k rollouts
        and computing MC(s) = c / k, where c is the number of correct rollouts.
        """
        c = 0  # Correct rollouts count
        incorrect_rollouts = []
        correct_rollouts = []
        batct_rollouts = self.LM.generate_rollout(state.solution_prefix, self.k)

        # Increment visit count of selected state
        state.N += 1

        for i, rollout in enumerate(batct_rollouts):
            # Increment number of total rollouts
            self.total_rollouts += 1

            # Generate rollout r_i

            state.add_rollout(rollout)

            # Evaluate correctness of final answer in rollout
            full_solution = (state.solution_prefix + '\n\n' + rollout).strip() if state.solution_prefix else rollout
            is_correct = self.LM.evaluate_correctness(full_solution, self.expected_answer)

            # print(f"Rollout {i + 1} Correctness: {'Correct' if is_correct else 'Incorrect'}\n")

            if is_correct:
                c += 1
                correct_rollouts.append(rollout)
            else:
                incorrect_rollouts.append(rollout)
                state.add_incorrect_rollout(rollout)  # Track incorrect rollouts

        # Update total rollouts and correct rollouts
        state.total_rollouts += self.k
        state.correct_rollouts += c
        state.MC = state.correct_rollouts / state.total_rollouts if state.total_rollouts > 0 else 0

        # print(f"Monte Carlo Estimation for State ID {self.T.nodes.index(state)}: MC = {state.MC:.2f}, Total Rollouts = {state.total_rollouts}, Correct Rollouts = {state.correct_rollouts}\n")

        if state.MC == 1.0:
            # Add all correct rollouts to the tree as new states
            for rollout in correct_rollouts:
                self.add_correct_rollout_to_tree(state, rollout)
        elif state.MC == 0.0:
            # State is incorrect; no further action
            # print(f"State ID {self.T.nodes.index(state)} has MC == 0. No further rollouts will be added.\n")
            return
        else:
            # 0 < MC(s) < 1.0
            # Add correct rollouts to the tree
            for rollout in correct_rollouts:
                self.add_correct_rollout_to_tree(state, rollout)
            # Add incorrect rollouts to candidate pool with updated priorities
            for rollout in incorrect_rollouts:

                priority = self.compute_selection_score(state, rollout)
                self.C.add_or_update(state, rollout, priority)

        Perform Monte Carlo estimation for state by generating k rollouts
        and computing MC(s) = c / k, where c is the number of correct rollouts.
        
data/omegaPRM_v2/omegaprm.py