In this section we propose a tutorial as an application example, theO3PRM documentationhelps the reader to understand the functions used for modelling.
1. The printers example
Let's recall the Printers example :
The printers example is a computer maintenance problem where a set of computers and printers, located in different rooms, are powered by one or more power supplies. Depending on the voltage spike intensity and the overall quality and age of electronic devices, computer and printer may or may not breakdown. Each equipment is described by its current state (state: {OK, NOK}). For computers, an additional attribute shows if it can print (canPrint:{can, cannot}). Power supplies are described by their power state (power: {true, false}). Finally, a computer is usually plugged to one or more printers; it can print if at least one of its printers is functional. The printer can be functional, malfunctioning or broken.
2. Steps for creating the Power Surge
In this example, we will be using the prm_run interpreter. You could also use pyAgrum or directly aGrUM. For simplicity we will declare all types, interfaces, classes and systems in a single file. However, for large projects you should split elements in different files.
We will first declare the different types used in our example, not that the boolean type is (the only) predefined type in the O3PRM language.
New, we declare each class of our example.
PowerSupply class:
Ink class:
Room class:
Device class:
Printer class :
Computer class:
When the relational skeleton contains all its items, we can instantiate all the objects of the real system.
The last step is to create the request file in order to execute the modelled system and obtain the availability of the requested equipment/equipments.
Example 01:
Executing prm_run over this exemple yield the folowing results:
Example 02:
In the second example, we see that the possibility of printing by the second computer is forced down from 97% to 72% knowing that the first computer cannot print.