update to test in servers

This commit is contained in:
wls2002
2023-05-10 22:33:51 +08:00
parent ce35b01896
commit b271a56827
9 changed files with 112 additions and 34 deletions

View File

@@ -3,7 +3,7 @@ from functools import partial
from utils import Configer
from algorithms.neat import Pipeline
from time_utils import using_cprofile
from problems import Sin, Xor
from problems import Sin, Xor, DIY
# xor_inputs = np.array([[0, 0], [0, 1], [1, 0], [1, 1]], dtype=np.float32)
@@ -25,11 +25,16 @@ from problems import Sin, Xor
@partial(using_cprofile, root_abs_path='/mnt/e/neat-jax/', replace_pattern="/mnt/e/neat-jax/")
def main():
config = Configer.load_config()
# problem = Xor()
problem = Sin()
config.neat.population.pop_size = 50
problem = Xor()
# problem = Sin()
# problem = DIY(func=lambda x: (np.sin(x) + np.exp(x) - x ** 2) / (np.cos(x) + np.sqrt(x)) - np.log(x + 1))
problem.refactor_config(config)
pipeline = Pipeline(config, seed=11454)
pipeline.auto_run(problem.evaluate)
pipeline = Pipeline(config, seed=0)
best_nodes, best_connections = pipeline.auto_run(problem.evaluate)
# print(best_nodes, best_connections)
# func = pipeline.function_factory.ask_batch_forward(best_nodes, best_connections)
# problem.print(func)
if __name__ == '__main__':