funman.representation package

Submodules

funman.representation.assumption module

Inheritance diagram of funman.representation.assumption

pydantic model funman.representation.assumption.Assumption

Bases: BaseModel

Show JSON schema
{
   "title": "Assumption",
   "type": "object",
   "properties": {
      "constraint": {
         "anyOf": [
            {
               "$ref": "#/$defs/ModelConstraint"
            },
            {
               "$ref": "#/$defs/ParameterConstraint"
            },
            {
               "$ref": "#/$defs/StateVariableConstraint"
            },
            {
               "$ref": "#/$defs/LinearConstraint"
            },
            {
               "$ref": "#/$defs/QueryConstraint"
            }
         ],
         "title": "Constraint"
      }
   },
   "$defs": {
      "FunmanModel": {
         "description": "The abstract base class for Models.",
         "properties": {
            "name": {
               "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
               "title": "Name",
               "type": "string"
            },
            "init_values": {
               "additionalProperties": {
                  "type": "number"
               },
               "default": {},
               "title": "Init Values",
               "type": "object"
            },
            "parameter_bounds": {
               "additionalProperties": {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               },
               "default": {},
               "title": "Parameter Bounds",
               "type": "object"
            }
         },
         "title": "FunmanModel",
         "type": "object"
      },
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      },
      "LinearConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": true,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "timepoints": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Interval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "additive_bounds": {
               "$ref": "#/$defs/Interval"
            },
            "variables": {
               "items": {
                  "type": "string"
               },
               "title": "Variables",
               "type": "array"
            },
            "weights": {
               "anyOf": [
                  {
                     "items": {
                        "anyOf": [
                           {
                              "type": "integer"
                           },
                           {
                              "type": "number"
                           }
                        ]
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Weights"
            },
            "derivative": {
               "default": false,
               "title": "Derivative",
               "type": "boolean"
            }
         },
         "required": [
            "name",
            "additive_bounds",
            "variables"
         ],
         "title": "LinearConstraint",
         "type": "object"
      },
      "ModelConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": false,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "$ref": "#/$defs/FunmanModel"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelConstraint",
         "type": "object"
      },
      "ModelParameter": {
         "additionalProperties": false,
         "description": "A parameter is a free variable for a Model.  It has the following attributes:\n\n* lb: lower bound\n\n* ub: upper bound\n\n* symbol: a pysmt FNode corresponding to the parameter variable",
         "properties": {
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/ModelSymbol"
                  }
               ],
               "title": "Name"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": {
                  "lb": -1.7976931348623157e+308,
                  "ub": 1.7976931348623157e+308,
                  "closed_upper_bound": false,
                  "original_width": Infinity,
                  "normalized": false,
                  "unnormalized_lb": null,
                  "unnormalized_ub": null
               }
            },
            "label": {
               "default": "any",
               "enum": [
                  "any",
                  "all"
               ],
               "title": "Label",
               "type": "string"
            }
         },
         "required": [
            "name"
         ],
         "title": "ModelParameter",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      },
      "ParameterConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": false,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "parameter": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ModelParameter"
                  },
                  {
                     "$ref": "#/$defs/StructureParameter"
                  }
               ],
               "title": "Parameter"
            }
         },
         "required": [
            "name",
            "parameter"
         ],
         "title": "ParameterConstraint",
         "type": "object"
      },
      "Query": {
         "description": "Abstract base class for queries.",
         "properties": {
            "model": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunmanModel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "Query",
         "type": "object"
      },
      "QueryConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": true,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "timepoints": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Interval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "query": {
               "$ref": "#/$defs/Query"
            }
         },
         "required": [
            "name",
            "query"
         ],
         "title": "QueryConstraint",
         "type": "object"
      },
      "StateVariableConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": true,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "timepoints": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Interval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "variable": {
               "title": "Variable",
               "type": "string"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": null
            }
         },
         "required": [
            "name",
            "variable"
         ],
         "title": "StateVariableConstraint",
         "type": "object"
      },
      "StructureParameter": {
         "properties": {
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/ModelSymbol"
                  }
               ],
               "title": "Name"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": {
                  "lb": -1.7976931348623157e+308,
                  "ub": 1.7976931348623157e+308,
                  "closed_upper_bound": false,
                  "original_width": Infinity,
                  "normalized": false,
                  "unnormalized_lb": null,
                  "unnormalized_ub": null
               }
            },
            "label": {
               "default": "any",
               "enum": [
                  "any",
                  "all"
               ],
               "title": "Label",
               "type": "string"
            }
         },
         "required": [
            "name"
         ],
         "title": "StructureParameter",
         "type": "object"
      }
   },
   "required": [
      "constraint"
   ]
}

Fields:
field constraint: ModelConstraint | ParameterConstraint | StateVariableConstraint | LinearConstraint | QueryConstraint [Required]
relevant_at_time(timepoint: int | float) bool

funman.representation.box module

Inheritance diagram of funman.representation.box

pydantic model funman.representation.box.Box

Bases: BaseModel

A Box maps n parameters to intervals, representing an n-dimensional connected open subset of R^n.

Show JSON schema
{
   "title": "Box",
   "description": "A Box maps n parameters to intervals, representing an n-dimensional connected open subset of R^n.",
   "type": "object",
   "properties": {
      "type": {
         "const": "box",
         "default": "box",
         "enum": [
            "box"
         ],
         "title": "Type",
         "type": "string"
      },
      "label": {
         "default": "unknown",
         "enum": [
            "true",
            "false",
            "unknown",
            "dropped"
         ],
         "title": "Label",
         "type": "string"
      },
      "bounds": {
         "additionalProperties": {
            "$ref": "#/$defs/Interval"
         },
         "default": {},
         "title": "Bounds",
         "type": "object"
      },
      "explanation": {
         "anyOf": [
            {
               "$ref": "#/$defs/BoxExplanation"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "schedule": {
         "anyOf": [
            {
               "$ref": "#/$defs/EncodingSchedule"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "corner_points": {
         "default": [],
         "items": {
            "$ref": "#/$defs/Point"
         },
         "title": "Corner Points",
         "type": "array"
      },
      "points": {
         "default": [],
         "items": {
            "$ref": "#/$defs/Point"
         },
         "title": "Points",
         "type": "array"
      }
   },
   "$defs": {
      "Assumption": {
         "properties": {
            "constraint": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ModelConstraint"
                  },
                  {
                     "$ref": "#/$defs/ParameterConstraint"
                  },
                  {
                     "$ref": "#/$defs/StateVariableConstraint"
                  },
                  {
                     "$ref": "#/$defs/LinearConstraint"
                  },
                  {
                     "$ref": "#/$defs/QueryConstraint"
                  }
               ],
               "title": "Constraint"
            }
         },
         "required": [
            "constraint"
         ],
         "title": "Assumption",
         "type": "object"
      },
      "BoxExplanation": {
         "properties": {
            "expression": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Expression"
            },
            "symbols": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Symbols"
            },
            "relevant_assumptions": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/Assumption"
               },
               "title": "Relevant Assumptions",
               "type": "array"
            }
         },
         "title": "BoxExplanation",
         "type": "object"
      },
      "EncodingSchedule": {
         "properties": {
            "timepoints": {
               "items": {
                  "anyOf": [
                     {
                        "type": "integer"
                     },
                     {
                        "type": "number"
                     }
                  ]
               },
               "title": "Timepoints",
               "type": "array"
            }
         },
         "required": [
            "timepoints"
         ],
         "title": "EncodingSchedule",
         "type": "object"
      },
      "FunmanModel": {
         "description": "The abstract base class for Models.",
         "properties": {
            "name": {
               "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
               "title": "Name",
               "type": "string"
            },
            "init_values": {
               "additionalProperties": {
                  "type": "number"
               },
               "default": {},
               "title": "Init Values",
               "type": "object"
            },
            "parameter_bounds": {
               "additionalProperties": {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               },
               "default": {},
               "title": "Parameter Bounds",
               "type": "object"
            }
         },
         "title": "FunmanModel",
         "type": "object"
      },
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      },
      "LinearConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": true,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "timepoints": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Interval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "additive_bounds": {
               "$ref": "#/$defs/Interval"
            },
            "variables": {
               "items": {
                  "type": "string"
               },
               "title": "Variables",
               "type": "array"
            },
            "weights": {
               "anyOf": [
                  {
                     "items": {
                        "anyOf": [
                           {
                              "type": "integer"
                           },
                           {
                              "type": "number"
                           }
                        ]
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Weights"
            },
            "derivative": {
               "default": false,
               "title": "Derivative",
               "type": "boolean"
            }
         },
         "required": [
            "name",
            "additive_bounds",
            "variables"
         ],
         "title": "LinearConstraint",
         "type": "object"
      },
      "ModelConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": false,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "$ref": "#/$defs/FunmanModel"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelConstraint",
         "type": "object"
      },
      "ModelParameter": {
         "additionalProperties": false,
         "description": "A parameter is a free variable for a Model.  It has the following attributes:\n\n* lb: lower bound\n\n* ub: upper bound\n\n* symbol: a pysmt FNode corresponding to the parameter variable",
         "properties": {
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/ModelSymbol"
                  }
               ],
               "title": "Name"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": {
                  "lb": -1.7976931348623157e+308,
                  "ub": 1.7976931348623157e+308,
                  "closed_upper_bound": false,
                  "original_width": Infinity,
                  "normalized": false,
                  "unnormalized_lb": null,
                  "unnormalized_ub": null
               }
            },
            "label": {
               "default": "any",
               "enum": [
                  "any",
                  "all"
               ],
               "title": "Label",
               "type": "string"
            }
         },
         "required": [
            "name"
         ],
         "title": "ModelParameter",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      },
      "ParameterConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": false,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "parameter": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ModelParameter"
                  },
                  {
                     "$ref": "#/$defs/StructureParameter"
                  }
               ],
               "title": "Parameter"
            }
         },
         "required": [
            "name",
            "parameter"
         ],
         "title": "ParameterConstraint",
         "type": "object"
      },
      "Point": {
         "properties": {
            "type": {
               "const": "point",
               "default": "point",
               "enum": [
                  "point"
               ],
               "title": "Type",
               "type": "string"
            },
            "label": {
               "default": "unknown",
               "enum": [
                  "true",
                  "false",
                  "unknown",
                  "dropped"
               ],
               "title": "Label",
               "type": "string"
            },
            "values": {
               "additionalProperties": {
                  "anyOf": [
                     {
                        "type": "number"
                     },
                     {
                        "type": "integer"
                     },
                     {
                        "$ref": "#/$defs/EncodingSchedule"
                     },
                     {
                        "type": "null"
                     }
                  ]
               },
               "title": "Values",
               "type": "object"
            },
            "normalized_values": {
               "anyOf": [
                  {
                     "additionalProperties": {
                        "type": "number"
                     },
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Normalized Values"
            },
            "schedule": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/EncodingSchedule"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "simulation": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Timeseries"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "values"
         ],
         "title": "Point",
         "type": "object"
      },
      "Query": {
         "description": "Abstract base class for queries.",
         "properties": {
            "model": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunmanModel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "Query",
         "type": "object"
      },
      "QueryConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": true,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "timepoints": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Interval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "query": {
               "$ref": "#/$defs/Query"
            }
         },
         "required": [
            "name",
            "query"
         ],
         "title": "QueryConstraint",
         "type": "object"
      },
      "StateVariableConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": true,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "timepoints": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Interval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "variable": {
               "title": "Variable",
               "type": "string"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": null
            }
         },
         "required": [
            "name",
            "variable"
         ],
         "title": "StateVariableConstraint",
         "type": "object"
      },
      "StructureParameter": {
         "properties": {
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/ModelSymbol"
                  }
               ],
               "title": "Name"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": {
                  "lb": -1.7976931348623157e+308,
                  "ub": 1.7976931348623157e+308,
                  "closed_upper_bound": false,
                  "original_width": Infinity,
                  "normalized": false,
                  "unnormalized_lb": null,
                  "unnormalized_ub": null
               }
            },
            "label": {
               "default": "any",
               "enum": [
                  "any",
                  "all"
               ],
               "title": "Label",
               "type": "string"
            }
         },
         "required": [
            "name"
         ],
         "title": "StructureParameter",
         "type": "object"
      },
      "Timeseries": {
         "properties": {
            "data": {
               "items": {
                  "anyOf": [
                     {
                        "type": "number"
                     },
                     {
                        "items": {
                           "type": "number"
                        },
                        "type": "array"
                     }
                  ]
               },
               "title": "Data",
               "type": "array"
            },
            "columns": {
               "items": {
                  "type": "string"
               },
               "title": "Columns",
               "type": "array"
            }
         },
         "required": [
            "data",
            "columns"
         ],
         "title": "Timeseries",
         "type": "object"
      }
   }
}

Fields:
field bounds: Dict[str, Interval] = {}
field corner_points: List[Point] = []
field explanation: BoxExplanation | None = None
field label: Literal['true', 'false', 'unknown', 'dropped'] = 'unknown'
field points: List[Point] = []
field schedule: EncodingSchedule | None = None
field type: Literal['box'] = 'box'
add_point(point: Point) None
advance()
contains(other: Box) bool

Does the interval for each parameter in self contain the interval for the corresponding parameter in other?

Parameters:

other (Box) – other box

Returns:

self contains other

Return type:

bool

contains_point(point: Point, denormalize_bounds: bool = False) bool

Does the box contain a point?

Parameters:
  • point (Point) – a point

  • denormalize_bounds (bool) – if true, and self has unnormalized_lb and unormalized_ub, use these insead of lb and ub.

Returns:

the box contains the point

Return type:

bool

corners(parameters: List[Parameter] | None = None) List[Point]
current_step() Box
equal(b2: Box, param_list: List[str] | None = None) bool

Are two boxes equal, considering only parameters in param_list?

Parameters:
  • b1 (Box) – box 1

  • b2 (Box) – box 2

  • param_list (list) – parameters over which to restrict the comparison

Returns:

boxes are equal

Return type:

bool

explain() BoxExplanation
false_points(step=None) List[Point]
finite() bool

Are all parameter intervals finite?

Returns:

all parameter intervals are finite

Return type:

bool

static from_point(point: Point, radius: float | None = None, radius_vars=None) Box
intersection(other: Box, param_list=None) Box | None

Return the intersection of two boxes (which is also a box)

Parameters:

other (Box) – other box

Returns:

self intersected with other

Return type:

Box

intersects(other: Box) bool

Does self and other intersect? I.e., do all parameter intervals instersect?

Parameters:

other (Box) – other box

Returns:

self intersects other

Return type:

bool

model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

normalized_volume(parameters: List[ModelParameter] | None = None)
normalized_width(parameters: List[ModelParameter] | None = None)
point_entropy(bias=1.0) float

Calculate the entropy of a box in terms of the point labels. Assumes only binary labels, so that p = |true|/(|true|+|false|), and the entropy is H = -(p log p) - ((1-p) log (1-p))

bias: inverse weight given to positive points

Returns:

Entropy of the box

Return type:

float

project(vars: List[ModelParameter] | List[str]) Box

Takes a subset of selected variables (vars_list) of a given box (b) and returns another box that is given by b’s values for only the selected variables.

Parameters:

vars (Union[List[ModelParameter], List[str]]) – variables to project onto

Returns:

projected box

Return type:

Box

split(points: List[List[Point]] | None = None, normalize: Dict[str, float] = {}, parameters=[])

Split box along max width dimension. If points are provided, then pick the axis where the points are maximally distant.

Parameters:

points (List[Point], optional) – solution points that the split will separate, by default None

Returns:

Boxes resulting from the split.

Return type:

List[Box]

symm_diff(b2: Box)
timestep() Interval
true_points(step=None) List[Point]
variance(overwrite_cache=False) float

The variance of a box is the maximum variance of a parameter interval. STUB for Milestone 8 sensitivity analysis

Returns:

Variance{p: parameter}

Return type:

float

volume(normalize=False, parameters: List[ModelParameter] | None = None, *, ignore_zero_width_dimensions=True) Decimal
width(normalize=False, parameters: List[ModelParameter] | None = None) float

The width of a box is the maximum width of a parameter interval.

Returns:

Max{p: parameter}(p.ub-p.lb)

Return type:

float

funman.representation.constraint module

Inheritance diagram of funman.representation.constraint

pydantic model funman.representation.constraint.Constraint

Bases: BaseModel

Show JSON schema
{
   "title": "Constraint",
   "type": "object",
   "properties": {
      "soft": {
         "default": true,
         "title": "Soft",
         "type": "boolean"
      },
      "name": {
         "title": "Name",
         "type": "string"
      }
   },
   "required": [
      "name"
   ]
}

Fields:
Validators:
  • check_name » all fields

field name: str [Required]
Validated by:
  • check_name

field soft: bool = True
Validated by:
  • check_name

Constraint.check_name
encodable() bool
model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

relevant_at_time(time: int) bool
time_dependent() bool
pydantic model funman.representation.constraint.LinearConstraint

Bases: TimedConstraint

Show JSON schema
{
   "title": "LinearConstraint",
   "type": "object",
   "properties": {
      "soft": {
         "default": true,
         "title": "Soft",
         "type": "boolean"
      },
      "name": {
         "title": "Name",
         "type": "string"
      },
      "timepoints": {
         "anyOf": [
            {
               "$ref": "#/$defs/Interval"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "additive_bounds": {
         "$ref": "#/$defs/Interval"
      },
      "variables": {
         "items": {
            "type": "string"
         },
         "title": "Variables",
         "type": "array"
      },
      "weights": {
         "anyOf": [
            {
               "items": {
                  "anyOf": [
                     {
                        "type": "integer"
                     },
                     {
                        "type": "number"
                     }
                  ]
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Weights"
      },
      "derivative": {
         "default": false,
         "title": "Derivative",
         "type": "boolean"
      }
   },
   "$defs": {
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "name",
      "additive_bounds",
      "variables"
   ]
}

Config:
  • extra: str = forbid

Fields:
Validators:
field additive_bounds: Interval [Required]
Validated by:
  • check_name

field derivative: bool = False
Validated by:
  • check_name

field soft: bool = True
Validated by:
  • check_name

field variables: List[str] [Required]
Validated by:
  • check_name

field weights: List[int | float] | None[List[int | float] | None] = None
Validated by:
  • check_name

  • check_weights

LinearConstraint.check_weights
model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

next_timestep(timestep: Timestep, schedule: EncodingSchedule) Timestep

Get a Timestep in the timepoints other than that is in timepoints

Parameters:
  • timestep (Timestep) – the reference Timestep

  • schedule (EncodingSchedule) – the timepoints used for the encoding

relevant_at_time(time: int) bool
time_dependent() bool
pydantic model funman.representation.constraint.ModelConstraint

Bases: Constraint

Show JSON schema
{
   "title": "ModelConstraint",
   "type": "object",
   "properties": {
      "soft": {
         "default": false,
         "title": "Soft",
         "type": "boolean"
      },
      "name": {
         "title": "Name",
         "type": "string"
      },
      "model": {
         "$ref": "#/$defs/FunmanModel"
      }
   },
   "$defs": {
      "FunmanModel": {
         "description": "The abstract base class for Models.",
         "properties": {
            "name": {
               "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
               "title": "Name",
               "type": "string"
            },
            "init_values": {
               "additionalProperties": {
                  "type": "number"
               },
               "default": {},
               "title": "Init Values",
               "type": "object"
            },
            "parameter_bounds": {
               "additionalProperties": {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               },
               "default": {},
               "title": "Parameter Bounds",
               "type": "object"
            }
         },
         "title": "FunmanModel",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "name",
      "model"
   ]
}

Config:
  • extra: str = forbid

Fields:
Validators:

field model: FunmanModel [Required]
Validated by:
  • check_name

field soft: bool = False
Validated by:
  • check_name

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

pydantic model funman.representation.constraint.ParameterConstraint

Bases: Constraint

Show JSON schema
{
   "title": "ParameterConstraint",
   "type": "object",
   "properties": {
      "soft": {
         "default": false,
         "title": "Soft",
         "type": "boolean"
      },
      "name": {
         "title": "Name",
         "type": "string"
      },
      "parameter": {
         "anyOf": [
            {
               "$ref": "#/$defs/ModelParameter"
            },
            {
               "$ref": "#/$defs/StructureParameter"
            }
         ],
         "title": "Parameter"
      }
   },
   "$defs": {
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      },
      "ModelParameter": {
         "additionalProperties": false,
         "description": "A parameter is a free variable for a Model.  It has the following attributes:\n\n* lb: lower bound\n\n* ub: upper bound\n\n* symbol: a pysmt FNode corresponding to the parameter variable",
         "properties": {
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/ModelSymbol"
                  }
               ],
               "title": "Name"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": {
                  "lb": -1.7976931348623157e+308,
                  "ub": 1.7976931348623157e+308,
                  "closed_upper_bound": false,
                  "original_width": Infinity,
                  "normalized": false,
                  "unnormalized_lb": null,
                  "unnormalized_ub": null
               }
            },
            "label": {
               "default": "any",
               "enum": [
                  "any",
                  "all"
               ],
               "title": "Label",
               "type": "string"
            }
         },
         "required": [
            "name"
         ],
         "title": "ModelParameter",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      },
      "StructureParameter": {
         "properties": {
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/ModelSymbol"
                  }
               ],
               "title": "Name"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": {
                  "lb": -1.7976931348623157e+308,
                  "ub": 1.7976931348623157e+308,
                  "closed_upper_bound": false,
                  "original_width": Infinity,
                  "normalized": false,
                  "unnormalized_lb": null,
                  "unnormalized_ub": null
               }
            },
            "label": {
               "default": "any",
               "enum": [
                  "any",
                  "all"
               ],
               "title": "Label",
               "type": "string"
            }
         },
         "required": [
            "name"
         ],
         "title": "StructureParameter",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "name",
      "parameter"
   ]
}

Config:
  • extra: str = forbid

Fields:
Validators:

field parameter: ModelParameter | StructureParameter [Required]
Validated by:
  • check_name

field soft: bool = False
Validated by:
  • check_name

encodable() bool
model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

relevant_at_time(time: int) bool
pydantic model funman.representation.constraint.QueryConstraint

Bases: TimedConstraint

Show JSON schema
{
   "title": "QueryConstraint",
   "type": "object",
   "properties": {
      "soft": {
         "default": true,
         "title": "Soft",
         "type": "boolean"
      },
      "name": {
         "title": "Name",
         "type": "string"
      },
      "timepoints": {
         "anyOf": [
            {
               "$ref": "#/$defs/Interval"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "query": {
         "$ref": "#/$defs/Query"
      }
   },
   "$defs": {
      "FunmanModel": {
         "description": "The abstract base class for Models.",
         "properties": {
            "name": {
               "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
               "title": "Name",
               "type": "string"
            },
            "init_values": {
               "additionalProperties": {
                  "type": "number"
               },
               "default": {},
               "title": "Init Values",
               "type": "object"
            },
            "parameter_bounds": {
               "additionalProperties": {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               },
               "default": {},
               "title": "Parameter Bounds",
               "type": "object"
            }
         },
         "title": "FunmanModel",
         "type": "object"
      },
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      },
      "Query": {
         "description": "Abstract base class for queries.",
         "properties": {
            "model": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunmanModel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "Query",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "name",
      "query"
   ]
}

Config:
  • extra: str = forbid

Fields:
Validators:

field query: Query [Required]
Validated by:
  • check_name

field soft: bool = True
Validated by:
  • check_name

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

pydantic model funman.representation.constraint.StateVariableConstraint

Bases: TimedConstraint

Show JSON schema
{
   "title": "StateVariableConstraint",
   "type": "object",
   "properties": {
      "soft": {
         "default": true,
         "title": "Soft",
         "type": "boolean"
      },
      "name": {
         "title": "Name",
         "type": "string"
      },
      "timepoints": {
         "anyOf": [
            {
               "$ref": "#/$defs/Interval"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "variable": {
         "title": "Variable",
         "type": "string"
      },
      "interval": {
         "$ref": "#/$defs/Interval",
         "default": null
      }
   },
   "$defs": {
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "name",
      "variable"
   ]
}

Config:
  • extra: str = forbid

Fields:
Validators:

field interval: Interval = None
Validated by:
  • check_name

field variable: str [Required]
Validated by:
  • check_name

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

pydantic model funman.representation.constraint.TimedConstraint

Bases: Constraint

Show JSON schema
{
   "title": "TimedConstraint",
   "type": "object",
   "properties": {
      "soft": {
         "default": true,
         "title": "Soft",
         "type": "boolean"
      },
      "name": {
         "title": "Name",
         "type": "string"
      },
      "timepoints": {
         "anyOf": [
            {
               "$ref": "#/$defs/Interval"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      }
   },
   "$defs": {
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      }
   },
   "required": [
      "name"
   ]
}

Fields:
Validators:

field timepoints: Interval | None = None
Validated by:
  • check_name

contains_time(time: float | int) bool
model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

relevant_at_time(time: int) bool
time_dependent() bool
pydantic model funman.representation.constraint.TimeseriesConstraint

Bases: Constraint

Show JSON schema
{
   "title": "TimeseriesConstraint",
   "type": "object",
   "properties": {
      "soft": {
         "default": false,
         "title": "Soft",
         "type": "boolean"
      },
      "name": {
         "title": "Name",
         "type": "string"
      },
      "timeseries": {
         "$ref": "#/$defs/Timeseries"
      }
   },
   "$defs": {
      "Timeseries": {
         "properties": {
            "data": {
               "items": {
                  "anyOf": [
                     {
                        "type": "number"
                     },
                     {
                        "items": {
                           "type": "number"
                        },
                        "type": "array"
                     }
                  ]
               },
               "title": "Data",
               "type": "array"
            },
            "columns": {
               "items": {
                  "type": "string"
               },
               "title": "Columns",
               "type": "array"
            }
         },
         "required": [
            "data",
            "columns"
         ],
         "title": "Timeseries",
         "type": "object"
      }
   },
   "required": [
      "name",
      "timeseries"
   ]
}

Fields:
Validators:

field soft: bool = False
Validated by:
  • check_name

field timeseries: Timeseries [Required]
Validated by:
  • check_name

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

funman.representation.encoding_schedule module

Inheritance diagram of funman.representation.encoding_schedule

pydantic model funman.representation.encoding_schedule.EncodingSchedule

Bases: BaseModel

Show JSON schema
{
   "title": "EncodingSchedule",
   "type": "object",
   "properties": {
      "timepoints": {
         "items": {
            "anyOf": [
               {
                  "type": "integer"
               },
               {
                  "type": "number"
               }
            ]
         },
         "title": "Timepoints",
         "type": "array"
      }
   },
   "required": [
      "timepoints"
   ]
}

Fields:
field timepoints: List[int | float] [Required]
static from_steps(num_steps: int, step_size: int | float) EncodingSchedule
stepsize_at_step(step: int) int | float
time_at_step(step: int) int | float

funman.representation.explanation module

Inheritance diagram of funman.representation.explanation

pydantic model funman.representation.explanation.BoxExplanation

Bases: Explanation

Show JSON schema
{
   "title": "BoxExplanation",
   "type": "object",
   "properties": {
      "expression": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Expression"
      },
      "symbols": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Symbols"
      },
      "relevant_assumptions": {
         "default": [],
         "items": {
            "$ref": "#/$defs/Assumption"
         },
         "title": "Relevant Assumptions",
         "type": "array"
      }
   },
   "$defs": {
      "Assumption": {
         "properties": {
            "constraint": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ModelConstraint"
                  },
                  {
                     "$ref": "#/$defs/ParameterConstraint"
                  },
                  {
                     "$ref": "#/$defs/StateVariableConstraint"
                  },
                  {
                     "$ref": "#/$defs/LinearConstraint"
                  },
                  {
                     "$ref": "#/$defs/QueryConstraint"
                  }
               ],
               "title": "Constraint"
            }
         },
         "required": [
            "constraint"
         ],
         "title": "Assumption",
         "type": "object"
      },
      "FunmanModel": {
         "description": "The abstract base class for Models.",
         "properties": {
            "name": {
               "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
               "title": "Name",
               "type": "string"
            },
            "init_values": {
               "additionalProperties": {
                  "type": "number"
               },
               "default": {},
               "title": "Init Values",
               "type": "object"
            },
            "parameter_bounds": {
               "additionalProperties": {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               },
               "default": {},
               "title": "Parameter Bounds",
               "type": "object"
            }
         },
         "title": "FunmanModel",
         "type": "object"
      },
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      },
      "LinearConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": true,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "timepoints": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Interval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "additive_bounds": {
               "$ref": "#/$defs/Interval"
            },
            "variables": {
               "items": {
                  "type": "string"
               },
               "title": "Variables",
               "type": "array"
            },
            "weights": {
               "anyOf": [
                  {
                     "items": {
                        "anyOf": [
                           {
                              "type": "integer"
                           },
                           {
                              "type": "number"
                           }
                        ]
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Weights"
            },
            "derivative": {
               "default": false,
               "title": "Derivative",
               "type": "boolean"
            }
         },
         "required": [
            "name",
            "additive_bounds",
            "variables"
         ],
         "title": "LinearConstraint",
         "type": "object"
      },
      "ModelConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": false,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "$ref": "#/$defs/FunmanModel"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelConstraint",
         "type": "object"
      },
      "ModelParameter": {
         "additionalProperties": false,
         "description": "A parameter is a free variable for a Model.  It has the following attributes:\n\n* lb: lower bound\n\n* ub: upper bound\n\n* symbol: a pysmt FNode corresponding to the parameter variable",
         "properties": {
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/ModelSymbol"
                  }
               ],
               "title": "Name"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": {
                  "lb": -1.7976931348623157e+308,
                  "ub": 1.7976931348623157e+308,
                  "closed_upper_bound": false,
                  "original_width": Infinity,
                  "normalized": false,
                  "unnormalized_lb": null,
                  "unnormalized_ub": null
               }
            },
            "label": {
               "default": "any",
               "enum": [
                  "any",
                  "all"
               ],
               "title": "Label",
               "type": "string"
            }
         },
         "required": [
            "name"
         ],
         "title": "ModelParameter",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      },
      "ParameterConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": false,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "parameter": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ModelParameter"
                  },
                  {
                     "$ref": "#/$defs/StructureParameter"
                  }
               ],
               "title": "Parameter"
            }
         },
         "required": [
            "name",
            "parameter"
         ],
         "title": "ParameterConstraint",
         "type": "object"
      },
      "Query": {
         "description": "Abstract base class for queries.",
         "properties": {
            "model": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunmanModel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "Query",
         "type": "object"
      },
      "QueryConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": true,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "timepoints": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Interval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "query": {
               "$ref": "#/$defs/Query"
            }
         },
         "required": [
            "name",
            "query"
         ],
         "title": "QueryConstraint",
         "type": "object"
      },
      "StateVariableConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": true,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "timepoints": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Interval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "variable": {
               "title": "Variable",
               "type": "string"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": null
            }
         },
         "required": [
            "name",
            "variable"
         ],
         "title": "StateVariableConstraint",
         "type": "object"
      },
      "StructureParameter": {
         "properties": {
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/ModelSymbol"
                  }
               ],
               "title": "Name"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": {
                  "lb": -1.7976931348623157e+308,
                  "ub": 1.7976931348623157e+308,
                  "closed_upper_bound": false,
                  "original_width": Infinity,
                  "normalized": false,
                  "unnormalized_lb": null,
                  "unnormalized_ub": null
               }
            },
            "label": {
               "default": "any",
               "enum": [
                  "any",
                  "all"
               ],
               "title": "Label",
               "type": "string"
            }
         },
         "required": [
            "name"
         ],
         "title": "StructureParameter",
         "type": "object"
      }
   }
}

Fields:
field relevant_assumptions: List[Assumption] = []
check_assumptions(episode: BoxSearchEpisode, my_solver: Callable, options: EncodingOptions) List[Assumption]

Find the assumptions that are unit clauses in the expression (unsat core).

Parameters:
  • episode (BoxSearchEpisode) – _description_

  • my_solver (Callable) – _description_

Returns:

_description_

Return type:

List[Assumption]

explain() Dict[str, Any]
pydantic model funman.representation.explanation.Explanation

Bases: BaseModel

Show JSON schema
{
   "title": "Explanation",
   "type": "object",
   "properties": {
      "expression": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Expression"
      },
      "symbols": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Symbols"
      }
   }
}

Fields:
field expression: str | None = None
field symbols: List[str] | None = None
check_assumptions(episode: BoxSearchEpisode, my_solver: Callable, options: EncodingOptions) List[Assumption]
explain() Dict[str, Any]
set_expression(e: FNode)
pydantic model funman.representation.explanation.ParameterSpaceExplanation

Bases: Explanation

Show JSON schema
{
   "title": "ParameterSpaceExplanation",
   "type": "object",
   "properties": {
      "expression": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Expression"
      },
      "symbols": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Symbols"
      },
      "true_explanations": {
         "default": [],
         "items": {
            "$ref": "#/$defs/BoxExplanation"
         },
         "title": "True Explanations",
         "type": "array"
      },
      "false_explanations": {
         "default": [],
         "items": {
            "$ref": "#/$defs/BoxExplanation"
         },
         "title": "False Explanations",
         "type": "array"
      }
   },
   "$defs": {
      "Assumption": {
         "properties": {
            "constraint": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ModelConstraint"
                  },
                  {
                     "$ref": "#/$defs/ParameterConstraint"
                  },
                  {
                     "$ref": "#/$defs/StateVariableConstraint"
                  },
                  {
                     "$ref": "#/$defs/LinearConstraint"
                  },
                  {
                     "$ref": "#/$defs/QueryConstraint"
                  }
               ],
               "title": "Constraint"
            }
         },
         "required": [
            "constraint"
         ],
         "title": "Assumption",
         "type": "object"
      },
      "BoxExplanation": {
         "properties": {
            "expression": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Expression"
            },
            "symbols": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Symbols"
            },
            "relevant_assumptions": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/Assumption"
               },
               "title": "Relevant Assumptions",
               "type": "array"
            }
         },
         "title": "BoxExplanation",
         "type": "object"
      },
      "FunmanModel": {
         "description": "The abstract base class for Models.",
         "properties": {
            "name": {
               "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
               "title": "Name",
               "type": "string"
            },
            "init_values": {
               "additionalProperties": {
                  "type": "number"
               },
               "default": {},
               "title": "Init Values",
               "type": "object"
            },
            "parameter_bounds": {
               "additionalProperties": {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               },
               "default": {},
               "title": "Parameter Bounds",
               "type": "object"
            }
         },
         "title": "FunmanModel",
         "type": "object"
      },
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      },
      "LinearConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": true,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "timepoints": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Interval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "additive_bounds": {
               "$ref": "#/$defs/Interval"
            },
            "variables": {
               "items": {
                  "type": "string"
               },
               "title": "Variables",
               "type": "array"
            },
            "weights": {
               "anyOf": [
                  {
                     "items": {
                        "anyOf": [
                           {
                              "type": "integer"
                           },
                           {
                              "type": "number"
                           }
                        ]
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Weights"
            },
            "derivative": {
               "default": false,
               "title": "Derivative",
               "type": "boolean"
            }
         },
         "required": [
            "name",
            "additive_bounds",
            "variables"
         ],
         "title": "LinearConstraint",
         "type": "object"
      },
      "ModelConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": false,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "$ref": "#/$defs/FunmanModel"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelConstraint",
         "type": "object"
      },
      "ModelParameter": {
         "additionalProperties": false,
         "description": "A parameter is a free variable for a Model.  It has the following attributes:\n\n* lb: lower bound\n\n* ub: upper bound\n\n* symbol: a pysmt FNode corresponding to the parameter variable",
         "properties": {
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/ModelSymbol"
                  }
               ],
               "title": "Name"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": {
                  "lb": -1.7976931348623157e+308,
                  "ub": 1.7976931348623157e+308,
                  "closed_upper_bound": false,
                  "original_width": Infinity,
                  "normalized": false,
                  "unnormalized_lb": null,
                  "unnormalized_ub": null
               }
            },
            "label": {
               "default": "any",
               "enum": [
                  "any",
                  "all"
               ],
               "title": "Label",
               "type": "string"
            }
         },
         "required": [
            "name"
         ],
         "title": "ModelParameter",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      },
      "ParameterConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": false,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "parameter": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ModelParameter"
                  },
                  {
                     "$ref": "#/$defs/StructureParameter"
                  }
               ],
               "title": "Parameter"
            }
         },
         "required": [
            "name",
            "parameter"
         ],
         "title": "ParameterConstraint",
         "type": "object"
      },
      "Query": {
         "description": "Abstract base class for queries.",
         "properties": {
            "model": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunmanModel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "Query",
         "type": "object"
      },
      "QueryConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": true,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "timepoints": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Interval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "query": {
               "$ref": "#/$defs/Query"
            }
         },
         "required": [
            "name",
            "query"
         ],
         "title": "QueryConstraint",
         "type": "object"
      },
      "StateVariableConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": true,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "timepoints": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Interval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "variable": {
               "title": "Variable",
               "type": "string"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": null
            }
         },
         "required": [
            "name",
            "variable"
         ],
         "title": "StateVariableConstraint",
         "type": "object"
      },
      "StructureParameter": {
         "properties": {
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/ModelSymbol"
                  }
               ],
               "title": "Name"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": {
                  "lb": -1.7976931348623157e+308,
                  "ub": 1.7976931348623157e+308,
                  "closed_upper_bound": false,
                  "original_width": Infinity,
                  "normalized": false,
                  "unnormalized_lb": null,
                  "unnormalized_ub": null
               }
            },
            "label": {
               "default": "any",
               "enum": [
                  "any",
                  "all"
               ],
               "title": "Label",
               "type": "string"
            }
         },
         "required": [
            "name"
         ],
         "title": "StructureParameter",
         "type": "object"
      }
   }
}

Fields:
field false_explanations: List[BoxExplanation] = []
field true_explanations: List[BoxExplanation] = []
pydantic model funman.representation.explanation.TimeoutExplanation

Bases: Explanation

Show JSON schema
{
   "title": "TimeoutExplanation",
   "type": "object",
   "properties": {
      "expression": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Expression"
      },
      "symbols": {
         "anyOf": [
            {
               "items": {
                  "type": "string"
               },
               "type": "array"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Symbols"
      }
   }
}

Fields:
field expression: str | None = None
field symbols: List[str] | None = None

funman.representation.interval module

Inheritance diagram of funman.representation.interval

pydantic model funman.representation.interval.Interval

Bases: BaseModel

An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).

Show JSON schema
{
   "title": "Interval",
   "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
   "type": "object",
   "properties": {
      "lb": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": -1.7976931348623157e+308,
         "title": "Lb"
      },
      "ub": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": 1.7976931348623157e+308,
         "title": "Ub"
      },
      "closed_upper_bound": {
         "default": false,
         "title": "Closed Upper Bound",
         "type": "boolean"
      },
      "original_width": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Original Width"
      },
      "normalized": {
         "default": false,
         "title": "Normalized",
         "type": "boolean"
      },
      "unnormalized_lb": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Unnormalized Lb"
      },
      "unnormalized_ub": {
         "anyOf": [
            {
               "type": "number"
            },
            {
               "type": "string"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Unnormalized Ub"
      }
   }
}

Config:
  • ser_json_inf_nan: str = constants

Fields:
Validators:
  • check_interval » all fields

  • check_original_width_inf » all fields

field closed_upper_bound: bool = False
Validated by:
  • check_interval

  • check_original_width_inf

field lb: float | str | None = -1.7976931348623157e+308
Validated by:
  • check_interval

  • check_original_width_inf

field normalized: bool = False
Validated by:
  • check_interval

  • check_original_width_inf

field original_width: Decimal | None = None
Validated by:
  • check_interval

  • check_original_width_inf

field ub: float | str | None = 1.7976931348623157e+308
Validated by:
  • check_interval

  • check_original_width_inf

field unnormalized_lb: float | str | None = None
Validated by:
  • check_interval

  • check_original_width_inf

field unnormalized_ub: float | str | None = None
Validated by:
  • check_interval

  • check_original_width_inf

Interval.check_interval
Interval.check_original_width_inf
contains(other: Interval) bool

Does self contain other interval?

Parameters:

other (Interval) – interval to check for containment

Returns:

self contains other

Return type:

bool

contains_value(value: float, denormalize_bounds: bool = False) bool

Does the interval include a value?

Parameters:
  • value (float) – value to check for containment

  • denormalize_bounds (bool) – if true, and self has unnormalized_lb and unormalized_ub, use these insead of lb and ub.

Returns:

the value is in the interval

Return type:

bool

disjoint(other: Interval) bool

Is self disjoint (non overlapping) with other?

Parameters:

other (Interval) – other interval

Returns:

are the intervals disjoint?

Return type:

bool

finite() bool

Are the lower and upper bounds finite?

Returns:

bounds are finite

Return type:

bool

static from_value(v: float | str)
intersection(b: Interval) Interval | None

Given an interval b with self = [a0,a1] and b=[b0,b1], check whether they intersect. If they do, return interval with their intersection.

Parameters:

b (Interval) – interval to check for intersection

Returns:

intersection of self and b

Return type:

Interval

intersects(other: Interval) bool
is_point() bool
is_unbound() bool
meets(other: Interval) bool

Does self meet other?

Parameters:

other (Interval) – another inteval

Returns:

Does self meet other?

Return type:

bool

midpoint(points: List[List[Point]] = None)

Compute the midpoint of the interval.

Parameters:

points (List[Point], optional) – if specified, compute midpoint as average of points in the interval, by default None

Returns:

midpoint

Return type:

float

normalize(normalization_factor: float | int) Interval
normalize_bounds(normalization_constant)
normalized_width() Decimal
ser_wrap(v: Decimal, _info) float
subtract(b: Interval) Interval

Given 2 intervals self = [a0,a1] and b=[b0,b1], return the part of self that does not intersect with b.

Parameters:

b (Interval) – interval to subtract from self

Returns:

self - b

Return type:

Interval

union(other: Interval) List[Interval]

Union other interval with self.

Returns:

union of intervals

Return type:

List[Interval]

width(normalize=False) Decimal

The width of an interval is ub - lb.

Returns:

ub - lb

Return type:

float

funman.representation.parameter module

Inheritance diagram of funman.representation.parameter

pydantic model funman.representation.parameter.LabeledParameter

Bases: Parameter

Show JSON schema
{
   "title": "LabeledParameter",
   "type": "object",
   "properties": {
      "name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "$ref": "#/$defs/ModelSymbol"
            }
         ],
         "title": "Name"
      },
      "interval": {
         "$ref": "#/$defs/Interval",
         "default": {
            "lb": -1.7976931348623157e+308,
            "ub": 1.7976931348623157e+308,
            "closed_upper_bound": false,
            "original_width": Infinity,
            "normalized": false,
            "unnormalized_lb": null,
            "unnormalized_ub": null
         }
      },
      "label": {
         "default": "any",
         "enum": [
            "any",
            "all"
         ],
         "title": "Label",
         "type": "string"
      }
   },
   "$defs": {
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      }
   },
   "required": [
      "name"
   ]
}

Fields:
Validators:

field label: Literal['any', 'all'] = 'any'
Validated by:
  • check_name

  • set_interval_original_width

is_synthesized() bool
model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

pydantic model funman.representation.parameter.ModelParameter

Bases: LabeledParameter

A parameter is a free variable for a Model. It has the following attributes:

  • lb: lower bound

  • ub: upper bound

  • symbol: a pysmt FNode corresponding to the parameter variable

Show JSON schema
{
   "title": "ModelParameter",
   "description": "A parameter is a free variable for a Model.  It has the following attributes:\n\n* lb: lower bound\n\n* ub: upper bound\n\n* symbol: a pysmt FNode corresponding to the parameter variable",
   "type": "object",
   "properties": {
      "name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "$ref": "#/$defs/ModelSymbol"
            }
         ],
         "title": "Name"
      },
      "interval": {
         "$ref": "#/$defs/Interval",
         "default": {
            "lb": -1.7976931348623157e+308,
            "ub": 1.7976931348623157e+308,
            "closed_upper_bound": false,
            "original_width": Infinity,
            "normalized": false,
            "unnormalized_lb": null,
            "unnormalized_ub": null
         }
      },
      "label": {
         "default": "any",
         "enum": [
            "any",
            "all"
         ],
         "title": "Label",
         "type": "string"
      }
   },
   "$defs": {
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "name"
   ]
}

Config:
  • extra: str = forbid

Fields:

Validators:

model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

symbol()

Get a pysmt Symbol for the parameter

Returns:

_description_

Return type:

pysmt.fnode.FNode

timed_copy(timepoint: int)

Create a time-stamped copy of a parameter. E.g., beta becomes beta_t for a timepoint t

Parameters:

timepoint (int) – Integer timepoint

Returns:

A time-stamped copy of self.

Return type:

Parameter

pydantic model funman.representation.parameter.NumSteps

Bases: StructureParameter

Show JSON schema
{
   "title": "NumSteps",
   "type": "object",
   "properties": {
      "name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "$ref": "#/$defs/ModelSymbol"
            }
         ],
         "title": "Name"
      },
      "interval": {
         "$ref": "#/$defs/Interval",
         "default": {
            "lb": -1.7976931348623157e+308,
            "ub": 1.7976931348623157e+308,
            "closed_upper_bound": false,
            "original_width": Infinity,
            "normalized": false,
            "unnormalized_lb": null,
            "unnormalized_ub": null
         }
      },
      "label": {
         "default": "any",
         "enum": [
            "any",
            "all"
         ],
         "title": "Label",
         "type": "string"
      }
   },
   "$defs": {
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      }
   },
   "required": [
      "name"
   ]
}

Fields:
Validators:
  • check_name » all fields

field interval: Interval = {'lb': -1.7976931348623157e+308, 'ub': 1.7976931348623157e+308, 'closed_upper_bound': False, 'original_width': inf, 'normalized': False, 'unnormalized_lb': None, 'unnormalized_ub': None}
Validated by:
  • check_name

  • set_interval_original_width

field label: Literal['any', 'all'] = 'any'
Validated by:
  • check_name

  • set_interval_original_width

field name: str | ModelSymbol [Required]
Validated by:
  • check_name

  • set_interval_original_width

NumSteps.check_name
model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

pydantic model funman.representation.parameter.Parameter

Bases: BaseModel

Show JSON schema
{
   "title": "Parameter",
   "type": "object",
   "properties": {
      "name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "$ref": "#/$defs/ModelSymbol"
            }
         ],
         "title": "Name"
      },
      "interval": {
         "$ref": "#/$defs/Interval",
         "default": {
            "lb": -1.7976931348623157e+308,
            "ub": 1.7976931348623157e+308,
            "closed_upper_bound": false,
            "original_width": Infinity,
            "normalized": false,
            "unnormalized_lb": null,
            "unnormalized_ub": null
         }
      }
   },
   "$defs": {
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      }
   },
   "required": [
      "name"
   ]
}

Fields:
Validators:
  • check_name » all fields

  • set_interval_original_width » all fields

field interval: Interval = {'lb': -1.7976931348623157e+308, 'ub': 1.7976931348623157e+308, 'closed_upper_bound': False, 'original_width': inf, 'normalized': False, 'unnormalized_lb': None, 'unnormalized_ub': None}
Validated by:
  • check_name

  • set_interval_original_width

field name: str | ModelSymbol [Required]
Validated by:
  • check_name

  • set_interval_original_width

Parameter.check_name
is_unbound() bool
model_post_init(context: Any, /) None

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

normalize_bounds(normalization_constant)
Parameter.set_interval_original_width
width() Decimal
pydantic model funman.representation.parameter.Schedules

Bases: StructureParameter

Show JSON schema
{
   "title": "Schedules",
   "type": "object",
   "properties": {
      "name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "$ref": "#/$defs/ModelSymbol"
            }
         ],
         "title": "Name"
      },
      "interval": {
         "$ref": "#/$defs/Interval",
         "default": {
            "lb": -1.7976931348623157e+308,
            "ub": 1.7976931348623157e+308,
            "closed_upper_bound": false,
            "original_width": Infinity,
            "normalized": false,
            "unnormalized_lb": null,
            "unnormalized_ub": null
         }
      },
      "label": {
         "default": "any",
         "enum": [
            "any",
            "all"
         ],
         "title": "Label",
         "type": "string"
      },
      "schedules": {
         "items": {
            "$ref": "#/$defs/EncodingSchedule"
         },
         "title": "Schedules",
         "type": "array"
      }
   },
   "$defs": {
      "EncodingSchedule": {
         "properties": {
            "timepoints": {
               "items": {
                  "anyOf": [
                     {
                        "type": "integer"
                     },
                     {
                        "type": "number"
                     }
                  ]
               },
               "title": "Timepoints",
               "type": "array"
            }
         },
         "required": [
            "timepoints"
         ],
         "title": "EncodingSchedule",
         "type": "object"
      },
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      }
   },
   "required": [
      "name",
      "schedules"
   ]
}

Fields:
Validators:
  • check_empty_name » all fields

  • check_name » all fields

field schedules: List[EncodingSchedule] [Required]
Validated by:
  • check_empty_name

  • check_name

  • set_interval_original_width

Schedules.check_empty_name
Schedules.check_name
model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

pydantic model funman.representation.parameter.StepSize

Bases: StructureParameter

Show JSON schema
{
   "title": "StepSize",
   "type": "object",
   "properties": {
      "name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "$ref": "#/$defs/ModelSymbol"
            }
         ],
         "title": "Name"
      },
      "interval": {
         "$ref": "#/$defs/Interval",
         "default": {
            "lb": -1.7976931348623157e+308,
            "ub": 1.7976931348623157e+308,
            "closed_upper_bound": false,
            "original_width": Infinity,
            "normalized": false,
            "unnormalized_lb": null,
            "unnormalized_ub": null
         }
      },
      "label": {
         "default": "any",
         "enum": [
            "any",
            "all"
         ],
         "title": "Label",
         "type": "string"
      }
   },
   "$defs": {
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      }
   },
   "required": [
      "name"
   ]
}

Fields:
Validators:
  • check_name » all fields

field interval: Interval = {'lb': -1.7976931348623157e+308, 'ub': 1.7976931348623157e+308, 'closed_upper_bound': False, 'original_width': inf, 'normalized': False, 'unnormalized_lb': None, 'unnormalized_ub': None}
Validated by:
  • check_name

  • set_interval_original_width

field label: Literal['any', 'all'] = 'any'
Validated by:
  • check_name

  • set_interval_original_width

field name: str | ModelSymbol [Required]
Validated by:
  • check_name

  • set_interval_original_width

StepSize.check_name
model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

pydantic model funman.representation.parameter.StructureParameter

Bases: LabeledParameter

Show JSON schema
{
   "title": "StructureParameter",
   "type": "object",
   "properties": {
      "name": {
         "anyOf": [
            {
               "type": "string"
            },
            {
               "$ref": "#/$defs/ModelSymbol"
            }
         ],
         "title": "Name"
      },
      "interval": {
         "$ref": "#/$defs/Interval",
         "default": {
            "lb": -1.7976931348623157e+308,
            "ub": 1.7976931348623157e+308,
            "closed_upper_bound": false,
            "original_width": Infinity,
            "normalized": false,
            "unnormalized_lb": null,
            "unnormalized_ub": null
         }
      },
      "label": {
         "default": "any",
         "enum": [
            "any",
            "all"
         ],
         "title": "Label",
         "type": "string"
      }
   },
   "$defs": {
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      }
   },
   "required": [
      "name"
   ]
}

Fields:
Validators:

field interval: Interval = {'lb': -1.7976931348623157e+308, 'ub': 1.7976931348623157e+308, 'closed_upper_bound': False, 'original_width': inf, 'normalized': False, 'unnormalized_lb': None, 'unnormalized_ub': None}
Validated by:
  • check_name

  • set_interval_original_width

field label: Literal['any', 'all'] = 'any'
Validated by:
  • check_name

  • set_interval_original_width

field name: str | ModelSymbol [Required]
Validated by:
  • check_name

  • set_interval_original_width

is_synthesized()
model_post_init(context: Any, /) None

We need to both initialize private attributes and call the user-defined model_post_init method.

funman.representation.parameter_space module

Inheritance diagram of funman.representation.parameter_space

pydantic model funman.representation.parameter_space.ParameterSpace

Bases: BaseModel

This class defines the representation of the parameter space that can be returned by the parameter synthesis feature of FUNMAN. These parameter spaces are represented as a collection of boxes that are either known to be true or known to be false.

Show JSON schema
{
   "title": "ParameterSpace",
   "description": "This class defines the representation of the parameter space that can be\nreturned by the parameter synthesis feature of FUNMAN. These parameter spaces\nare represented as a collection of boxes that are either known to be true or\nknown to be false.",
   "type": "object",
   "properties": {
      "num_dimensions": {
         "default": null,
         "title": "Num Dimensions",
         "type": "integer"
      },
      "true_boxes": {
         "default": [],
         "items": {
            "$ref": "#/$defs/Box"
         },
         "title": "True Boxes",
         "type": "array"
      },
      "false_boxes": {
         "default": [],
         "items": {
            "$ref": "#/$defs/Box"
         },
         "title": "False Boxes",
         "type": "array"
      },
      "unknown_points": {
         "default": [],
         "items": {
            "$ref": "#/$defs/Point"
         },
         "title": "Unknown Points",
         "type": "array"
      }
   },
   "$defs": {
      "Assumption": {
         "properties": {
            "constraint": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ModelConstraint"
                  },
                  {
                     "$ref": "#/$defs/ParameterConstraint"
                  },
                  {
                     "$ref": "#/$defs/StateVariableConstraint"
                  },
                  {
                     "$ref": "#/$defs/LinearConstraint"
                  },
                  {
                     "$ref": "#/$defs/QueryConstraint"
                  }
               ],
               "title": "Constraint"
            }
         },
         "required": [
            "constraint"
         ],
         "title": "Assumption",
         "type": "object"
      },
      "Box": {
         "description": "A Box maps n parameters to intervals, representing an n-dimensional connected open subset of R^n.",
         "properties": {
            "type": {
               "const": "box",
               "default": "box",
               "enum": [
                  "box"
               ],
               "title": "Type",
               "type": "string"
            },
            "label": {
               "default": "unknown",
               "enum": [
                  "true",
                  "false",
                  "unknown",
                  "dropped"
               ],
               "title": "Label",
               "type": "string"
            },
            "bounds": {
               "additionalProperties": {
                  "$ref": "#/$defs/Interval"
               },
               "default": {},
               "title": "Bounds",
               "type": "object"
            },
            "explanation": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/BoxExplanation"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "schedule": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/EncodingSchedule"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "corner_points": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/Point"
               },
               "title": "Corner Points",
               "type": "array"
            },
            "points": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/Point"
               },
               "title": "Points",
               "type": "array"
            }
         },
         "title": "Box",
         "type": "object"
      },
      "BoxExplanation": {
         "properties": {
            "expression": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Expression"
            },
            "symbols": {
               "anyOf": [
                  {
                     "items": {
                        "type": "string"
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Symbols"
            },
            "relevant_assumptions": {
               "default": [],
               "items": {
                  "$ref": "#/$defs/Assumption"
               },
               "title": "Relevant Assumptions",
               "type": "array"
            }
         },
         "title": "BoxExplanation",
         "type": "object"
      },
      "EncodingSchedule": {
         "properties": {
            "timepoints": {
               "items": {
                  "anyOf": [
                     {
                        "type": "integer"
                     },
                     {
                        "type": "number"
                     }
                  ]
               },
               "title": "Timepoints",
               "type": "array"
            }
         },
         "required": [
            "timepoints"
         ],
         "title": "EncodingSchedule",
         "type": "object"
      },
      "FunmanModel": {
         "description": "The abstract base class for Models.",
         "properties": {
            "name": {
               "default": "model_a6f04917-34c0-45e0-a42c-128947736090",
               "title": "Name",
               "type": "string"
            },
            "init_values": {
               "additionalProperties": {
                  "type": "number"
               },
               "default": {},
               "title": "Init Values",
               "type": "object"
            },
            "parameter_bounds": {
               "additionalProperties": {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               },
               "default": {},
               "title": "Parameter Bounds",
               "type": "object"
            }
         },
         "title": "FunmanModel",
         "type": "object"
      },
      "Interval": {
         "description": "An interval is a pair [lb, ub) that is open (i.e., an interval specifies all points x where lb <= x and ub < x).",
         "properties": {
            "lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": -1.7976931348623157e+308,
               "title": "Lb"
            },
            "ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": 1.7976931348623157e+308,
               "title": "Ub"
            },
            "closed_upper_bound": {
               "default": false,
               "title": "Closed Upper Bound",
               "type": "boolean"
            },
            "original_width": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Original Width"
            },
            "normalized": {
               "default": false,
               "title": "Normalized",
               "type": "boolean"
            },
            "unnormalized_lb": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Lb"
            },
            "unnormalized_ub": {
               "anyOf": [
                  {
                     "type": "number"
                  },
                  {
                     "type": "string"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Unnormalized Ub"
            }
         },
         "title": "Interval",
         "type": "object"
      },
      "LinearConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": true,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "timepoints": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Interval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "additive_bounds": {
               "$ref": "#/$defs/Interval"
            },
            "variables": {
               "items": {
                  "type": "string"
               },
               "title": "Variables",
               "type": "array"
            },
            "weights": {
               "anyOf": [
                  {
                     "items": {
                        "anyOf": [
                           {
                              "type": "integer"
                           },
                           {
                              "type": "number"
                           }
                        ]
                     },
                     "type": "array"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Weights"
            },
            "derivative": {
               "default": false,
               "title": "Derivative",
               "type": "boolean"
            }
         },
         "required": [
            "name",
            "additive_bounds",
            "variables"
         ],
         "title": "LinearConstraint",
         "type": "object"
      },
      "ModelConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": false,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "$ref": "#/$defs/FunmanModel"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelConstraint",
         "type": "object"
      },
      "ModelParameter": {
         "additionalProperties": false,
         "description": "A parameter is a free variable for a Model.  It has the following attributes:\n\n* lb: lower bound\n\n* ub: upper bound\n\n* symbol: a pysmt FNode corresponding to the parameter variable",
         "properties": {
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/ModelSymbol"
                  }
               ],
               "title": "Name"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": {
                  "lb": -1.7976931348623157e+308,
                  "ub": 1.7976931348623157e+308,
                  "closed_upper_bound": false,
                  "original_width": Infinity,
                  "normalized": false,
                  "unnormalized_lb": null,
                  "unnormalized_ub": null
               }
            },
            "label": {
               "default": "any",
               "enum": [
                  "any",
                  "all"
               ],
               "title": "Label",
               "type": "string"
            }
         },
         "required": [
            "name"
         ],
         "title": "ModelParameter",
         "type": "object"
      },
      "ModelSymbol": {
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "model": {
               "title": "Model",
               "type": "string"
            }
         },
         "required": [
            "name",
            "model"
         ],
         "title": "ModelSymbol",
         "type": "object"
      },
      "ParameterConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": false,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "parameter": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/ModelParameter"
                  },
                  {
                     "$ref": "#/$defs/StructureParameter"
                  }
               ],
               "title": "Parameter"
            }
         },
         "required": [
            "name",
            "parameter"
         ],
         "title": "ParameterConstraint",
         "type": "object"
      },
      "Point": {
         "properties": {
            "type": {
               "const": "point",
               "default": "point",
               "enum": [
                  "point"
               ],
               "title": "Type",
               "type": "string"
            },
            "label": {
               "default": "unknown",
               "enum": [
                  "true",
                  "false",
                  "unknown",
                  "dropped"
               ],
               "title": "Label",
               "type": "string"
            },
            "values": {
               "additionalProperties": {
                  "anyOf": [
                     {
                        "type": "number"
                     },
                     {
                        "type": "integer"
                     },
                     {
                        "$ref": "#/$defs/EncodingSchedule"
                     },
                     {
                        "type": "null"
                     }
                  ]
               },
               "title": "Values",
               "type": "object"
            },
            "normalized_values": {
               "anyOf": [
                  {
                     "additionalProperties": {
                        "type": "number"
                     },
                     "type": "object"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null,
               "title": "Normalized Values"
            },
            "schedule": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/EncodingSchedule"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "simulation": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Timeseries"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "required": [
            "values"
         ],
         "title": "Point",
         "type": "object"
      },
      "Query": {
         "description": "Abstract base class for queries.",
         "properties": {
            "model": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/FunmanModel"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            }
         },
         "title": "Query",
         "type": "object"
      },
      "QueryConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": true,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "timepoints": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Interval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "query": {
               "$ref": "#/$defs/Query"
            }
         },
         "required": [
            "name",
            "query"
         ],
         "title": "QueryConstraint",
         "type": "object"
      },
      "StateVariableConstraint": {
         "additionalProperties": false,
         "properties": {
            "soft": {
               "default": true,
               "title": "Soft",
               "type": "boolean"
            },
            "name": {
               "title": "Name",
               "type": "string"
            },
            "timepoints": {
               "anyOf": [
                  {
                     "$ref": "#/$defs/Interval"
                  },
                  {
                     "type": "null"
                  }
               ],
               "default": null
            },
            "variable": {
               "title": "Variable",
               "type": "string"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": null
            }
         },
         "required": [
            "name",
            "variable"
         ],
         "title": "StateVariableConstraint",
         "type": "object"
      },
      "StructureParameter": {
         "properties": {
            "name": {
               "anyOf": [
                  {
                     "type": "string"
                  },
                  {
                     "$ref": "#/$defs/ModelSymbol"
                  }
               ],
               "title": "Name"
            },
            "interval": {
               "$ref": "#/$defs/Interval",
               "default": {
                  "lb": -1.7976931348623157e+308,
                  "ub": 1.7976931348623157e+308,
                  "closed_upper_bound": false,
                  "original_width": Infinity,
                  "normalized": false,
                  "unnormalized_lb": null,
                  "unnormalized_ub": null
               }
            },
            "label": {
               "default": "any",
               "enum": [
                  "any",
                  "all"
               ],
               "title": "Label",
               "type": "string"
            }
         },
         "required": [
            "name"
         ],
         "title": "StructureParameter",
         "type": "object"
      },
      "Timeseries": {
         "properties": {
            "data": {
               "items": {
                  "anyOf": [
                     {
                        "type": "number"
                     },
                     {
                        "items": {
                           "type": "number"
                        },
                        "type": "array"
                     }
                  ]
               },
               "title": "Data",
               "type": "array"
            },
            "columns": {
               "items": {
                  "type": "string"
               },
               "title": "Columns",
               "type": "array"
            }
         },
         "required": [
            "data",
            "columns"
         ],
         "title": "Timeseries",
         "type": "object"
      }
   }
}

Fields:
field false_boxes: List[Box] = []
field num_dimensions: int = None
field true_boxes: List[Box] = []
field unknown_points: List[Point] = []
append_result(result: dict)
boxes() List[Box]
static compare(ps1, ps2) bool
consistent() bool

Check that the parameter space is consistent:

  • All boxes are disjoint

  • All points are in a respective box

  • No point is both true and false

static construct_all_equal(ps) ParameterSpace
static decode_labeled_object(obj: dict)
explain() ParameterSpaceExplanation
false_points() List[Point]
intersection(ps2: ParameterSpace) ParameterSpace

Intersect two parameter spaces.

labeled_volume(scenario: AnalysisScenario = None)
last_boxes() List[Box]
max_true_volume()
outer_interval(param_name: str) Interval

Get the infimum and supremimum values of parameter param_name among all true boxes

Parameters:

param_name (str) – Parameter name

Returns:

Interval where the lb and ub are the minimum and maximum values taken by parameter among all true boxes.

Return type:

Interval

plot(color='b', alpha=0.2)
points() List[Point]
static project() ParameterSpace
static symmetric_difference(ps1: ParameterSpace, ps2: ParameterSpace)
true_points() List[Point]

funman.representation.representation module

Inheritance diagram of funman.representation.representation

This submodule contains definitions for the classes used during the configuration and execution of a search.

pydantic model funman.representation.representation.Point

Bases: BaseModel

Show JSON schema
{
   "title": "Point",
   "type": "object",
   "properties": {
      "type": {
         "const": "point",
         "default": "point",
         "enum": [
            "point"
         ],
         "title": "Type",
         "type": "string"
      },
      "label": {
         "default": "unknown",
         "enum": [
            "true",
            "false",
            "unknown",
            "dropped"
         ],
         "title": "Label",
         "type": "string"
      },
      "values": {
         "additionalProperties": {
            "anyOf": [
               {
                  "type": "number"
               },
               {
                  "type": "integer"
               },
               {
                  "$ref": "#/$defs/EncodingSchedule"
               },
               {
                  "type": "null"
               }
            ]
         },
         "title": "Values",
         "type": "object"
      },
      "normalized_values": {
         "anyOf": [
            {
               "additionalProperties": {
                  "type": "number"
               },
               "type": "object"
            },
            {
               "type": "null"
            }
         ],
         "default": null,
         "title": "Normalized Values"
      },
      "schedule": {
         "anyOf": [
            {
               "$ref": "#/$defs/EncodingSchedule"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      },
      "simulation": {
         "anyOf": [
            {
               "$ref": "#/$defs/Timeseries"
            },
            {
               "type": "null"
            }
         ],
         "default": null
      }
   },
   "$defs": {
      "EncodingSchedule": {
         "properties": {
            "timepoints": {
               "items": {
                  "anyOf": [
                     {
                        "type": "integer"
                     },
                     {
                        "type": "number"
                     }
                  ]
               },
               "title": "Timepoints",
               "type": "array"
            }
         },
         "required": [
            "timepoints"
         ],
         "title": "EncodingSchedule",
         "type": "object"
      },
      "Timeseries": {
         "properties": {
            "data": {
               "items": {
                  "anyOf": [
                     {
                        "type": "number"
                     },
                     {
                        "items": {
                           "type": "number"
                        },
                        "type": "array"
                     }
                  ]
               },
               "title": "Data",
               "type": "array"
            },
            "columns": {
               "items": {
                  "type": "string"
               },
               "title": "Columns",
               "type": "array"
            }
         },
         "required": [
            "data",
            "columns"
         ],
         "title": "Timeseries",
         "type": "object"
      }
   },
   "required": [
      "values"
   ]
}

Fields:
field label: Literal['true', 'false', 'unknown', 'dropped'] = 'unknown'
field normalized_values: Dict[str, float] | None = None
field schedule: EncodingSchedule | None = None
field simulation: Timeseries | None = None
field type: Literal['point'] = 'point'
field values: Dict[str, float | int | EncodingSchedule | None] [Required]
denormalize(scenario)
relevant_timepoints(model: FunmanModel) List[int]
relevant_timesteps() Set[int]
remove_irrelevant_steps(untimed_symbols: Set[str])
state_values() Dict[str, float]
timestep() int
value_of(var) float
values_at(tp: int | float, model: FunmanModel) Dict[str, float]
pydantic model funman.representation.representation.Timeseries

Bases: BaseModel

Show JSON schema
{
   "title": "Timeseries",
   "type": "object",
   "properties": {
      "data": {
         "items": {
            "anyOf": [
               {
                  "type": "number"
               },
               {
                  "items": {
                     "type": "number"
                  },
                  "type": "array"
               }
            ]
         },
         "title": "Data",
         "type": "array"
      },
      "columns": {
         "items": {
            "type": "string"
         },
         "title": "Columns",
         "type": "array"
      }
   },
   "required": [
      "data",
      "columns"
   ]
}

Fields:
field columns: List[str] [Required]
field data: List[float | List[float]] [Required]
dataframe()
plot(**kwargs)

funman.representation.symbol module

Inheritance diagram of funman.representation.symbol

pydantic model funman.representation.symbol.ModelSymbol

Bases: BaseModel

Show JSON schema
{
   "title": "ModelSymbol",
   "type": "object",
   "properties": {
      "name": {
         "title": "Name",
         "type": "string"
      },
      "model": {
         "title": "Model",
         "type": "string"
      }
   },
   "required": [
      "name",
      "model"
   ]
}

Fields:
field model: str [Required]
field name: str [Required]

Module contents

Classes for representing analysis elements, such as parameter, intervals, boxes, and parmaeter spaces.