Genetic Algorithm for Rastrigin Function (Beginner Python)
Implement a beginner-friendly Genetic Algorithm in Python to optimize the Rastrigin function, structured for Jupyter Notebooks with specific configuration, algorithmic constraints (roulette wheel selection, no elitism), and output requirements.
Best use case
Genetic Algorithm for Rastrigin Function (Beginner Python) is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Implement a beginner-friendly Genetic Algorithm in Python to optimize the Rastrigin function, structured for Jupyter Notebooks with specific configuration, algorithmic constraints (roulette wheel selection, no elitism), and output requirements.
Teams using Genetic Algorithm for Rastrigin Function (Beginner Python) should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/genetic-algorithm-for-rastrigin-function-beginner-python/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How Genetic Algorithm for Rastrigin Function (Beginner Python) Compares
| Feature / Agent | Genetic Algorithm for Rastrigin Function (Beginner Python) | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Implement a beginner-friendly Genetic Algorithm in Python to optimize the Rastrigin function, structured for Jupyter Notebooks with specific configuration, algorithmic constraints (roulette wheel selection, no elitism), and output requirements.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Genetic Algorithm for Rastrigin Function (Beginner Python) Implement a beginner-friendly Genetic Algorithm in Python to optimize the Rastrigin function, structured for Jupyter Notebooks with specific configuration, algorithmic constraints (roulette wheel selection, no elitism), and output requirements. ## Prompt # Role & Objective Act as an expert in evolutionary computing and Python education. Your task is to implement and explain a Genetic Algorithm (GA) to optimize the Rastrigin function. # Communication & Style Preferences - Use beginner-friendly Python code. - Use only standard Python libraries (`random`, `math`). Do not use `numpy` or `matplotlib`. - Provide explanations suitable for someone learning the concepts. # Operational Rules & Constraints - **Code Structure**: Organize the code into four distinct sections suitable for Jupyter Notebooks: 1. **Config**: Combine all problem parameters (dimensions `n`, constant `A`, bounds) and algorithm settings (population size, generations, mutation rate, crossover rate) here. 2. **Functions**: Define the Rastrigin function, fitness function, initialization, selection, crossover, and mutation functions. 3. **Evolution**: Run the main loop. 4. **Results**: Output the final results. - **Documentation**: Include Markdown explanations for each section. - **Algorithm Specifics**: - Use **Roulette Wheel Selection** for parent selection. - Use **One-point Crossover**. - Use **Gaussian Mutation**. - **Do not use Elitism**. - Ensure the **population size remains fixed** throughout the generations. - **Output Format**: Print the final population in the format "Individual n: [values]". - **Parameter Mapping**: When explaining the code, clearly map configuration values to their role in the problem (e.g., `n` is the dimension). # Anti-Patterns - Do not use external libraries like numpy or matplotlib. - Do not implement elitism. - Do not allow the population size to fluctuate during execution. ## Triggers - optimize rastrigin function - genetic algorithm rastrigin - beginner genetic algorithm python - roulette wheel selection rastrigin - ga code for rastrigin
Related Skills
prioritize-python-3-10-features
Prioritizes the use of new features available in Python 3.12 and later versions.
cloud-functions
Complete guide for CloudBase cloud functions development - runtime selection, deployment, logging, invocation, and HTTP access configuration.
ARM Template Functions
Expert knowledge for using Azure Resource Manager (ARM) template functions, especially reference(), listKeys(), and resourceId() in subscription-level and nested deployments. Use when working with ARM templates, encountering template validation errors, or implementing cross-scope resource references.
workos-python
Integrate WorkOS AuthKit with Python applications. Adapts to Django, Flask, FastAPI, or vanilla Python. Server-side authentication with redirect-based OAuth flow.
twitter-algorithm-optimizer
Analyze and optimize tweets for maximum reach using Twitter's open-source algorithm insights. Rewrite and edit user tweets to improve engagement and visibility based on how the recommendation system ranks content.
testing-strategy-python
Python/FastAPI/Django testing conventions. pytest, fixtures, httpx, TestClient, factory_boy. Use when writing or reviewing Python tests.
temporal-python-pro
Master Temporal workflow orchestration with Python SDK. Implements durable workflows, saga patterns, and distributed transactions. Covers async/await, testing strategies, and production deployment.
svelte-remote-functions
Guide for SvelteKit Remote Functions. Use this skill by default for all SvelteKit projects doing type-safe client-server communication with query (data fetching), form (progressive enhancement), command (imperative actions), or data invalidation/refresh patterns.
standards-python
This skill provides Python coding standards and is automatically loaded for Python projects. It includes naming conventions, best practices, and recommended tooling.
sentry-python-setup
Setup Sentry in Python apps. Use when asked to add Sentry to Python, install sentry-sdk, or configure error monitoring for Python applications, Django, Flask, FastAPI.
sentry-python-sdk
Full Sentry SDK setup for Python. Use when asked to "add Sentry to Python", "install sentry-sdk", "setup Sentry in Python", or configure error monitoring, tracing, profiling, logging, metrics, crons, or AI monitoring for Python applications. Supports Django, Flask, FastAPI, Celery, Starlette, AIOHTTP, Tornado, and more.
reviewing-python-architecture
Review ADRs to check they follow testing principles and parent PDR constraints. Use when reviewing ADRs or architecture decisions.