|
| 1 | +# Project Structure |
| 2 | + |
| 3 | +## Root Directory Layout |
| 4 | +``` |
| 5 | +pymoo/ # Main package directory |
| 6 | +├── algorithms/ # Optimization algorithms (MOO, SOO) |
| 7 | +├── core/ # Core framework classes and interfaces |
| 8 | +├── problems/ # Test problems and problem definitions |
| 9 | +├── operators/ # Genetic operators (crossover, mutation, selection) |
| 10 | +├── indicators/ # Performance metrics and indicators |
| 11 | +├── visualization/ # Plotting and visualization tools |
| 12 | +├── gradient/ # Gradient computation utilities |
| 13 | +├── constraints/ # Constraint handling mechanisms |
| 14 | +├── termination/ # Termination criteria |
| 15 | +├── util/ # Utility functions and helpers |
| 16 | +└── functions/ # Compiled performance-critical functions |
| 17 | +
|
| 18 | +examples/ # Usage examples and tutorials |
| 19 | +tests/ # Test suite |
| 20 | +docs/ # Documentation source |
| 21 | +benchmark/ # Performance benchmarking scripts |
| 22 | +``` |
| 23 | + |
| 24 | +## Core Architecture Patterns |
| 25 | + |
| 26 | +### Problem Definition |
| 27 | +- Base class: `pymoo.core.problem.Problem` |
| 28 | +- Elementwise problems: `ElementwiseProblem` for single-point evaluation |
| 29 | +- Meta problems: `MetaProblem` for problem composition |
| 30 | +- All problems define `n_var`, `n_obj`, `n_constr`, `xl`, `xu` attributes |
| 31 | + |
| 32 | +### Algorithm Structure |
| 33 | +- Base class: `pymoo.core.algorithm.Algorithm` |
| 34 | +- Algorithms follow ask-and-tell pattern |
| 35 | +- Modular design with interchangeable operators |
| 36 | +- Support for both population-based and single-point methods |
| 37 | + |
| 38 | +### Operator Pattern |
| 39 | +- All operators inherit from `pymoo.core.operator.Operator` |
| 40 | +- Crossover, mutation, selection, sampling operators |
| 41 | +- Configurable and composable design |
| 42 | + |
| 43 | +### Data Structures |
| 44 | +- `Population`: Collection of individuals |
| 45 | +- `Individual`: Single solution with variables, objectives, constraints |
| 46 | +- `Result`: Optimization result container |
| 47 | + |
| 48 | +## File Organization Conventions |
| 49 | + |
| 50 | +### Algorithm Files |
| 51 | +- Multi-objective: `pymoo/algorithms/moo/` |
| 52 | +- Single-objective: `pymoo/algorithms/soo/` |
| 53 | +- Each algorithm in separate module with descriptive name |
| 54 | + |
| 55 | +### Problem Files |
| 56 | +- Multi-objective: `pymoo/problems/multi/` |
| 57 | +- Single-objective: `pymoo/problems/single/` |
| 58 | +- Many-objective: `pymoo/problems/many/` |
| 59 | +- Dynamic problems: `pymoo/problems/dynamic/` |
| 60 | + |
| 61 | +### Example Structure |
| 62 | +- Organized by category in `examples/` subdirectories |
| 63 | +- Each example is self-contained and executable |
| 64 | +- Integration tests run examples as validation |
| 65 | + |
| 66 | +### Test Organization |
| 67 | +- Mirror package structure in `tests/` |
| 68 | +- Separate test categories using pytest markers |
| 69 | +- Performance tests in `benchmark/` directory |
| 70 | + |
| 71 | +## Import Conventions |
| 72 | +- Main API accessible via `from pymoo.optimize import minimize` |
| 73 | +- Algorithm imports: `from pymoo.algorithms.moo.nsga2 import NSGA2` |
| 74 | +- Problem imports: `from pymoo.problems import get_problem` |
| 75 | +- Utility imports follow full module path |
0 commit comments