Files
Atomizer/optimization_engine/schemas/atomizer_spec_v2.json

801 lines
21 KiB
JSON
Raw Normal View History

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://atomizer.io/schemas/atomizer_spec_v2.json",
"title": "AtomizerSpec v2.0",
"description": "Unified configuration schema for Atomizer optimization studies. This is the single source of truth used by Canvas, Backend, Claude, and the Optimization Engine.",
"type": "object",
"required": ["meta", "model", "design_variables", "extractors", "objectives", "optimization"],
"properties": {
"meta": {
"$ref": "#/definitions/meta"
},
"model": {
"$ref": "#/definitions/model"
},
"design_variables": {
"type": "array",
"description": "Design variables (NX expressions) to optimize",
"minItems": 1,
"maxItems": 50,
"items": {
"$ref": "#/definitions/design_variable"
}
},
"extractors": {
"type": "array",
"description": "Physics extractors that compute outputs from FEA results",
"minItems": 1,
"items": {
"$ref": "#/definitions/extractor"
}
},
"objectives": {
"type": "array",
"description": "Optimization objectives (minimize/maximize)",
"minItems": 1,
"maxItems": 5,
"items": {
"$ref": "#/definitions/objective"
}
},
"constraints": {
"type": "array",
"description": "Hard and soft constraints",
"items": {
"$ref": "#/definitions/constraint"
}
},
"optimization": {
"$ref": "#/definitions/optimization"
},
"workflow": {
"$ref": "#/definitions/workflow"
},
"reporting": {
"$ref": "#/definitions/reporting"
},
"canvas": {
"$ref": "#/definitions/canvas"
}
},
"definitions": {
"meta": {
"type": "object",
"description": "Metadata about the spec",
"required": ["version", "study_name"],
"properties": {
"version": {
"type": "string",
"description": "Schema version",
"pattern": "^2\\.\\d+$",
"examples": ["2.0", "2.1"]
},
"created": {
"type": "string",
"format": "date-time",
"description": "When the spec was created"
},
"modified": {
"type": "string",
"format": "date-time",
"description": "When the spec was last modified"
},
"created_by": {
"type": "string",
"description": "Who/what created the spec",
"enum": ["canvas", "claude", "api", "migration", "manual"]
},
"modified_by": {
"type": "string",
"description": "Who/what last modified the spec"
},
"study_name": {
"type": "string",
"description": "Unique study identifier (snake_case)",
"pattern": "^[a-z0-9_]+$",
"minLength": 3,
"maxLength": 100
},
"description": {
"type": "string",
"description": "Human-readable description of the study",
"maxLength": 1000
},
"tags": {
"type": "array",
"description": "Tags for categorization",
"items": {
"type": "string",
"maxLength": 50
}
},
"engineering_context": {
"type": "string",
"description": "Real-world engineering scenario"
}
}
},
"model": {
"type": "object",
"description": "NX model files and configuration",
"required": ["sim"],
"properties": {
"nx_part": {
"type": "object",
"description": "NX geometry part file",
"properties": {
"path": {
"type": "string",
"description": "Path to .prt file"
},
"hash": {
"type": "string",
"description": "File hash for change detection"
},
"idealized_part": {
"type": "string",
"description": "Idealized part filename (_i.prt)"
}
}
},
"fem": {
"type": "object",
"description": "FEM mesh file",
"properties": {
"path": {
"type": "string",
"description": "Path to .fem file"
},
"element_count": {
"type": "integer",
"description": "Number of elements"
},
"node_count": {
"type": "integer",
"description": "Number of nodes"
}
}
},
"sim": {
"type": "object",
"description": "Simulation file",
"required": ["path", "solver"],
"properties": {
"path": {
"type": "string",
"description": "Path to .sim file"
},
"solver": {
"type": "string",
"description": "Solver type",
"enum": ["nastran", "NX_Nastran", "abaqus"]
},
"solution_type": {
"type": "string",
"description": "Solution type (e.g., SOL101)",
"pattern": "^SOL\\d+$"
},
"subcases": {
"type": "array",
"description": "Defined subcases",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"type": {
"type": "string",
"enum": ["static", "modal", "thermal", "buckling"]
}
}
}
}
}
},
"nx_settings": {
"type": "object",
"description": "NX runtime settings",
"properties": {
"nx_install_path": {
"type": "string"
},
"simulation_timeout_s": {
"type": "integer",
"minimum": 60,
"maximum": 7200
},
"auto_start_nx": {
"type": "boolean"
}
}
}
}
},
"design_variable": {
"type": "object",
"description": "A design variable to optimize",
"required": ["id", "name", "expression_name", "type", "bounds"],
"properties": {
"id": {
"type": "string",
"description": "Unique identifier",
"pattern": "^dv_\\d{3}$"
},
"name": {
"type": "string",
"description": "Human-readable name"
},
"expression_name": {
"type": "string",
"description": "NX expression name (must match model)",
"pattern": "^[a-zA-Z_][a-zA-Z0-9_]*$"
},
"type": {
"type": "string",
"description": "Variable type",
"enum": ["continuous", "integer", "categorical"]
},
"bounds": {
"type": "object",
"description": "Value bounds",
"required": ["min", "max"],
"properties": {
"min": {
"type": "number"
},
"max": {
"type": "number"
}
}
},
"baseline": {
"type": "number",
"description": "Current/initial value"
},
"units": {
"type": "string",
"description": "Physical units (mm, deg, etc.)"
},
"step": {
"type": "number",
"description": "Step size for integer/discrete"
},
"enabled": {
"type": "boolean",
"description": "Whether to include in optimization",
"default": true
},
"description": {
"type": "string"
},
"canvas_position": {
"$ref": "#/definitions/position"
}
}
},
"extractor": {
"type": "object",
"description": "Physics extractor that computes outputs from FEA",
"required": ["id", "name", "type", "outputs"],
"properties": {
"id": {
"type": "string",
"description": "Unique identifier",
"pattern": "^ext_\\d{3}$"
},
"name": {
"type": "string",
"description": "Human-readable name"
},
"type": {
"type": "string",
"description": "Extractor type",
"enum": [
"displacement",
"frequency",
"stress",
"mass",
"mass_expression",
"zernike_opd",
"zernike_csv",
"temperature",
"custom_function"
]
},
"builtin": {
"type": "boolean",
"description": "Whether this is a built-in extractor",
"default": true
},
"config": {
"type": "object",
"description": "Type-specific configuration",
"properties": {
"inner_radius_mm": {
"type": "number"
},
"outer_radius_mm": {
"type": "number"
},
"n_modes": {
"type": "integer"
},
"filter_low_orders": {
"type": "integer"
},
"displacement_unit": {
"type": "string"
},
"reference_subcase": {
"type": "integer"
},
"expression_name": {
"type": "string"
},
"mode_number": {
"type": "integer"
},
"element_type": {
"type": "string"
},
"result_type": {
"type": "string"
},
"metric": {
"type": "string"
}
}
},
"function": {
"type": "object",
"description": "Custom function definition (for custom_function type)",
"properties": {
"name": {
"type": "string",
"description": "Function name"
},
"module": {
"type": "string",
"description": "Python module path"
},
"signature": {
"type": "string",
"description": "Function signature"
},
"source_code": {
"type": "string",
"description": "Python source code"
}
}
},
"outputs": {
"type": "array",
"description": "Output values this extractor produces",
"minItems": 1,
"items": {
"type": "object",
"required": ["name"],
"properties": {
"name": {
"type": "string",
"description": "Output name (used by objectives/constraints)"
},
"metric": {
"type": "string",
"description": "Specific metric (max, total, rms, etc.)"
},
"subcase": {
"type": "integer",
"description": "Subcase ID for this output"
},
"units": {
"type": "string"
}
}
}
},
"canvas_position": {
"$ref": "#/definitions/position"
}
}
},
"objective": {
"type": "object",
"description": "Optimization objective",
"required": ["id", "name", "direction", "source"],
"properties": {
"id": {
"type": "string",
"description": "Unique identifier",
"pattern": "^obj_\\d{3}$"
},
"name": {
"type": "string",
"description": "Human-readable name"
},
"direction": {
"type": "string",
"description": "Optimization direction",
"enum": ["minimize", "maximize"]
},
"weight": {
"type": "number",
"description": "Weight for weighted sum (multi-objective)",
"minimum": 0,
"default": 1.0
},
"source": {
"type": "object",
"description": "Where the value comes from",
"required": ["extractor_id", "output_name"],
"properties": {
"extractor_id": {
"type": "string",
"description": "Reference to extractor"
},
"output_name": {
"type": "string",
"description": "Which output from the extractor"
}
}
},
"target": {
"type": "number",
"description": "Target value (for goal programming)"
},
"units": {
"type": "string"
},
"description": {
"type": "string"
},
"canvas_position": {
"$ref": "#/definitions/position"
}
}
},
"constraint": {
"type": "object",
"description": "Hard or soft constraint",
"required": ["id", "name", "type", "operator", "threshold", "source"],
"properties": {
"id": {
"type": "string",
"description": "Unique identifier",
"pattern": "^con_\\d{3}$"
},
"name": {
"type": "string"
},
"type": {
"type": "string",
"description": "Constraint type",
"enum": ["hard", "soft"]
},
"operator": {
"type": "string",
"description": "Comparison operator",
"enum": ["<=", ">=", "<", ">", "=="]
},
"threshold": {
"type": "number",
"description": "Constraint threshold value"
},
"source": {
"type": "object",
"description": "Where the value comes from",
"required": ["extractor_id", "output_name"],
"properties": {
"extractor_id": {
"type": "string"
},
"output_name": {
"type": "string"
}
}
},
"penalty_config": {
"type": "object",
"description": "Penalty method configuration",
"properties": {
"method": {
"type": "string",
"enum": ["linear", "quadratic", "exponential"]
},
"weight": {
"type": "number"
},
"margin": {
"type": "number",
"description": "Soft margin before penalty kicks in"
}
}
},
"description": {
"type": "string"
},
"canvas_position": {
"$ref": "#/definitions/position"
}
}
},
"optimization": {
"type": "object",
"description": "Optimization algorithm configuration",
"required": ["algorithm", "budget"],
"properties": {
"algorithm": {
"type": "object",
"required": ["type"],
"properties": {
"type": {
"type": "string",
"description": "Algorithm type",
"enum": ["TPE", "CMA-ES", "NSGA-II", "RandomSearch", "SAT_v3", "GP-BO"]
},
"config": {
"type": "object",
"description": "Algorithm-specific settings",
"properties": {
"population_size": {
"type": "integer"
},
"n_generations": {
"type": "integer"
},
"mutation_prob": {
"type": ["number", "null"]
},
"crossover_prob": {
"type": "number"
},
"seed": {
"type": "integer"
},
"n_startup_trials": {
"type": "integer"
},
"sigma0": {
"type": "number"
}
}
}
}
},
"budget": {
"type": "object",
"description": "Computational budget",
"properties": {
"max_trials": {
"type": "integer",
"minimum": 1,
"maximum": 10000
},
"max_time_hours": {
"type": "number"
},
"convergence_patience": {
"type": "integer",
"description": "Stop if no improvement for N trials"
}
}
},
"surrogate": {
"type": "object",
"description": "Neural surrogate configuration",
"properties": {
"enabled": {
"type": "boolean"
},
"type": {
"type": "string",
"enum": ["MLP", "GNN", "ensemble"]
},
"config": {
"type": "object",
"properties": {
"n_models": {
"type": "integer"
},
"architecture": {
"type": "array",
"items": {
"type": "integer"
}
},
"train_every_n_trials": {
"type": "integer"
},
"min_training_samples": {
"type": "integer"
},
"acquisition_candidates": {
"type": "integer"
},
"fea_validations_per_round": {
"type": "integer"
}
}
}
}
},
"canvas_position": {
"$ref": "#/definitions/position"
}
}
},
"workflow": {
"type": "object",
"description": "Multi-stage optimization workflow",
"properties": {
"stages": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"algorithm": {
"type": "string"
},
"trials": {
"type": "integer"
},
"purpose": {
"type": "string"
}
}
}
},
"transitions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"from": {
"type": "string"
},
"to": {
"type": "string"
},
"condition": {
"type": "string"
}
}
}
}
}
},
"reporting": {
"type": "object",
"description": "Reporting configuration",
"properties": {
"auto_report": {
"type": "boolean"
},
"report_triggers": {
"type": "array",
"items": {
"type": "string"
}
},
"insights": {
"type": "array",
"items": {
"type": "object",
"properties": {
"type": {
"type": "string"
},
"for_trials": {
"type": "string"
},
"config": {
"type": "object"
}
}
}
}
}
},
"canvas": {
"type": "object",
"description": "Canvas UI state (persisted for reconstruction)",
"properties": {
"layout_version": {
"type": "string"
},
"viewport": {
"type": "object",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
},
"zoom": {
"type": "number"
}
}
},
"edges": {
"type": "array",
"description": "Connections between nodes",
"items": {
"type": "object",
"required": ["source", "target"],
"properties": {
"source": {
"type": "string"
},
"target": {
"type": "string"
},
"sourceHandle": {
"type": "string"
},
"targetHandle": {
"type": "string"
}
}
}
},
"groups": {
"type": "array",
"description": "Node groupings for organization",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"node_ids": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
},
"position": {
"type": "object",
"description": "Canvas position",
"properties": {
"x": {
"type": "number"
},
"y": {
"type": "number"
}
}
}
}
}