genetic-algorithm-optimizer
Genetic algorithm skill for complex optimization problems with non-linear objectives or discontinuous search spaces
What this skill does
# Genetic Algorithm Optimizer
## Overview
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.
## Capabilities
- Chromosome encoding (binary, real, permutation)
- Selection operators (tournament, roulette, rank)
- Crossover and mutation operations
- Multi-objective optimization (NSGA-II, NSGA-III)
- Constraint handling
- Parameter tuning guidance
- Convergence monitoring
- Pareto front visualization
## Used By Processes
- Prescriptive Analytics and Optimization
- Strategic Portfolio Optimization
- Design Optimization
## Usage
### Problem Definition
```python
# 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"
}
]
}
```
### GA Configuration
```python
# 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
}
}
```
### Multi-Objective Configuration (NSGA-II)
```python
# 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 Types
| 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 |
## Selection Methods
| 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 |
## Input Schema
```json
{
"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"
}
}
```
## Output Schema
```json
{
"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"]
}
```
## Best Practices
1. Start with larger population for complex landscapes
2. Balance exploration (mutation) and exploitation (crossover)
3. Use problem-specific operators when possible
4. Monitor diversity to avoid premature convergence
5. Run multiple times with different seeds
6. Validate solutions with domain expertise
7. Consider hybrid approaches (GA + local search)
## Constraint Handling
| 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 |
## Multi-Objective Interpretation
For Pareto-optimal solutions:
- All solutions on the front are non-dominated
- Trade-offs exist between objectives
- Decision-maker selects based on preferences
- Use hypervolume for algorithm comparison
## Integration Points
- Feeds into Strategic Options Analyst for strategy optimization
- Connects with Sensitivity Analyzer for robustness testing
- Supports Optimization Specialist agent
- Integrates with Decision Visualization for Pareto fronts
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.