Skip to content

Commit

Permalink
Test brax visualize
Browse files Browse the repository at this point in the history
  • Loading branch information
BillHuang2001 committed Jan 13, 2025
1 parent c0719a7 commit 9ce0390
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions unit_test/problems/test_brax.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,14 @@ def neuroevolution_process(
print(f"In generation {index}:")
t = time.time()
workflow.step()
print(f"\tTime elapsed: {time.time() - t: .4f}(s).")
monitor: EvalMonitor = workflow.get_submodule("monitor")
print(f"\tTop fitness: {monitor.topk_fitness}")
best_params = adapter.to_params(monitor.topk_solutions[0])
print(f"\tBest params: {best_params}")

print(f"\tTime elapsed: {time.time() - t: .4f}(s).")
monitor: EvalMonitor = workflow.get_submodule("monitor")
print(f"\tTop fitness: {monitor.topk_fitness}")
best_params = adapter.to_params(monitor.topk_solutions[0])
print(f"\tBest params: {best_params}")

return best_params


class TestBraxProblem(unittest.TestCase):
Expand Down Expand Up @@ -96,8 +99,10 @@ def test_brax_problem(self):
monitor=pop_monitor,
device=self.device,
)
neuroevolution_process(
best_params = neuroevolution_process(
workflow=workflow,
adapter=adapter,
max_generation=3,
)

problem.visualize(best_params)

0 comments on commit 9ce0390

Please sign in to comment.