Instantiation is the process of actually creating a model from the domain theory. The two main commands used here are rassert! and assume!
Args: &rest (type name)
The rassert! is used to state model fragments which are true for the lifetime of the model. Rasserted items cannot change from active to inactive during the lifetime of the scenario. In the below example, we are trying to declare a rocket model consisting of two tanks and a igniter for the motor.
(rassert! (container fuel-tank)) (rassert! (container oxidizer-tank)) (assume! '(is-on igniter) :initial-condition)
Note that the tanks for the rocket fuel and the oxidizer are rasserted because they exist throughout the lifetime of the model. However the state of the igniter is-on or is-off is not rasserted because they might change over the course of the simulation.
Args: 'fact justification
Assume! is used to instantiate model fragments which could change within the lifetime of the model. In the below example, we are trying to declare a rocket model consisting of two tanks and a igniter for the motor.
(rassert! (container fuel-tank)) (rassert! (container oxidizer-tank)) (assume! '(is-on igniter) :initial-condition)
Note that the tanks for the rocket fuel and the oxidizer are rasserted because they exist throughout the lifetime of the model. However the state of the igniter is-on or is-off is assumed because they might change over the course of the simulation.
The :initial-condition is a justification, it has no meaning within Gizmo but exists for human consumption.
Args: (instance-name, model-fragment, &rest bindings)
defMFI can be used to provide modelers a way to refer to specific model fragments in the code. It is usually used to turn model fragments from the typical MF# (MF0, MF1, MF2) into something more readable by humans.
;; in the domain file (defModelFragment Contained-Stuff :participants ((the-can :type container) (the-phase :type phase))) (the-sub :type substance)) . . .) ;; in the scenario file (defMFI the-water contained-stuff (the-phase liquid) (the-can can) (the-sub water))
The this example the label the-water is given to a model fragment contained-stuff in which the-phase of the liquid is bound to liquid, the-can is bound to can and the-sub is bound to water.
Notes from forbus: This piece of syntactic sugar provides the ability for modellers who need to explicitly refer to specific model fragments in scenario descriptions. It provides minimal insulation from Gizmo internals. It presumes that all roles have been specified, and if any role is left out, no guarentees are made as to behavior. Moreover, it does not do error detection: If you enter duplicate descriptions, for instance, it will not stop you. You have been warned!