Genetic algorithm skill for complex optimization problems with non-linear objectives or discontinuous search spaces
Solves complex optimization problems using evolutionary algorithms for non-linear or discontinuous search spaces.
npx claudepluginhub a5c-ai/babysitterThis skill is limited to using the following tools:
The Genetic Algorithm Optimizer skill provides evolutionary computation capabilities for solving complex optimization problems that are difficult for traditional methods. It handles non-linear, non-convex, discontinuous, and multi-objective optimization through biologically-inspired search strategies.
# Define optimization problem
ga_problem = {
"name": "Portfolio Optimization",
"encoding": "real", # or "binary", "permutation", "integer"
"variables": {
"asset_weights": {
"count": 10,
"bounds": [0, 1],
"constraint": "sum_to_one"
}
},
"objectives": [
{
"name": "maximize_return",
"function": "portfolio_return(weights, expected_returns)",
"direction": "maximize"
},
{
"name": "minimize_risk",
"function": "portfolio_volatility(weights, covariance_matrix)",
"direction": "minimize"
}
],
"constraints": [
{
"name": "min_diversification",
"expression": "max(weights) <= 0.25",
"type": "inequality"
},
{
"name": "sector_limit",
"expression": "sum(tech_weights) <= 0.40",
"type": "inequality"
}
]
}
# Genetic algorithm parameters
ga_config = {
"population_size": 200,
"generations": 500,
"selection": {
"method": "tournament",
"tournament_size": 3
},
"crossover": {
"method": "simulated_binary", # for real encoding
"probability": 0.9,
"eta": 15 # distribution index
},
"mutation": {
"method": "polynomial",
"probability": 0.1,
"eta": 20
},
"elitism": 0.05, # preserve top 5%
"constraint_handling": "penalty", # or "repair", "feasibility_rules"
"termination": {
"max_generations": 500,
"convergence_threshold": 1e-6,
"stall_generations": 50
}
}
# NSGA-II settings
nsga_config = {
"algorithm": "NSGA-II",
"population_size": 100,
"reference_directions": "auto", # for NSGA-III
"diversity_mechanism": "crowding_distance",
"archive": {
"enabled": True,
"max_size": 200
}
}
| Encoding | Best For | Operators |
|---|---|---|
| Binary | Feature selection, discrete choices | One-point, two-point crossover |
| Real | Continuous optimization | SBX, polynomial mutation |
| Permutation | Sequencing, TSP | PMX, order crossover |
| Integer | Discrete with ranges | Uniform crossover |
| Method | Description | Pressure |
|---|---|---|
| Tournament | Random subset competition | Adjustable |
| Roulette | Probability proportional to fitness | High |
| Rank | Probability based on rank | Moderate |
| Stochastic Universal | Even selection distribution | Low |
{
"problem": {
"encoding": "string",
"variables": "object",
"objectives": ["object"],
"constraints": ["object"]
},
"ga_config": {
"population_size": "number",
"generations": "number",
"selection": "object",
"crossover": "object",
"mutation": "object"
},
"multi_objective": {
"algorithm": "NSGA-II|NSGA-III|MOEA/D",
"reference_directions": "object"
},
"output_options": {
"save_history": "boolean",
"pareto_front": "boolean",
"convergence_plot": "boolean"
}
}
{
"best_solution": {
"variables": "object",
"objectives": "object",
"constraint_violation": "number"
},
"pareto_front": [
{
"variables": "object",
"objectives": "object"
}
],
"convergence": {
"generations": ["number"],
"best_fitness": ["number"],
"average_fitness": ["number"],
"diversity": ["number"]
},
"statistics": {
"total_evaluations": "number",
"feasible_solutions": "number",
"hypervolume": "number (multi-objective)"
},
"visualization_paths": ["string"]
}
| Method | Description | Use When |
|---|---|---|
| Penalty | Add penalty term to fitness | Simple constraints |
| Repair | Fix infeasible solutions | Structure known |
| Feasibility Rules | Feasible > infeasible | Many constraints |
| Separate handling | Tournament with constraints | Multi-objective |
For Pareto-optimal solutions:
Activates when the user asks about AI prompts, needs prompt templates, wants to search for prompts, or mentions prompts.chat. Use for discovering, retrieving, and improving prompts.
Search, retrieve, and install Agent Skills from the prompts.chat registry using MCP tools. Use when the user asks to find skills, browse skill catalogs, install a skill for Claude, or extend Claude's capabilities with reusable AI agent components.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.