
Redefining Accounting! Developed by Bfsu Ai-Accounting Team (c) 2023 Github
For detailed installation instructions, see the documentation.
pip install cpagym
import gymnasium as gym
import cpagym as cg
import torch
env = gym.make("Moral_Hazard-v1")#Instantiate the Environment载入道德风险环境
state, info = env.reset(seed=2)#初始化
n_steps = 10
for _ in range(n_steps):
action = env.action_space.sample()#随机行动
state, reward, terminated, truncated, info = env.step(action)
print(observation, reward, terminated, truncated, info )
if terminated or truncated:
observation, info = env.reset()
agent=cg.Agent(state_size=1,action_size=2)#Instantiate the Agent载入会计智能体
env = gym.make("Moral_Hazard-v1")
state, info = env.reset(seed=2)
action = agent.act(state, eps)#最优化行动
next_state, reward, done, _,_ = env.step(action)
agent.step(state, action, reward, next_state, done)
print(agent.memory.memory)

Check out: https://cpanlp.com/reinforcement