Files
NexQuant/rdagent/core/scenario.py
T

60 lines
1.5 KiB
Python
Raw Normal View History

2024-07-05 17:42:00 +08:00
from abc import ABC, abstractmethod
2024-09-29 18:43:17 +08:00
from rdagent.core.experiment import Task
2024-07-05 17:42:00 +08:00
class Scenario(ABC):
@property
@abstractmethod
2024-07-18 22:36:04 +08:00
def background(self) -> str:
2024-07-05 17:42:00 +08:00
"""Background information"""
2024-09-29 18:43:17 +08:00
# TODO: We have to change all the sub classes to override get_source_data_desc instead of `source_data`
def get_source_data_desc(self, task: Task | None = None) -> str: # noqa: ARG002
"""
Source data description
The choice of data may vary based on the specific task at hand.
"""
return ""
2024-07-05 17:42:00 +08:00
@property
2024-07-18 22:36:04 +08:00
def source_data(self) -> str:
2024-09-29 18:43:17 +08:00
"""
A convenient shortcut for describing source data
"""
return self.get_source_data_desc()
2024-07-05 17:42:00 +08:00
@property
@abstractmethod
2024-07-18 22:36:04 +08:00
def interface(self) -> str:
2024-07-05 17:42:00 +08:00
"""Interface description about how to run the code"""
@property
@abstractmethod
2024-07-18 22:36:04 +08:00
def output_format(self) -> str:
2024-07-05 17:42:00 +08:00
"""Output format description"""
@property
@abstractmethod
2024-07-18 22:36:04 +08:00
def simulator(self) -> str:
2024-07-05 17:42:00 +08:00
"""Simulator description"""
@property
@abstractmethod
def rich_style_description(self) -> str:
"""Rich style description to present"""
2024-07-05 17:42:00 +08:00
@abstractmethod
2024-09-29 18:43:17 +08:00
def get_scenario_all_desc(self, task: Task | None = None) -> str:
"""
Combine all descriptions together
The scenario description varies based on the task being performed.
"""
@property
def experiment_setting(self) -> str | None:
"""Get experiment setting and return as rich text string"""
return None