{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/untangle-bio/json-schema/untangle-bio-evolutionary-generate-body-schema.json",
  "title": "EvolutionaryGenerateBody",
  "description": "Route generation, on the SAME economic basis as everything else.\n\nThe generator used to cost on `calculate_detailed_tea`'s own defaults - facility_type\n\"chemical\", 8000 h, $100/kg, default tariffs - while the panel resolved pharma_gmp via\ncp.infer_facility_type for the same flowsheet: 1031.91 $/kg against 6410.01, and\n12.73M against 17.11M of capital. The tier difference has to be the fidelity of the\nsimulation, never a different price book.\n\nSince 2026-08-26 neither side infers: the grade is stated by the caller or the\nrequest is refused (_require_facility_type).",
  "x-generated": "2026-11-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/untangle-bio-openapi.json#/components/schemas/EvolutionaryGenerateBody",
  "additionalProperties": false,
  "properties": {
    "annual_operating_hours": {
      "default": 8000,
      "maximum": 8760.0,
      "minimum": 1.0,
      "title": "Annual Operating Hours",
      "type": "integer"
    },
    "annual_product_kg": {
      "anyOf": [
        {
          "exclusiveMinimum": 0.0,
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "description": "Goal mode: the annual output the plant must make, kg/yr. Routes below it are not feasible, so a cost target cannot be reached by making less.",
      "title": "Annual Product Kg"
    },
    "bioreactor_id": {
      "title": "Bioreactor Id",
      "type": "string"
    },
    "bioreactor_params": {
      "additionalProperties": true,
      "default": {},
      "title": "Bioreactor Params",
      "type": "object"
    },
    "co_product_prices_usd_per_kg": {
      "anyOf": [
        {
          "additionalProperties": {
            "maximum": 10000000.0,
            "minimum": 0.0,
            "type": "number"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "description": "Stated selling price per declared co-product, USD/kg.",
      "title": "Co Product Prices Usd Per Kg"
    },
    "co_products": {
      "anyOf": [
        {
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "description": "Target products sold as co-products.",
      "title": "Co Products"
    },
    "cooling_water_price_usd_per_m3": {
      "default": 0.0764,
      "exclusiveMinimum": 0.0,
      "maximum": 10.0,
      "title": "Cooling Water Price Usd Per M3",
      "type": "number"
    },
    "electricity_price_usd_per_kWh": {
      "default": 0.1,
      "exclusiveMinimum": 0.0,
      "maximum": 2.0,
      "title": "Electricity Price Usd Per Kwh",
      "type": "number"
    },
    "excluded_operations": {
      "default": [],
      "items": {
        "type": "string"
      },
      "title": "Excluded Operations",
      "type": "array"
    },
    "facility_type": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Facility Type"
    },
    "feed_basis": {
      "default": "auto",
      "enum": [
        "auto",
        "internal_broth",
        "purchased"
      ],
      "title": "Feed Basis",
      "type": "string"
    },
    "generations": {
      "default": 10,
      "maximum": 50.0,
      "minimum": 0.0,
      "title": "Generations",
      "type": "integer"
    },
    "labor_profile": {
      "default": "us_food",
      "title": "Labor Profile",
      "type": "string"
    },
    "max_cogs_fraction_of_selling_price": {
      "anyOf": [
        {
          "exclusiveMinimum": 0.0,
          "maximum": 1.0,
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "description": "Goal mode: the cost ceiling as a fraction of product_selling_price_usd_per_kg, which must then be sent explicitly.",
      "title": "Max Cogs Fraction Of Selling Price"
    },
    "max_cogs_usd_per_kg": {
      "anyOf": [
        {
          "exclusiveMinimum": 0.0,
          "maximum": 10000000.0,
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "description": "Goal mode: the cost ceiling in USD per kg of pure product.",
      "title": "Max Cogs Usd Per Kg"
    },
    "min_dry_solids_fraction": {
      "anyOf": [
        {
          "exclusiveMinimum": 0.0,
          "maximum": 1.0,
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "description": "Floor on the dry solids (all non-water mass over total mass) of the final stream, within (0, 1]; sets the water ceiling to 1 - this. Purity stays on dry solids. Above the form's own dry solids it tightens any form; below it, only a liquid or wet form judged on dry solids may loosen (a powder, crystal or anhydrous liquid is refused with 422 naming the liquid form to choose). Without min_product_concentration_g_per_l it replaces the default concentration floor; with it, both apply.",
      "title": "Min Dry Solids Fraction"
    },
    "min_product_concentration_g_per_l": {
      "anyOf": [
        {
          "maximum": 2000.0,
          "minimum": 0.0,
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "description": "Floor on the target concentration in the final stream, g/L.",
      "title": "Min Product Concentration G Per L"
    },
    "min_purity": {
      "default": 0.0,
      "title": "Min Purity",
      "type": "number"
    },
    "min_yield": {
      "default": 0.1,
      "title": "Min Yield",
      "type": "number"
    },
    "mode": {
      "default": "explore",
      "enum": [
        "explore",
        "goal"
      ],
      "title": "Mode",
      "type": "string"
    },
    "near_miss_n": {
      "default": 3,
      "description": "Goal mode: how many nearest-miss routes the complete event carries.",
      "maximum": 10.0,
      "minimum": 0.0,
      "title": "Near Miss N",
      "type": "integer"
    },
    "optimization_goal": {
      "default": "balanced",
      "title": "Optimization Goal",
      "type": "string"
    },
    "population_size": {
      "default": 1000,
      "maximum": 5000.0,
      "minimum": 1.0,
      "title": "Population Size",
      "type": "integer"
    },
    "product_form": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Saleable form the route must reach: dry_powder, crystalline_solid, liquid_concentrate, anhydrous_liquid, wet_paste, viable_cells, aqueous. Omit for the conventional form of the product class.",
      "title": "Product Form"
    },
    "product_identity_requested_targets": {
      "items": {
        "type": "string"
      },
      "title": "Product Identity Requested Targets",
      "type": "array"
    },
    "product_identity_warnings": {
      "items": {
        "type": "string"
      },
      "title": "Product Identity Warnings",
      "type": "array"
    },
    "product_selling_price_source": {
      "default": "default",
      "enum": [
        "default",
        "user_supplied"
      ],
      "title": "Product Selling Price Source",
      "type": "string"
    },
    "product_selling_price_usd_per_kg": {
      "default": 100.0,
      "maximum": 10000000.0,
      "minimum": 0.0,
      "title": "Product Selling Price Usd Per Kg",
      "type": "number"
    },
    "removed_products": {
      "default": [],
      "items": {
        "type": "string"
      },
      "title": "Removed Products",
      "type": "array"
    },
    "seed": {
      "title": "Seed",
      "type": "integer"
    },
    "seed_steps": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/GeneratorSeedStep"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Seed Steps"
    },
    "seed_suffix_steps": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/GeneratorSeedStep"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Seed Suffix Steps"
    },
    "steam_price_usd_per_GJ": {
      "default": 18.0,
      "exclusiveMinimum": 0.0,
      "maximum": 200.0,
      "title": "Steam Price Usd Per Gj",
      "type": "number"
    },
    "stream": {
      "additionalProperties": true,
      "title": "Stream",
      "type": "object"
    },
    "stream_closure_warnings": {
      "items": {
        "type": "string"
      },
      "title": "Stream Closure Warnings",
      "type": "array"
    },
    "target_products": {
      "items": {
        "type": "string"
      },
      "title": "Target Products",
      "type": "array"
    },
    "target_provenance": {
      "anyOf": [
        {
          "additionalProperties": {
            "items": {
              "$ref": "#/$defs/TargetProvenanceRoot"
            },
            "type": "array"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "title": "Target Provenance"
    },
    "terminal_streams": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/TerminalStream"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "title": "Terminal Streams"
    },
    "top_n": {
      "default": 5000,
      "maximum": 10000.0,
      "minimum": 1.0,
      "title": "Top N",
      "type": "integer"
    },
    "wastewater_scope": {
      "default": "included",
      "enum": [
        "included",
        "excluded_osbl"
      ],
      "title": "Wastewater Scope",
      "type": "string"
    }
  },
  "required": [
    "stream",
    "target_products"
  ],
  "type": "object",
  "$defs": {
    "GeneratorSeedStep": {
      "additionalProperties": false,
      "description": "One kept canvas step for continue-from-canvas generation.\n\noutlet_handle accepts the canvas vocabulary too: single-output nodes wire\nthrough 'output', which the generator normalises to 'light'.\nproduct_outlets records the DRAWN product deliveries on this step\n({outlet_handle: [product_name, ...]}). A scalar product name remains\naccepted for older clients. The canvas is the authority on which product\nleaves where; simulator exit marks are opinions.",
      "properties": {
        "outlet_handle": {
          "default": "light",
          "title": "Outlet Handle",
          "type": "string"
        },
        "parameters": {
          "additionalProperties": true,
          "default": {},
          "title": "Parameters",
          "type": "object"
        },
        "product_outlets": {
          "additionalProperties": true,
          "default": {},
          "title": "Product Outlets",
          "type": "object"
        },
        "unit_operation_id": {
          "title": "Unit Operation Id",
          "type": "string"
        }
      },
      "required": [
        "unit_operation_id"
      ],
      "title": "GeneratorSeedStep",
      "type": "object"
    },
    "TargetProvenanceRoot": {
      "description": "A real additive source for target mass: external feed or producer step.",
      "properties": {
        "feed_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Feed Id"
        },
        "kind": {
          "enum": [
            "feed",
            "producer"
          ],
          "title": "Kind",
          "type": "string"
        },
        "step_index": {
          "anyOf": [
            {
              "minimum": 0.0,
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "title": "Step Index"
        }
      },
      "required": [
        "kind"
      ],
      "title": "TargetProvenanceRoot",
      "type": "object"
    },
    "TerminalStream": {
      "description": "One terminal edge claiming a fraction of a physical operation outlet.",
      "properties": {
        "fraction": {
          "exclusiveMinimum": 0.0,
          "maximum": 1.0,
          "title": "Fraction",
          "type": "number"
        },
        "output_index": {
          "minimum": 0.0,
          "title": "Output Index",
          "type": "integer"
        },
        "port_id": {
          "minLength": 1,
          "title": "Port Id",
          "type": "string"
        },
        "sink": {
          "enum": [
            "product",
            "waste",
            "vent"
          ],
          "title": "Sink",
          "type": "string"
        },
        "step_index": {
          "minimum": 0.0,
          "title": "Step Index",
          "type": "integer"
        },
        "target_products": {
          "default": [],
          "items": {
            "type": "string"
          },
          "title": "Target Products",
          "type": "array"
        },
        "terminal_id": {
          "minLength": 1,
          "title": "Terminal Id",
          "type": "string"
        }
      },
      "required": [
        "terminal_id",
        "step_index",
        "port_id",
        "output_index",
        "sink",
        "fraction"
      ],
      "title": "TerminalStream",
      "type": "object"
    }
  }
}