18 lines
536 B
Python
18 lines
536 B
Python
# usecases/get_best_action_usecase.py
|
|
|
|
from negotiation_agent.agent import QLearningAgent
|
|
import numpy as np
|
|
|
|
|
|
class GetBestActionUseCase:
|
|
"""'최적 행동 추천' 비즈니스 로직을 담당"""
|
|
|
|
def __init__(self, agent: QLearningAgent):
|
|
self.agent = agent
|
|
self.agent.epsilon = 0 # 항상 최선의 행동만 선택
|
|
|
|
def execute(self, state: np.ndarray) -> int:
|
|
"""주어진 상태에 대해 최적의 행동을 반환"""
|
|
action = self.agent.get_action(state)
|
|
return int(action)
|