{
  "$defs": {
    "StudyMethod": {
      "additionalProperties": false,
      "description": "propagation: sample every uncertain parameter together (Latin hypercube).\nmorris: elementary effects, to rank the parameters. sobol: first-order and\ntotal variance shares. convergence: the base scenario at a finer step.",
      "properties": {
        "kind": {
          "enum": [
            "propagation",
            "morris",
            "sobol",
            "convergence"
          ],
          "title": "Kind",
          "type": "string"
        },
        "levels": {
          "default": 4,
          "description": "morris: grid levels",
          "maximum": 20,
          "minimum": 2,
          "title": "Levels",
          "type": "integer"
        },
        "refinement": {
          "default": 2.0,
          "description": "convergence: how much finer the step",
          "exclusiveMinimum": 1,
          "title": "Refinement",
          "type": "number"
        },
        "samples": {
          "default": 100,
          "description": "propagation and sobol: base samples",
          "maximum": 100000,
          "minimum": 2,
          "title": "Samples",
          "type": "integer"
        },
        "tolerance": {
          "default": 0.01,
          "description": "convergence: relative change accepted",
          "exclusiveMinimum": 0,
          "title": "Tolerance",
          "type": "number"
        },
        "trajectories": {
          "default": 10,
          "description": "morris",
          "maximum": 1000,
          "minimum": 2,
          "title": "Trajectories",
          "type": "integer"
        }
      },
      "required": [
        "kind"
      ],
      "title": "StudyMethod",
      "type": "object"
    },
    "Uncertain": {
      "additionalProperties": false,
      "description": "A parameter whose value is not known exactly, the law it follows, and\nwhere that law comes from.",
      "properties": {
        "basis": {
          "default": "",
          "description": "Where the law comes from: a datasheet, a measurement, a judgement",
          "title": "Basis",
          "type": "string"
        },
        "factor": {
          "anyOf": [
            {
              "exclusiveMinimum": 1,
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "lognormal: the value is within median/factor and median*factor with 95% probability",
          "title": "Factor"
        },
        "high": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "High"
        },
        "law": {
          "enum": [
            "uniform",
            "normal",
            "triangular",
            "lognormal"
          ],
          "title": "Law",
          "type": "string"
        },
        "low": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Low"
        },
        "mean": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Mean"
        },
        "median": {
          "anyOf": [
            {
              "exclusiveMinimum": 0,
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "lognormal: the median",
          "title": "Median"
        },
        "mode": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Mode"
        },
        "name": {
          "minLength": 1,
          "title": "Name",
          "type": "string"
        },
        "std": {
          "anyOf": [
            {
              "exclusiveMinimum": 0,
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "title": "Std"
        }
      },
      "required": [
        "name",
        "law"
      ],
      "title": "Uncertain",
      "type": "object"
    }
  },
  "$id": "mokili.study/1",
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "additionalProperties": false,
  "description": "What an uncertain or finer run of a scenario changes, for the outputs\nand requirements that matter.",
  "properties": {
    "base": {
      "description": "The scenario every sample starts from",
      "pattern": "^sha256:[0-9a-f]{64}$",
      "title": "Base",
      "type": "string"
    },
    "confidence": {
      "default": 0.95,
      "exclusiveMaximum": 1,
      "exclusiveMinimum": 0,
      "title": "Confidence",
      "type": "number"
    },
    "method": {
      "$ref": "#/$defs/StudyMethod"
    },
    "name": {
      "minLength": 1,
      "title": "Name",
      "type": "string"
    },
    "outputs": {
      "description": "Summaries of the result to study, e.g. max:h",
      "items": {
        "type": "string"
      },
      "minItems": 1,
      "title": "Outputs",
      "type": "array"
    },
    "requirements": {
      "default": [],
      "items": {
        "pattern": "^sha256:[0-9a-f]{64}$",
        "type": "string"
      },
      "title": "Requirements",
      "type": "array"
    },
    "schema": {
      "const": "mokili.study/1",
      "title": "Schema",
      "type": "string"
    },
    "seed": {
      "default": 0,
      "description": "Seeds the sampling, so a study is reproducible",
      "minimum": 0,
      "title": "Seed",
      "type": "integer"
    },
    "uncertain": {
      "default": [],
      "items": {
        "$ref": "#/$defs/Uncertain"
      },
      "title": "Uncertain",
      "type": "array"
    }
  },
  "required": [
    "schema",
    "name",
    "base",
    "method",
    "outputs"
  ],
  "title": "Study",
  "type": "object"
}
