-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc: add experimental document for evoxvision
- Loading branch information
1 parent
fa45e82
commit 1d435b3
Showing
2 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"# EvoXVision Support\n", | ||
"\n", | ||
"This notebook demostrate the use of EvoXVision in EvoX.\n", | ||
"EvoXVision requires a special binary file format that is specifically designed for evolutionary optimization workflow." | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from evox import algorithms, problems, workflows, monitors\n", | ||
"\n", | ||
"import jax.numpy as jnp\n", | ||
"from jax import random" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"exv_adapter = monitors.EvoXVisionAdapter(\"/tmp/experiment.exv\")\n", | ||
"monitor = monitors.EvalMonitor(evoxvision_adapter=exv_adapter)\n", | ||
"pso = algorithms.CSO(\n", | ||
" lb=jnp.full(shape=(2,), fill_value=-32),\n", | ||
" ub=jnp.full(shape=(2,), fill_value=32),\n", | ||
" pop_size=100,\n", | ||
")\n", | ||
"ackley = problems.numerical.Ackley()\n", | ||
"workflow = workflows.StdWorkflow(\n", | ||
" pso,\n", | ||
" ackley,\n", | ||
" monitors=[monitor],\n", | ||
")\n", | ||
"key = random.PRNGKey(42)\n", | ||
"state = workflow.init(key)\n", | ||
"\n", | ||
"# run the workflow for 100 steps\n", | ||
"for i in range(100):\n", | ||
" state = workflow.step(state)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "venv", | ||
"language": "python", | ||
"name": "python3" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 3 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython3", | ||
"version": "3.11.2" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,5 @@ | |
:maxdepth: 1 | ||
multidevice_algorithm | ||
evoxvision | ||
``` |