加入一个提前停止的机制 还有减少环境步中间步骤传递至cpu

This commit is contained in:
qihuanye
2026-05-18 00:48:59 +08:00
parent 113e591899
commit 28f2fba0e8
5 changed files with 138 additions and 16 deletions

View File

@@ -1,6 +1,7 @@
from typing import Any, Protocol, runtime_checkable
import gymnasium as gym
import numpy as np
import torch
@@ -61,7 +62,12 @@ class Solver(Protocol):
"""Planning horizon length in timesteps."""
...
def solve(self, info_dict: dict, init_action: torch.Tensor | None = None) -> dict:
def solve(
self,
info_dict: dict,
init_action: torch.Tensor | None = None,
active_mask: torch.Tensor | np.ndarray | None = None,
) -> dict:
"""Solve the planning optimization problem to find optimal actions.
Args: