Skip to main content

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.

Project description

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

  1. Paragen System Reference: https://www.ingentaconnect.com/content/iass/jiass/2012/00000053/00000004/art00010

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

morpho_ga-1.0.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

morpho_ga-1.0.0-py3-none-any.whl (6.8 kB view details)

Uploaded Python 3

File details

Details for the file morpho_ga-1.0.0.tar.gz.

File metadata

  • Download URL: morpho_ga-1.0.0.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for morpho_ga-1.0.0.tar.gz
Algorithm Hash digest
SHA256 16aab4048c3b6f96df7e390c0faf519e81e458e7e62b27f02a9b7f40f19db3c9
MD5 dd29938fff1a01fa780ffff3c9492c6d
BLAKE2b-256 cb1d740b5d1d66a49ffcf8111a50fa5c49724d72a892b315416cc526e90bd254

See more details on using hashes here.

File details

Details for the file morpho_ga-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: morpho_ga-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for morpho_ga-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d0aeba88824838c787117ae1c31b663528fd181c13daed3fe377f868b01d4f48
MD5 609091a54ad739287e276a09f3847919
BLAKE2b-256 6cd2352da27feacb593394fd23141648848ca8d2f09fff1b3f3070d61aefad35

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page