NetLogo banner

Home
Download
Help
Resources
Extensions
FAQ
NetLogo Publications
Contact Us
Donate

Models:
Library
Community
Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Web
Printable
Chinese
Czech
Farsi / Persian
Japanese
Spanish

  Donate

NetLogo User Community Models

(back to the NetLogo User Community Models)

[screen shot]

Download
If clicking does not initiate a download, try right clicking or control clicking and choosing "Save" or "Download".(The run link is disabled for this model because it was made in a version prior to NetLogo 6.0, which NetLogo Web requires.)

WHAT IS IT?

This model is trying to simulate a problem called "Cigarette smokers problem", which was described in 1971 by S. S. Patil.

For making a cigarette we need three ingredients, tobacco, paper and matches. There are three smokers, each with an indefinite supply of one ingredient. There is also an agent with an indefinite supply of all three ingredients. To make a cigarette, the smoker who has tobacco (resp., paper and match) must have the other two ingredients of paper and a match (resp., tobacco and match, and tobacco and paper).
The supplier agent and smokers are sitting around the table. The supplier randomly provides two ingredients. The agent now notifies the smoker who needs these two ingredients.
The smoker takes these two ingredients from the table, creates a cigarette and smokes for some time. When the table is empty, the agent supplies another two random ingredients. If the ingredients are for the currently active smoker, the ingredients stay on the table and wait there for him. Otherwise, the relevant smoker pics them up and smokes.

HOW IT WORKS

There are four types of agents: the smoker with tobacco, the smoker with paper, the smoker with a match and the agent supplier. Each smoker knows, what ingredient he has in unlimited quantity and for which two is he waiting. If the two necessary ingredients are on the table, the agent-smoker pics them up, creates a cigarette and smokes.

HOW TO USE IT

Initial settings - by default :
- random_length_smoker_smokes is set to ON. If the setup button is pressed and the model is started, the the time for smoking a cigarette for each smoker is random in each step. If this switch is set to OFF, the probability of the time of smoking for each smoker is taken from the sliders.

Other settings:
- length_tobacco_smoker_smokes - the length of smoking for a tobacco-smoker is not random but from interval zero to value on the slider, maximum 15.
- length_paper_smoker_smokes - the length of smoking for paper-smoker is not random but from interval zero to value on the slider, maximum 15.
- length_match_smoker_smokes - the length of smoking for match-smoker is not random but from interval zero to value on the slider, maximum 15.

Plots:
- activity_smoker_tobacco - the number shows total number of cigarettes which were smoked by this type of smoker.
- activity_smoker_paper - the number shows total number of cigarettes which were smoked by this type of smoker.
- activity_smoker_match - the number shows total number of cigarettes which were smoked by this type of smoker.
- smokers_activity - the plot shows overall activity of the smokers during the time.

THINGS TO NOTICE

Observe the line chart smokers_activity to see that if random_length_smoker_smokes is ON, nearly all the lines are growing the same. But if this length is set manually, there are differences and the lines are unbalanced.

THINGS TO TRY

Play with the settings of the the length of smoking for each agent. This can lead to starvation of some of the smokers.

Situation 1: lenghth_smoker_smokes for one smoker is high but for the other two is low. Sooner or later the model gets stuck. One smoker still smokes, his activity increases as there are ingredients on the table for him, while the other two are waiting.

Situation 2: lenghth_smoker_smokes for two smokers is high, for other one is low. Same as in situation 1, but two smokers are now smoking while one smoker is waiting, his activity being the lowest.

EXTENDING THE MODEL

The model might be expanded by modification of the randomness, what two ingredients are placed on the table by the agent.
New type of smoker can be added, for example smoker with filters.

CREDITS AND REFERENCES

To refer this model use:
Limitations and capabilities of Dijkstra's semaphore primitives for coordination among processes, by Suhas Patil, technical report, MIT, 1971

(back to the NetLogo User Community Models)