This repository has been archived on 2026-05-02. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
-----/agent_diy/feature/definition.py
2026-04-26 12:38:39 +08:00

60 lines
1.8 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-
###########################################################################
# Copyright © 1998 - 2026 Tencent. All Rights Reserved.
###########################################################################
"""
Author: Tencent AI Arena Authors
"""
from common_python.utils.common_func import create_cls
import numpy as np
from agent_diy.conf.conf import Config
# The create_cls function is used to dynamically create a class. The first parameter of the function is the type name,
# and the remaining parameters are the attributes of the class, which should have a default value of None.
# create_cls函数用于动态创建一个类函数第一个参数为类型名称剩余参数为类的属性属性默认值应设为None
ObsData = create_cls(
"ObsData",
feature=None,
legal_act=None,
)
ActData = create_cls(
"ActData",
act=None,
)
# SampleData is used to transfer training samples between aisrv and learner.
# SampleData用于在aisrv和learner之间传递训练样本
SampleData = create_cls(
"SampleData",
obs=153, # Observation dimension / 观测维度
legal_actions=8, # Legal action dimension / 合法动作维度
actions=1, # Action dimension / 动作维度
probs=8, # Action probability distribution dimension / 动作概率分布维度
rewards=1, # Reward / 奖励
advantages=1, # Advantage function / 优势函数
values=1, # Value function / 价值函数
dones=1, # Whether terminated / 是否结束
)
def reward_shaping(frame_no, score, terminated, truncated, remain_info, _remain_info, obs, _obs):
"""Reward shaping function.
奖励塑形函数。
"""
pass
def sample_process(list_game_data):
"""Sample processing function.
样本处理函数。
"""
pass