change repo structure; modify readme
This commit is contained in:
39
tensorneat/problem/base.py
Normal file
39
tensorneat/problem/base.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from typing import Callable
|
||||
|
||||
from utils import State
|
||||
|
||||
|
||||
class BaseProblem:
|
||||
jitable = None
|
||||
|
||||
def setup(self, randkey, state: State = State()):
|
||||
"""initialize the state of the problem"""
|
||||
pass
|
||||
|
||||
def evaluate(self, randkey, state: State, act_func: Callable, params):
|
||||
"""evaluate one individual"""
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def input_shape(self):
|
||||
"""
|
||||
The input shape for the problem to evaluate
|
||||
In RL problem, it is the observation space
|
||||
In function fitting problem, it is the input shape of the function
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
@property
|
||||
def output_shape(self):
|
||||
"""
|
||||
The output shape for the problem to evaluate
|
||||
In RL problem, it is the action space
|
||||
In function fitting problem, it is the output shape of the function
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
def show(self, randkey, state: State, act_func: Callable, params, *args, **kwargs):
|
||||
"""
|
||||
show how a genome perform in this problem
|
||||
"""
|
||||
raise NotImplementedError
|
||||
Reference in New Issue
Block a user