Morpho Design Explorer - GA Client
This is the GA Client Component of the Morpho Design Explorer Project. This client provides the GASearch class interface to connect to a MorphoDesignExplorer backend, load project schemas and existing generated models, and generate new children with custom fitness functions.
Sample usage is as follows:
# Import the search interface class
from morpho_ga import GASearch
# Define the server location URL and the project identifier for the project to operate on
SERVER_URL, project_id = "server_url_here", "project_id here"
# build the search interface and load generated models from SERVER_URL
search_object = GASearch(SERVER_URL, project_id)
# generate a child with the following fitness function: 2 <= step < 7
print(search_object.generate_child((Q.step >= 2) & (Q.step < 7)))
# get auth token from the server; will trigger a CLI prompt for a username, password and OTP
search_object.get_token()
# dump all generated models to the server in bulk
search_object.put_records()
The generate_child() method generates one child at a time. This offers great flexibility in generating a varying number of children with different fitness functions. An example is given below to demonstrate the same:
iterations = 0
unique = 0
while True:
if unique == 10:
break
if unique < 5:
# generate 5 children with random genes, from the pool with `step` > 0
child = search_object.generate_child(Q.step > 0, parent_count=0)
elif unique >= 5:
# generate 5 more random chilren with genes crossed over from 2 parents, with 2 <= step < 7
child = search_object.generate_child((Q.step >= 2) & (Q.step < 7), parent_count=0)
if child is not None:
# bump unique if child is not a duplicate
unique += 1
iterations += 1
search_object.put_records()
Todo
- Don't upload the entire set of records on generation of each child; only upload new children.
- Fetch username and password from a file and Fetch OTP from the CLI or through a CLI option.
- Detect and report malformed Server URLs passed.
References
- Paragen System Reference: https://www.ingentaconnect.com/content/iass/jiass/2012/00000053/00000004/art00010
Release files for morpho-ga 1.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| morpho_ga-1.0.0.tar.gz | 5.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| morpho_ga-1.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.7 kB
Release files / morpho_ga-1.0.0.tar.gz
| Download URL | morpho_ga-1.0.0.tar.gz |
|---|---|
| Size | 5.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
16aab4048c3b6f96df7e390c0faf519e81e458e7e62b27f02a9b7f40f19db3c9
|
|
BLAKE2b-256 checksum How to use checksums |
cb1d740b5d1d66a49ffcf8111a50fa5c49724d72a892b315416cc526e90bd254
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.7
|
Release files / morpho_ga-1.0.0-py3-none-any.whl
| Download URL | morpho_ga-1.0.0-py3-none-any.whl |
|---|---|
| Size | 6.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d0aeba88824838c787117ae1c31b663528fd181c13daed3fe377f868b01d4f48
|
|
BLAKE2b-256 checksum How to use checksums |
6cd2352da27feacb593394fd23141648848ca8d2f09fff1b3f3070d61aefad35
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.7
|