JSON Schemas


Starting from pydantic models makes it easy to generate JSON-Schema or OpenAPI.

Simulation Schema


The Simulation model is the result of running the engine.

Summary
{
  "$defs": {
    "FormulaeResult": {
      "description": "FormulaeResult partitions Formulae as True/False.\n\nThis is part of a Simulation object, only available after\nmodel- check runs.",
      "properties": {
        "true": {
          "default": [],
          "description": "true",
          "items": {
            "type": "string"
          },
          "title": "True",
          "type": "array"
        },
        "false": {
          "default": [],
          "description": "false",
          "items": {
            "type": "string"
          },
          "title": "False",
          "type": "array"
        }
      },
      "title": "FormulaeResult",
      "type": "object"
    },
    "SimMetadata": {
      "description": "SimMetadata describes status-related metadata from a\nsimulation.\n\nThis is part of a Simulation object, only available after\nmodel- check runs.",
      "properties": {
        "file": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "format": "path",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "File associated with this specification",
          "title": "File"
        },
        "engine": {
          "default": "mcmas",
          "description": "The engine that will be used for this specification",
          "title": "Engine",
          "type": "string"
        },
        "parser": {
          "default": "mcmas.parser",
          "description": "The parser that will be used for this specification",
          "title": "Parser",
          "type": "string"
        },
        "exit_code": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Posix exit code from the sim process",
          "title": "Exit Code"
        },
        "deadlock": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Whether this simulation deadlocked",
          "title": "Deadlock"
        },
        "validates": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Whether this specification parsed successfully *and* had only has True facts",
          "title": "Validates"
        },
        "parsed": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Whether or not the Specification parsed successfully",
          "title": "Parsed"
        },
        "timing": {
          "additionalProperties": true,
          "default": {},
          "description": "Timing details for execution, compilation, etc",
          "title": "Timing",
          "type": "object"
        }
      },
      "title": "SimMetadata",
      "type": "object"
    }
  },
  "description": "A Simulation object is the result of having run a spec.\n\nIn practice a Simulation in `py-mcmas` is always an ISPL program\nrunning on an MCMAS engine, but see `SimBase` for something more\ngeneric.",
  "properties": {
    "text": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "items": {},
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "text",
      "title": "Text"
    },
    "error": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "items": {},
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "error",
      "title": "Error"
    },
    "metadata": {
      "$ref": "#/$defs/SimMetadata",
      "default": {
        "file": null,
        "engine": "mcmas",
        "parser": "mcmas.parser",
        "exit_code": null,
        "deadlock": null,
        "validates": null,
        "parsed": null,
        "timing": {}
      },
      "description": "model"
    },
    "state_space": {
      "additionalProperties": true,
      "default": {},
      "description": "",
      "title": "State Space",
      "type": "object"
    },
    "witnesses": {
      "anyOf": [
        {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Witnesses, counter-examples, traces.  These are obtained by parsing mcmas .info files.  By default witnesses cover as many facts as possible; Use instead `counter_examples` to limit this to only FALSE statements.",
      "title": "Witnesses"
    },
    "facts": {
      "$ref": "#/$defs/FormulaeResult",
      "default": {
        "true": [],
        "false": []
      },
      "description": "Input formulae partitioned as true / false"
    }
  },
  "title": "Simulation",
  "type": "object"
}

ISPL Specification Schema


The ISPL model is the central abstraction for wrapping ISPL expressions and programs. You can run such a model using the engine.

Summary

Agent Schema


The Agent model implements the Agent primitive.

Summary
{
  "$defs": {
    "SpecificationMetadata": {
      "description": "Metadata for this Specification.",
      "properties": {
        "file": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "format": "path",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "File associated with this specification",
          "title": "File"
        },
        "engine": {
          "default": "mcmas",
          "description": "The engine that will be used for this specification",
          "title": "Engine",
          "type": "string"
        },
        "parser": {
          "default": "mcmas.parser",
          "description": "The parser that will be used for this specification",
          "title": "Parser",
          "type": "string"
        }
      },
      "title": "SpecificationMetadata",
      "type": "object"
    }
  },
  "description": "Python wrapper for ISPL Agents.\n\nSee also the relevant [ISPL reference](http://mattvonrocketstein.github.io/py-mcmas/isplref/#agent)",
  "properties": {
    "metadata": {
      "$ref": "#/$defs/SpecificationMetadata",
      "default": {
        "file": null,
        "engine": "mcmas",
        "parser": "mcmas.parser"
      },
      "description": "Known metadata about this Specification.\n\n(Updated if/when the specification is analyzed or simulated)"
    },
    "name": {
      "default": "player",
      "description": "Name of this agent",
      "title": "Name",
      "type": "string"
    },
    "actions": {
      "default": [],
      "description": "Defines the set of actions an agent can perform.Visible to all other agents.",
      "items": {
        "type": "string"
      },
      "title": "Actions",
      "type": "array"
    },
    "evolution": {
      "default": [],
      "description": "Defines how an agent's local variables change in response to the actions performed by all agents.",
      "items": {
        "type": "string"
      },
      "title": "Evolution",
      "type": "array"
    },
    "obsvars": {
      "additionalProperties": {
        "type": "string"
      },
      "default": {},
      "description": "Observable variables.  Can be seen by other agents",
      "title": "Obsvars",
      "type": "object"
    },
    "protocol": {
      "additionalProperties": {
        "type": "string"
      },
      "default": [],
      "description": "Action selection rules; how and when an agent can perform specific actions based on its current state",
      "title": "Protocol",
      "type": "object"
    },
    "vars": {
      "anyOf": [
        {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": {},
      "description": "Private variables. Only the Environment can access",
      "title": "Vars"
    },
    "lobsvars": {
      "default": [],
      "description": "",
      "items": {
        "type": "string"
      },
      "title": "Lobsvars",
      "type": "array"
    },
    "red_states": {
      "default": [],
      "description": "",
      "items": {
        "type": "string"
      },
      "title": "Red States",
      "type": "array"
    }
  },
  "title": "Agent",
  "type": "object"
}

Environment Schema


The Environment model implements the Environment primitive.

Summary
{
  "$defs": {
    "SpecificationMetadata": {
      "description": "Metadata for this Specification.",
      "properties": {
        "file": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "format": "path",
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "File associated with this specification",
          "title": "File"
        },
        "engine": {
          "default": "mcmas",
          "description": "The engine that will be used for this specification",
          "title": "Engine",
          "type": "string"
        },
        "parser": {
          "default": "mcmas.parser",
          "description": "The parser that will be used for this specification",
          "title": "Parser",
          "type": "string"
        }
      },
      "title": "SpecificationMetadata",
      "type": "object"
    }
  },
  "description": "Python wrapper for ISPL Environments. Environments model the\nshared information and boundary conditions that all other\nagents can observe.\n\nSee also the relevant [ISPL reference](http://mattvonrocketstein.github.io/py-mcmas/isplref/#environment)",
  "properties": {
    "metadata": {
      "$ref": "#/$defs/SpecificationMetadata",
      "default": {
        "file": null,
        "engine": "mcmas",
        "parser": "mcmas.parser"
      },
      "description": "Known metadata about this Specification.\n\n(Updated if/when the specification is analyzed or simulated)"
    },
    "actions": {
      "default": [],
      "description": "Defines the set of actions an agent can perform.Visible to all other agents.",
      "items": {
        "type": "string"
      },
      "title": "Actions",
      "type": "array"
    },
    "vars": {
      "anyOf": [
        {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        },
        {
          "type": "null"
        }
      ],
      "default": {},
      "description": "Private variables. Only the Environment can access",
      "title": "Vars"
    },
    "obsvars": {
      "additionalProperties": {
        "type": "string"
      },
      "default": {},
      "description": "Observable variables.  Can be seen by other agents",
      "title": "Obsvars",
      "type": "object"
    },
    "evolution": {
      "default": [],
      "description": "Defines how an agent's local variables change in response to the actions performed by all agents.",
      "items": {
        "type": "string"
      },
      "title": "Evolution",
      "type": "array"
    },
    "protocol": {
      "additionalProperties": {
        "type": "string"
      },
      "default": [],
      "description": "Action selection rules; how and when an agent can perform specific actions based on its current state",
      "title": "Protocol",
      "type": "object"
    }
  },
  "title": "Environment",
  "type": "object"
}