### Setup Pre-commit Hooks Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/docs/CONTRIBUTING.md Commands to install the pre-commit framework and initialize the git hook scripts in the local environment. This ensures that code style checks are performed automatically before every commit. ```bash pip install pre-commit pre-commit install ``` -------------------------------- ### Start Redis Server Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/README.md Starts the local Redis server required for managing state and communication in the GigaEvo framework. ```bash redis-server ``` -------------------------------- ### Start Full GigaEvo DAG Builder Environment Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/tools/dag_builder/README.md Convenience script to launch both the backend and frontend components simultaneously. ```bash bash tools/dag_builder/start.sh ``` -------------------------------- ### Initialize GigaEvo DAG Builder Frontend Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/tools/dag_builder/README.md Commands to install dependencies and launch the React-based frontend development server. ```bash cd tools/dag_builder/frontend npm install npm start ``` -------------------------------- ### Run Backend and Frontend Development Servers (Bash) Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/tools/dag_builder/README.md Demonstrates how to start the FastAPI backend with auto-reloading and the React frontend with hot reloading in separate terminals for development. ```bash # Terminal 1: Backend with auto-reload cd tools/dag_builder python run.py # Terminal 2: Frontend with hot reload cd tools/dag_builder/frontend npm start ``` -------------------------------- ### Single-Island Configuration (YAML) Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/docs/EVOLUTION_STRATEGIES.md Example of a basic configuration for a single-island evolutionary setup. This configuration defines a single behavior space, implying a simpler optimization objective compared to multi-island systems. ```yaml ### Single-Island Setup Simplest configuration (one behavior space): ```yaml ``` -------------------------------- ### Install Project Dependencies Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/tools/README.md Lists the necessary pip commands to install dependencies required for data analysis and the DAG builder tool. ```bash pip install pandas matplotlib seaborn cd tools/dag_builder pip install -r requirements.txt ``` -------------------------------- ### Running GigaEvo Evolution Experiments Source: https://context7.com/fusionbrainlab/gigaevo-core/llms.txt Command-line examples for initiating and configuring GigaEvo evolution experiments. These commands utilize Hydra for configuration, allowing customization of problems, generation limits, LLM models, and resuming from saved states. ```bash python run.py problem.name=heilbron python run.py problem.name=heilbron max_generations=50 redis.db=5 python run.py experiment=multi_island_complexity problem.name=heilbron python run.py experiment=multi_llm_exploration problem.name=heilbron python run.py problem.name=heilbron \ max_generations=100 \ max_mutations_per_generation=15 \ model_name=anthropic/claude-3.5-sonnet \ temperature=0.8 python run.py problem.name=heilbron redis.db=5 redis.resume=true ``` -------------------------------- ### Run GigaEvo Optimization with Custom Budget Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/docs/OPTUNA_OPTIMIZATION.md Example of how to override default time budget parameters for the Optuna optimization stage using command-line arguments. ```bash python run.py dag_timeout=2400 optimization_time_budget=1800 ``` -------------------------------- ### LLM Step Prompt Assembly Example Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/problems/chains/aime/full/task_description.txt Illustrates how structured fields from an LLM step are assembled into a complete prompt. This includes the system prompt, outer context, and details specific to the current step like objective and task. ```text [If system_prompt is non-empty] System Instructions: {system_prompt} Data: {outer_context} ← initial user input [If step has dependencies] Previous steps: Step N. Title Result: ... Based on the results of previous steps, perform the following task: Step {number}. {title} Objective: {aim} Task: {stage_action} Questions: {reasoning_questions} Example reasoning: {example_reasoning} ``` -------------------------------- ### LLM Step Configuration Example Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/problems/chains/hotpotqa/full/task_description.txt This snippet demonstrates the structure of an LLM step within the GigaEvo Core framework. It includes essential fields like 'aim' and 'stage_action', optional fields for 'reasoning_questions' and 'example_reasoning', and specifies dependencies on previous steps. LLM steps are crucial for performing complex reasoning and text generation tasks. ```yaml { "number": 2, "title": "Analyze passages", "step_type": "llm", "aim": "required — step objective", "stage_action": "required — what the LLM should do", "reasoning_questions": "optional — guiding questions", "example_reasoning": "optional — example thought process", "dependencies": [1] } ``` -------------------------------- ### Execute GigaEvo Test Suite Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/README.md Instructions for installing test dependencies and running various pytest configurations. ```bash # Install test dependencies pip install -e ".[test]" # Run full test suite python -m pytest # Run specific test file python -m pytest tests/evolution/test_elite_selectors.py # Run with coverage python -m pytest --cov=gigaevo --cov-report=term-missing ``` -------------------------------- ### Tool Step Configuration Example Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/problems/chains/hotpotqa/full/task_description.txt This snippet illustrates the configuration of a 'tool' step in the GigaEvo Core. It specifies the tool to be used ('retrieve') and maps inputs, such as a 'query', to external context variables. Tool steps are used to interact with external functionalities, like data retrieval. ```yaml { "step_type": "tool", "step_config": { "tool_name": "retrieve", "input_mapping": {"query": "$outer_context"} }, "dependencies": [] } ``` -------------------------------- ### SumArchiveSelector Example (Python) Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/docs/EVOLUTION_STRATEGIES.md Demonstrates the usage of SumArchiveSelector for comparing programs based on a weighted sum of their fitness values across multiple keys. It shows how to define weights and calculate scores. ```python SumArchiveSelector( fitness_keys=["fitness", "validity"], fitness_key_higher_is_better=[True, True], weights=[1.0, 0.5] # Fitness has 2x weight of validity ) # Comparison: program_a_score = 80.0 * 1.0 + 0.9 * 0.5 = 80.45 program_b_score = 75.0 * 1.0 + 1.0 * 0.5 = 75.50 # Program A wins ``` -------------------------------- ### Stage Execution Timeline Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/docs/DAG_SYSTEM.md Provides a Python code example demonstrating the typical timeline of a stage's lifecycle from creation to result storage. ```APIDOC ### Execution Timeline ```python # 1. Stage created (build time) stage = MyStage(timeout=60.0) # 2. Inputs attached (runtime, by DAG) stage.attach_inputs({"input_field": upstream_output}) # 3. Validation (lazy, on first access) inputs = stage.params # Triggers Pydantic validation # 4. Execution (async) result = await stage.execute(program) # 5. Result stored in program.stage_results[stage_name] program.stage_results["MyStage"] = result ``` ``` -------------------------------- ### Adjust Optimization Timeouts and Trial Limits Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/docs/OPTUNA_OPTIMIZATION.md Provides command line examples to increase the global DAG timeout and optimization budget, or to restrict the number of trials and evaluation duration to prevent stage timeouts. ```bash python run.py dag_timeout=7200 optimization_time_budget=6000 ``` ```bash python run.py '_optuna_stage_kwargs={n_trials: 40, eval_timeout: 30}' ``` -------------------------------- ### GigaEvo Initial Seed Program Source: https://context7.com/fusionbrainlab/gigaevo-core/llms.txt Python script defining an initial seed program for a GigaEvo optimization problem. The `entrypoint` function generates a solution based on defined bounds, serving as a starting point for the evolutionary process. ```python # problems/my_problem/initial_programs/strategy1.py """Initial seed program implementing a baseline strategy.""" import numpy as np from helper import get_bounds np.random.seed(42) def entrypoint(): """ Generate solution for the optimization problem. Returns: Solution array/object matching validate() expectations """ bounds = get_bounds() # Simple baseline strategy solution = np.random.uniform(bounds[0], bounds[1], size=(10, 2)) return solution ``` -------------------------------- ### Scaffold New Problems with Wizard (YAML & Bash) Source: https://context7.com/fusionbrainlab/gigaevo-core/llms.txt This section details how to use the 'wizard' tool to scaffold new problems by generating directory structures from a YAML configuration file. It shows examples of configuration and command-line usage for generation, validation, overwriting, and custom output directories. ```yaml # tools/wizard/config/my_optimization.yaml name: "my_optimization" description: "Optimize a complex objective function" entrypoint: params: [] returns: "(N, D) array of solution points" validation: params: ["solution"] metrics: fitness: description: "Objective function value" decimals: 6 is_primary: true higher_is_better: true lower_bound: 0.0 upper_bound: 1000.0 include_in_prompts: true significant_change: !!float 1e-4 diversity: description: "Solution diversity score" decimals: 4 is_primary: false higher_is_better: true lower_bound: 0.0 upper_bound: 1.0 include_in_prompts: true significant_change: 0.01 task_description: objective: | Find N points in D-dimensional space that maximize the objective function while maintaining diversity among solutions. add_helper: true add_context: false initial_programs: - name: random_search description: "Random point generation baseline" - name: grid_search description: "Uniform grid-based initialization" ``` ```bash # Generate problem scaffolding python -m tools.wizard my_optimization.yaml # Validate config without generating python -m tools.wizard my_optimization.yaml --validate-only # Overwrite existing problem directory python -m tools.wizard my_optimization.yaml --overwrite # Custom output directory python -m tools.wizard my_optimization.yaml --output-dir custom/path ``` -------------------------------- ### Install GigaEvo Dependencies Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/README.md Installs the required Python dependencies for the GigaEvo framework in editable mode. ```bash pip install -e . ``` -------------------------------- ### Calculate Startup Trials Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/docs/OPTUNA_OPTIMIZATION.md Shows how the number of initial random startup trials is determined, which are added to the main Optuna trials. ```pseudocode n_startup = clamp(n_trials // 2, min=10, max=25) total_trials = n_startup + n_trials ``` -------------------------------- ### Configure Environment Variables Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/README.md Sets up the necessary API keys and optional tracing configurations in a .env file. ```bash OPENAI_API_KEY=sk-or-v1-your-api-key-here # Optional: Langfuse tracing (for observability) LANGFUSE_PUBLIC_KEY= LANGFUSE_SECRET_KEY= LANGFUSE_HOST=https://cloud.langfuse.com ``` -------------------------------- ### Troubleshoot npm Install Issues (Bash) Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/tools/dag_builder/README.md Offers bash commands to clear the npm cache and reinstall dependencies, addressing common issues during frontend package installation. ```bash # Clear npm cache npm cache clean --force # Delete node_modules and reinstall rm -rf node_modules package-lock.json npm install ``` -------------------------------- ### GET /api/stages Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/tools/dag_builder/README.md Retrieves a list of all available stages registered in the GigaEvo system. ```APIDOC ## GET /api/stages ### Description Retrieves all available stages that have been registered using the @StageRegistry.register decorator. ### Method GET ### Endpoint /api/stages ### Response #### Success Response (200) - **stages** (array) - List of stage objects containing metadata and configuration requirements. #### Response Example { "stages": [ { "name": "DataLoad", "type": "input" }, { "name": "ModelTrain", "type": "process" } ] } ``` -------------------------------- ### GET /api/stages/{name} Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/tools/dag_builder/README.md Retrieves detailed configuration information for a specific stage by its name. ```APIDOC ## GET /api/stages/{name} ### Description Fetches detailed information for a specific stage, including parameters and validation rules. ### Method GET ### Endpoint /api/stages/{name} ### Parameters #### Path Parameters - **name** (string) - Required - The unique name of the stage. ### Response #### Success Response (200) - **stage_details** (object) - Detailed schema and metadata for the requested stage. #### Response Example { "name": "DataLoad", "parameters": { "source_path": "string" } } ``` -------------------------------- ### Configure DagRunner for Concurrent DAG Execution (YAML & Python) Source: https://context7.com/fusionbrainlab/gigaevo-core/llms.txt This snippet shows how to configure the DagRunner for concurrent Directed Acyclic Graph (DAG) execution. It includes a YAML configuration example and a Python programmatic usage example demonstrating how to set parameters like poll interval, concurrent DAGs, and timeouts, and how to monitor metrics. ```yaml # config/runner/default.yaml dag_runner: _target_: gigaevo.runner.dag_runner.DagRunner storage: ${ref:redis_storage} dag_blueprint: ${dag_blueprint} writer: ${ref:writer} config: _target_: gigaevo.runner.dag_runner.DagRunnerConfig poll_interval: 0.5 # Seconds between Redis polls max_concurrent_dags: 8 # Parallel DAG executions metrics_collection_interval: 1.0 dag_timeout: 3600 # Max seconds per DAG ``` ```python from gigaevo.runner.dag_runner import DagRunner, DagRunnerConfig config = DagRunnerConfig( poll_interval=0.5, max_concurrent_dags=16, dag_timeout=1800 ) runner = DagRunner( storage=redis_storage, dag_blueprint=blueprint, config=config, writer=log_writer ) # Start runner in background runner.start() # Monitor metrics metrics = runner._metrics print(f"Success rate: {metrics.success_rate:.2%}") print(f"Active DAGs: {runner.active_count()}") print(f"Completed: {metrics.dag_runs_completed}") # Stop gracefully await runner.stop() ``` -------------------------------- ### Initialize and Use MapElitesIsland API in Python Source: https://context7.com/fusionbrainlab/gigaevo-core/llms.txt Demonstrates how to initialize a MapElitesIsland with custom configurations for behavior space, elite selection, and storage. It shows basic operations like adding programs, selecting elites for mutation, retrieving all elites, and selecting migrants for inter-island exchange. Requires Redis for storage. ```python from gigaevo.evolution.strategies.island import MapElitesIsland, IslandConfig from gigaevo.evolution.strategies.models import BehaviorSpace from gigaevo.evolution.strategies.selectors import SumArchiveSelector from gigaevo.evolution.strategies.elite_selectors import FitnessProportionalEliteSelector from gigaevo.evolution.strategies.removers import FitnessArchiveRemover from gigaevo.evolution.strategies.migrant_selectors import TopFitnessMigrantSelector from gigaevo.database.redis_program_storage import RedisProgramStorage # Create behavior space behavior_space = BehaviorSpace( feature_bounds={"fitness": (0.0, 100.0), "validity": (0.0, 1.0)}, resolution={"fitness": 20, "validity": 5}, ) # Configure island config = IslandConfig( island_id="main_island", max_size=100, behavior_space=behavior_space, archive_selector=SumArchiveSelector( fitness_keys=["fitness"], fitness_key_higher_is_better=[True] ), elite_selector=FitnessProportionalEliteSelector( fitness_key="fitness", fitness_key_higher_is_better=True ), archive_remover=FitnessArchiveRemover( fitness_key="fitness", fitness_key_higher_is_better=True ), migrant_selector=TopFitnessMigrantSelector( fitness_key="fitness", fitness_key_higher_is_better=True ), ) # Create island with Redis storage storage = RedisProgramStorage(host="localhost", port=6379, db=0) island = MapElitesIsland(config, storage) # Add program to archive (returns True if accepted) accepted = await island.add(program) # Program is mapped to behavior cell based on metrics # Replaces existing elite if it improves the cell # Select elites for mutation elites = await island.select_elites(total=10) # Uses configured elite_selector (fitness-proportional, tournament, etc.) # Get all programs in archive all_elites = await island.get_elites() archive_size = await island.__len__() # Select migrants for inter-island exchange migrants = await island.select_migrants(count=5) ``` -------------------------------- ### Python Prompt Template Generation for LLM Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/problems/prompts/ifbench/task_description.txt This Python function generates a prompt template string designed to guide an LLM in following precise instructions and constraints. The template uses Python format string syntax for placeholders, which will be filled with dataset sample fields at runtime. It ensures that the 'prompt' field is explicitly referenced and guides the LLM to satisfy multiple simultaneous constraints. ```python def entrypoint(): """Returns a prompt template string for LLM. The template guides the LLM to follow precise instructions and constraints, ensuring all required placeholders are referenced and multiple constraints are satisfied. """ prompt_template = """ You are an AI assistant tasked with solving a downstream task based on the following user query and constraints.\n\nUser Query and Constraints:\n{prompt}\n\nPlease process the user query and adhere strictly to all embedded constraints. Ensure your response is coherent, relevant, and satisfies all specified conditions. The output should be free-form text but must satisfy all embedded constraints.\n""" return prompt_template ``` -------------------------------- ### Initialize GigaEvo DAG Builder Backend Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/tools/dag_builder/README.md Commands to set up and run the FastAPI backend server for the DAG builder. This service handles stage registry and export operations. ```bash cd tools/dag_builder pip install fastapi uvicorn pydantic python run.py ``` -------------------------------- ### Configure Early Stopping for Optuna Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/docs/OPTUNA_OPTIMIZATION.md Demonstrates how to enable early stopping in the Optuna optimization stage by setting the early_stopping_patience parameter via the command line. ```bash python run.py pipeline=optuna_opt \ '_optuna_stage_kwargs={config: {early_stopping_patience: 30}}' ``` -------------------------------- ### Implement Adaptive Migration Logic Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/docs/EVOLUTION_STRATEGIES.md Example pseudo-code for dynamically adjusting migration rates based on the stagnation status of an island. ```python if island_has_stagnated(): migration_rate = HIGH else: migration_rate = LOW ``` -------------------------------- ### Configure GigaEvo via Command Line Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/README.md Demonstrates how to override experiment settings, specific parameters, and nested configuration values using the command line interface. ```bash # Override experiment python run.py experiment=full_featured # Override specific settings python run.py problem.name=heilbron max_generations=50 temperature=0.8 # Override nested settings python run.py constants.evolution.mutation_rate=0.3 ``` -------------------------------- ### Implement Custom Stage with Inputs and Outputs Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/docs/DAG_SYSTEM.md Demonstrates the creation of a custom stage by defining input and output models, initializing with configuration, and implementing the asynchronous compute method to process data and return typed output. ```python class MyCustomStage(Stage): InputsModel = MyInputs OutputModel = MyOutput cacheable = True # Results can be reused def __init__(self, *, my_config: str, **kwargs): super().__init__(**kwargs) self.my_config = my_config async def compute(self, program: Program) -> MyOutput: # Access validated inputs required = self.params.required_field optional = self.params.optional_field # Your logic result = await expensive_computation(required, optional) # Return typed output return MyOutput( result=result, metadata={"source": self.my_config} ) ``` -------------------------------- ### Define GigaEvo Chain Structure Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/problems/chains/hotpotqa/static/task_description.txt Example of the entrypoint function structure required to define a chain, including system prompts and a sequence of LLM and tool steps. ```python def entrypoint(): return { "system_prompt": "You are an expert researcher.", "steps": [ { "number": 1, "title": "Retrieve first-hop passages", "step_type": "tool", "dependencies": [], "frozen": True, "step_config": { "tool_name": "retrieve", "input_mapping": {"query": "$outer_context"} } }, { "number": 2, "title": "Summarize first-hop passages", "step_type": "llm", "dependencies": [1], "frozen": False, "aim": "Extract key facts from retrieved passages.", "stage_action": "Summarize the provided passages relevant to the query.", "reasoning_questions": "What are the key entities?", "example_reasoning": "The passage mentions X, which relates to Y." } ] } ``` -------------------------------- ### Troubleshooting and managing GigaEvo configurations Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/docs/USAGE.md Provides common command-line interface commands for listing profiles, running experiments with overrides, and inspecting configuration files. ```bash # List available profiles ls config/profiles/ # Run with specific overrides python run_hydra.py problem.name=toy_example llm=heterogeneous # Inspect a profile file cat config/profiles/base.yaml ``` -------------------------------- ### Program Metadata in Multi-Island Evolution Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/docs/ARCHITECTURE.md Shows an example of program metadata used to track island membership, iteration count, and mutation context within the multi-island evolutionary system. ```python program.metadata = { "home_island": "fitness_island", # Where created "current_island": "simplicity_island", # Where currently lives "iteration": 42, "mutation_context": "...", } ``` -------------------------------- ### Run and Compare GigaEvo Experiments Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/tools/README.md Demonstrates how to execute multiple experiment configurations using run.py and compare their results using the comparison.py tool. The comparison tool aggregates data from specified Redis databases and saves the output to a designated folder. ```bash python run.py problem.name=test redis.db=10 experiment=base python run.py problem.name=test redis.db=11 experiment=multi_island_complexity python run.py problem.name=test redis.db=12 experiment=full_featured python tools/comparison.py \ --run "test@10:Base" \ --run "test@11:Multi_Island" \ --run "test@12:Full_Featured" \ --output-folder results/experiment_comparison ``` -------------------------------- ### DAG Data Flow Example Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/docs/ARCHITECTURE.md Demonstrates a specific data flow edge within the DAG pipeline, showing how the output of the ExecuteProgram stage is passed as input to the ValidateOutput stage. ```text ExecuteProgram.OutputModel = Box[np.ndarray] ↓ DataFlowEdge(source="ExecuteProgram", dest="ValidateOutput", input_name="payload") ValidateOutput.InputsModel.payload: Box[np.ndarray] **How to find input_name**: Look at the destination stage's `InputsModel` class. ``` -------------------------------- ### GigaEvo Core Entrypoint Function Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/problems/chains/ifbench/static/task_description.txt This Python snippet shows the structure of the `entrypoint` function for the GigaEvo Core project. It is responsible for returning a dictionary containing a 'system_prompt' and a list of 'steps'. Each step in the list is a dictionary with metadata including 'number', 'title', 'step_type', and 'dependencies'. LLM steps are further detailed with 'aim', 'stage_action', 'reasoning_questions', and 'example_reasoning', along with a 'frozen' boolean field. ```python def entrypoint(): # ... implementation details ... return { "system_prompt": "string", "steps": [ { "number": int, "title": "string", "step_type": "string", "dependencies": [int], # LLM specific fields if step_type is 'llm' "aim": "string", "stage_action": "string", "reasoning_questions": "string", "example_reasoning": "string", "frozen": bool } ] } ``` -------------------------------- ### Hydra Configuration and Partial Instantiation Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/docs/ARCHITECTURE.md Demonstrates the use of Hydra for dependency injection and the _partial_ flag for creating object factories in the DAG blueprint. ```yaml dag_blueprint: _target_: gigaevo.runner.dag_blueprint.DAGBlueprint nodes: ValidateCode: _target_: gigaevo.programs.stages.validation.ValidateCodeStage _partial_: true timeout: 30.0 ``` ```python # _partial_: true creates a factory: lambda: ValidateCodeStage(timeout=30.0) # _partial_: false creates a singleton: ValidateCodeStage(timeout=30.0) ``` -------------------------------- ### Manage Problems and Experiments Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/README.md Commands for generating problem scaffolding using the wizard and running custom experiments. ```bash # Generate problem with wizard python -m tools.wizard heilbron.yaml # Run custom problem python run.py problem.name=my_problem # Run custom experiment python run.py experiment=my_experiment ``` -------------------------------- ### Implement Adaptive Multi-Island Creation Source: https://github.com/fusionbrainlab/gigaevo-core/blob/main/docs/EVOLUTION_STRATEGIES.md Demonstrates how to dynamically create new islands at runtime when programs do not fit well into existing ones based on a fitness threshold. ```python class AdaptiveMultiIsland(MapElitesMultiIsland): async def add(self, program: Program) -> bool: best_fit_score = max( await self._compute_fit_score(program, island) for island in self.islands.values() ) if best_fit_score < THRESHOLD: new_island = self._create_island_for_program(program) self.islands[new_island.id] = new_island logger.info(f"Created new island: {new_island.id}") return await super().add(program) ```