Commit a20c9bfc authored by Linxiao Zeng's avatar Linxiao Zeng


parent e1603eaa
# Multi-Agent System
### Automatic Configuration
For the configuration, we've defined a simple language to simplify the loading.
The syntax can be sum up as :
`type: parameter`
As our system has mainly 2 type of component: machines and lines.
Machine suggest input, transformation and output. Each contain 6 element, i.e., name, in_list, out_list, processing_time,error_rate, coordinate. We mark this type of component as transf.
So, the machine should be expressed as following:
As Line connect two machines, and transfer products between them, so the parameters should contain name, source machine, target machine and capacity of products.
Through the above definition, we can capture the machines' attributes by following regular expression in java:
and the attributes of lines can be extracted by simply apply split by ";"
We then store the attributes in a HashMap, and all machines forming a Map variable, then we put machines and lines into a HashMap for latter use.
We express the data structure as follows:
confDic: {"Machines": Machines, "Lignes": Lignes}
- Machines: {nameOfMachine: Machine, ...}
- Machine: {"inputs": inputLists, "outputs": outputLists, "processTime": processTime, "errorProb": errorProb, "x": x, "y": y}
- inputList: a list of Object Input with attribute {type, quantity}
- outputList: a list of Object Output with attribute {ligneName, type, quantity}
- Lignes: {nameOfLigne: Ligne, ...}
- Ligne: {"source": sourceMachineName, "target": targetMachineName, "capacity": capacity}
### Graphic interface
In order to show the process of a multi-agent system, we created a graphical interface. In the gui package, we should mainly focus on two classes:, is the agent who in charge with the setup of the graphic interface. is a subclass of JPanel and override the paint function to paint the graphic object. In this class, we set all the graphic component as attribute, i.e. machines, lignes, productList. We can change the output graphic interface by changing these attribute.
And we set the agent to repaint the output graphic in a fixed frequency to adapt these changes.
Therefore, in order to correctly display the progress of the system, we only need other agents to send information to the GUI agent. The GUI agent processes these information, and applies the changed data to the attribute of The graphical interface will then automatically updated by TickerBehaviour (Repaint) of the GUI agent.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment