<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://www.simulace.info/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Holp11</id>
	<title>Simulace.info - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="http://www.simulace.info/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Holp11"/>
	<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php/Special:Contributions/Holp11"/>
	<updated>2026-07-27T14:33:46Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26471</id>
		<title>Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26471"/>
		<updated>2025-01-10T22:18:39Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Model Limitations */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 1.png]]&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
&lt;br /&gt;
[[File:3 guards 1.png]]&lt;br /&gt;
[[File:3 guards.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
&lt;br /&gt;
[[File:3 guards and 10 customers 1.png]]&lt;br /&gt;
[[File:3 guards and 10 customers 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
&lt;br /&gt;
[[File:The first Large world 1.png]]&lt;br /&gt;
[[File:The first Large world 2.png]]&lt;br /&gt;
&lt;br /&gt;
In both simulations, 60% of thieves were captured, while 40% escaped, even with six guards patrolling the shop. This shows that the guards were effective to some extent. The number of conflicts changed. In Screenshot 1, there were 19 conflicts, while Screenshot 2 had 28 conflicts. This suggests that guards were more engaged in the second simulation, but it didn’t result in a better capture rate. This could indicate inefficiencies in how guards respond after spotting thieves. Thieves spent more time in the shop in the second simulation, with an average of 33.6 ticks compared to 24.6 ticks in the first.&lt;br /&gt;
The guard's efficiency also showed a notable difference. In Screenshot 1, efficiency was 5.9%, while in Screenshot 2, it improved to 18.3%. Having up to 20 customers in the store added complexity to the guards’ task. With so many people, guards struggled to differentiate between thieves and customers. This could explain why the escape rate remained consistent despite the increased guard activity in the second scenario.&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
&lt;br /&gt;
[[File:2nd  Large world 1.png]]&lt;br /&gt;
[[File:2nd  Large world 2.png]]&lt;br /&gt;
&lt;br /&gt;
In the first screenshot, 2 thieves were caught, while 4 escaped. In the second screenshot, guards performed significantly better, capturing 4 thieves with only 2 escaping. This improvement suggests better guard effectiveness, potentially due to better positioning .&lt;br /&gt;
Conflicts more than doubled, rising from 10 in the first screenshot to 21 in the second screenshot. This indicates that guards were more actively engaging with thieves, which contributed to the higher capture rate.&lt;br /&gt;
The average time thieves spent in the shop decreased from 44 ticks in the first screenshot to 31.33 ticks in the second screenshot. This shows that guards were quicker at detecting and responding to thieves in the second scenario.&lt;br /&gt;
Despite the improvements, guard efficiency was very low in both screenshots—1.8% in the first screenshot and 3.8% in the second screenshot&lt;br /&gt;
With 15 customers in the store, guards faced difficulties distinguishing between thieves and shoppers. This added complexity likely led to lower capture rates and efficiency, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analysing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example, in a small store with two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8% but escapes still occurred. Additionally, thieves spent an average of 22 to 44 ticks in the store, depending on factors like steal delay. Shorter delays allowed thieves to escape faster, while longer ones gave guards more chances.&lt;br /&gt;
Store layout and customer traffic were also crucial factors. Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience. Similarly, high customer traffic, with spawn thresholds between 0.30 and 0.50, made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates. While the exact numbers and percentages may vary depending on specific scenarios, this simulation proved to be a useful tool for testing different security strategies. For Mr. Ha Son Do, it emphasizes the importance of placing guards strategically, optimizing store layouts, and focusing on guard training to improve theft prevention in a cost-effective and adaptable way.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [https://www.robotomie.cz/robodownload.php?q=netlogo]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
[[File:Obchod_zmeny.nlogo]]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26468</id>
		<title>Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26468"/>
		<updated>2025-01-10T22:14:54Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 1.png]]&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
&lt;br /&gt;
[[File:3 guards 1.png]]&lt;br /&gt;
[[File:3 guards.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
&lt;br /&gt;
[[File:3 guards and 10 customers 1.png]]&lt;br /&gt;
[[File:3 guards and 10 customers 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
&lt;br /&gt;
[[File:The first Large world 1.png]]&lt;br /&gt;
[[File:The first Large world 2.png]]&lt;br /&gt;
&lt;br /&gt;
In both simulations, 60% of thieves were captured, while 40% escaped, even with six guards patrolling the shop. This shows that the guards were effective to some extent. The number of conflicts changed. In Screenshot 1, there were 19 conflicts, while Screenshot 2 had 28 conflicts. This suggests that guards were more engaged in the second simulation, but it didn’t result in a better capture rate. This could indicate inefficiencies in how guards respond after spotting thieves. Thieves spent more time in the shop in the second simulation, with an average of 33.6 ticks compared to 24.6 ticks in the first.&lt;br /&gt;
The guard's efficiency also showed a notable difference. In Screenshot 1, efficiency was 5.9%, while in Screenshot 2, it improved to 18.3%. Having up to 20 customers in the store added complexity to the guards’ task. With so many people, guards struggled to differentiate between thieves and customers. This could explain why the escape rate remained consistent despite the increased guard activity in the second scenario.&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
&lt;br /&gt;
[[File:2nd  Large world 1.png]]&lt;br /&gt;
[[File:2nd  Large world 2.png]]&lt;br /&gt;
&lt;br /&gt;
In the first screenshot, 2 thieves were caught, while 4 escaped. In the second screenshot, guards performed significantly better, capturing 4 thieves with only 2 escaping. This improvement suggests better guard effectiveness, potentially due to better positioning .&lt;br /&gt;
Conflicts more than doubled, rising from 10 in the first screenshot to 21 in the second screenshot. This indicates that guards were more actively engaging with thieves, which contributed to the higher capture rate.&lt;br /&gt;
The average time thieves spent in the shop decreased from 44 ticks in the first screenshot to 31.33 ticks in the second screenshot. This shows that guards were quicker at detecting and responding to thieves in the second scenario.&lt;br /&gt;
Despite the improvements, guard efficiency was very low in both screenshots—1.8% in the first screenshot and 3.8% in the second screenshot&lt;br /&gt;
With 15 customers in the store, guards faced difficulties distinguishing between thieves and shoppers. This added complexity likely led to lower capture rates and efficiency, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analysing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example, in a small store with two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8% but escapes still occurred. Additionally, thieves spent an average of 22 to 44 ticks in the store, depending on factors like steal delay. Shorter delays allowed thieves to escape faster, while longer ones gave guards more chances.&lt;br /&gt;
Store layout and customer traffic were also crucial factors. Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience. Similarly, high customer traffic, with spawn thresholds between 0.30 and 0.50, made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates. While the exact numbers and percentages may vary depending on specific scenarios, this simulation proved to be a useful tool for testing different security strategies. For Mr. Ha Son Do, it emphasizes the importance of placing guards strategically, optimizing store layouts, and focusing on guard training to improve theft prevention in a cost-effective and adaptable way.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [https://www.robotomie.cz/robodownload.php?q=netlogo]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
[[File:Obchod_zmeny.nlogo]]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=File:2nd_Large_world_2.png&amp;diff=26465</id>
		<title>File:2nd Large world 2.png</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=File:2nd_Large_world_2.png&amp;diff=26465"/>
		<updated>2025-01-10T22:11:49Z</updated>

		<summary type="html">&lt;p&gt;Holp11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=File:2nd_Large_world_1.png&amp;diff=26464</id>
		<title>File:2nd Large world 1.png</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=File:2nd_Large_world_1.png&amp;diff=26464"/>
		<updated>2025-01-10T22:11:23Z</updated>

		<summary type="html">&lt;p&gt;Holp11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26463</id>
		<title>Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26463"/>
		<updated>2025-01-10T22:10:58Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Second Large World */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 1.png]]&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
&lt;br /&gt;
[[File:3 guards 1.png]]&lt;br /&gt;
[[File:3 guards.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
&lt;br /&gt;
[[File:3 guards and 10 customers 1.png]]&lt;br /&gt;
[[File:3 guards and 10 customers 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
&lt;br /&gt;
[[File:The first Large world 1.png]]&lt;br /&gt;
[[File:The first Large world 2.png]]&lt;br /&gt;
&lt;br /&gt;
In both simulations, 60% of thieves were captured, while 40% escaped, even with six guards patrolling the shop. This shows that the guards were effective to some extent. The number of conflicts changed. In Screenshot 1, there were 19 conflicts, while Screenshot 2 had 28 conflicts. This suggests that guards were more engaged in the second simulation, but it didn’t result in a better capture rate. This could indicate inefficiencies in how guards respond after spotting thieves. Thieves spent more time in the shop in the second simulation, with an average of 33.6 ticks compared to 24.6 ticks in the first.&lt;br /&gt;
The guard's efficiency also showed a notable difference. In Screenshot 1, efficiency was 5.9%, while in Screenshot 2, it improved to 18.3%. Having up to 20 customers in the store added complexity to the guards’ task. With so many people, guards struggled to differentiate between thieves and customers. This could explain why the escape rate remained consistent despite the increased guard activity in the second scenario.&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
&lt;br /&gt;
[[File:2nd  Large world 1.png]]&lt;br /&gt;
[[File:2nd  Large world 2.png]]&lt;br /&gt;
&lt;br /&gt;
In the first screenshot, 2 thieves were caught, while 4 escaped. In the second screenshot, guards performed significantly better, capturing 4 thieves with only 2 escaping. This improvement suggests better guard effectiveness, potentially due to better positioning .&lt;br /&gt;
Conflicts more than doubled, rising from 10 in the first screenshot to 21 in the second screenshot. This indicates that guards were more actively engaging with thieves, which contributed to the higher capture rate.&lt;br /&gt;
The average time thieves spent in the shop decreased from 44 ticks in the first screenshot to 31.33 ticks in the second screenshot. This shows that guards were quicker at detecting and responding to thieves in the second scenario.&lt;br /&gt;
Despite the improvements, guard efficiency was very low in both screenshots—1.8% in the first screenshot and 3.8% in the second screenshot&lt;br /&gt;
With 15 customers in the store, guards faced difficulties distinguishing between thieves and shoppers. This added complexity likely led to lower capture rates and efficiency, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analysing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example, in a small store with two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8% but escapes still occurred. Additionally, thieves spent an average of 22 to 44 ticks in the store, depending on factors like steal delay. Shorter delays allowed thieves to escape faster, while longer ones gave guards more chances.&lt;br /&gt;
Store layout and customer traffic were also crucial factors. Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience. Similarly, high customer traffic, with spawn thresholds between 0.30 and 0.50, made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates. While the exact numbers and percentages may vary depending on specific scenarios, this simulation proved to be a useful tool for testing different security strategies. For Mr. Ha Son Do, it emphasizes the importance of placing guards strategically, optimizing store layouts, and focusing on guard training to improve theft prevention in a cost-effective and adaptable way.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
[[File:Obchod_zmeny.nlogo]]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=File:The_first_Large_world_2.png&amp;diff=26462</id>
		<title>File:The first Large world 2.png</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=File:The_first_Large_world_2.png&amp;diff=26462"/>
		<updated>2025-01-10T22:09:02Z</updated>

		<summary type="html">&lt;p&gt;Holp11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=File:The_first_Large_world_1.png&amp;diff=26461</id>
		<title>File:The first Large world 1.png</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=File:The_first_Large_world_1.png&amp;diff=26461"/>
		<updated>2025-01-10T22:08:42Z</updated>

		<summary type="html">&lt;p&gt;Holp11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26460</id>
		<title>Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26460"/>
		<updated>2025-01-10T22:07:30Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Large World */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 1.png]]&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
&lt;br /&gt;
[[File:3 guards 1.png]]&lt;br /&gt;
[[File:3 guards.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
&lt;br /&gt;
[[File:3 guards and 10 customers 1.png]]&lt;br /&gt;
[[File:3 guards and 10 customers 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
&lt;br /&gt;
[[File:The first Large world 1.png]]&lt;br /&gt;
[[File:The first Large world 2.png]]&lt;br /&gt;
&lt;br /&gt;
In both simulations, 60% of thieves were captured, while 40% escaped, even with six guards patrolling the shop. This shows that the guards were effective to some extent. The number of conflicts changed. In Screenshot 1, there were 19 conflicts, while Screenshot 2 had 28 conflicts. This suggests that guards were more engaged in the second simulation, but it didn’t result in a better capture rate. This could indicate inefficiencies in how guards respond after spotting thieves. Thieves spent more time in the shop in the second simulation, with an average of 33.6 ticks compared to 24.6 ticks in the first.&lt;br /&gt;
The guard's efficiency also showed a notable difference. In Screenshot 1, efficiency was 5.9%, while in Screenshot 2, it improved to 18.3%. Having up to 20 customers in the store added complexity to the guards’ task. With so many people, guards struggled to differentiate between thieves and customers. This could explain why the escape rate remained consistent despite the increased guard activity in the second scenario.&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
In the first screenshot, 2 thieves were caught, while 4 escaped. In the second screenshot, guards performed significantly better, capturing 4 thieves with only 2 escaping. This improvement suggests better guard effectiveness, potentially due to better positioning .&lt;br /&gt;
Conflicts more than doubled, rising from 10 in the first screenshot to 21 in the second screenshot. This indicates that guards were more actively engaging with thieves, which contributed to the higher capture rate.&lt;br /&gt;
The average time thieves spent in the shop decreased from 44 ticks in the first screenshot to 31.33 ticks in the second screenshot. This shows that guards were quicker at detecting and responding to thieves in the second scenario.&lt;br /&gt;
Despite the improvements, guard efficiency was very low in both screenshots—1.8% in the first screenshot and 3.8% in the second screenshot&lt;br /&gt;
With 15 customers in the store, guards faced difficulties distinguishing between thieves and shoppers. This added complexity likely led to lower capture rates and efficiency, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analysing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example, in a small store with two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8% but escapes still occurred. Additionally, thieves spent an average of 22 to 44 ticks in the store, depending on factors like steal delay. Shorter delays allowed thieves to escape faster, while longer ones gave guards more chances.&lt;br /&gt;
Store layout and customer traffic were also crucial factors. Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience. Similarly, high customer traffic, with spawn thresholds between 0.30 and 0.50, made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates. While the exact numbers and percentages may vary depending on specific scenarios, this simulation proved to be a useful tool for testing different security strategies. For Mr. Ha Son Do, it emphasizes the importance of placing guards strategically, optimizing store layouts, and focusing on guard training to improve theft prevention in a cost-effective and adaptable way.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
[[File:Obchod_zmeny.nlogo]]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26459</id>
		<title>Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26459"/>
		<updated>2025-01-10T22:06:34Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* 3 Guards and 10 Customers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 1.png]]&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
&lt;br /&gt;
[[File:3 guards 1.png]]&lt;br /&gt;
[[File:3 guards.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
&lt;br /&gt;
[[File:3 guards and 10 customers 1.png]]&lt;br /&gt;
[[File:3 guards and 10 customers 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
In both simulations, 60% of thieves were captured, while 40% escaped, even with six guards patrolling the shop. This shows that the guards were effective to some extent. The number of conflicts changed. In Screenshot 1, there were 19 conflicts, while Screenshot 2 had 28 conflicts. This suggests that guards were more engaged in the second simulation, but it didn’t result in a better capture rate. This could indicate inefficiencies in how guards respond after spotting thieves. Thieves spent more time in the shop in the second simulation, with an average of 33.6 ticks compared to 24.6 ticks in the first.&lt;br /&gt;
The guard's efficiency also showed a notable difference. In Screenshot 1, efficiency was 5.9%, while in Screenshot 2, it improved to 18.3%. Having up to 20 customers in the store added complexity to the guards’ task. With so many people, guards struggled to differentiate between thieves and customers. This could explain why the escape rate remained consistent despite the increased guard activity in the second scenario.&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
In the first screenshot, 2 thieves were caught, while 4 escaped. In the second screenshot, guards performed significantly better, capturing 4 thieves with only 2 escaping. This improvement suggests better guard effectiveness, potentially due to better positioning .&lt;br /&gt;
Conflicts more than doubled, rising from 10 in the first screenshot to 21 in the second screenshot. This indicates that guards were more actively engaging with thieves, which contributed to the higher capture rate.&lt;br /&gt;
The average time thieves spent in the shop decreased from 44 ticks in the first screenshot to 31.33 ticks in the second screenshot. This shows that guards were quicker at detecting and responding to thieves in the second scenario.&lt;br /&gt;
Despite the improvements, guard efficiency was very low in both screenshots—1.8% in the first screenshot and 3.8% in the second screenshot&lt;br /&gt;
With 15 customers in the store, guards faced difficulties distinguishing between thieves and shoppers. This added complexity likely led to lower capture rates and efficiency, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analysing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example, in a small store with two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8% but escapes still occurred. Additionally, thieves spent an average of 22 to 44 ticks in the store, depending on factors like steal delay. Shorter delays allowed thieves to escape faster, while longer ones gave guards more chances.&lt;br /&gt;
Store layout and customer traffic were also crucial factors. Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience. Similarly, high customer traffic, with spawn thresholds between 0.30 and 0.50, made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates. While the exact numbers and percentages may vary depending on specific scenarios, this simulation proved to be a useful tool for testing different security strategies. For Mr. Ha Son Do, it emphasizes the importance of placing guards strategically, optimizing store layouts, and focusing on guard training to improve theft prevention in a cost-effective and adaptable way.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
[[File:Obchod_zmeny.nlogo]]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=File:3_guards_and_10_customers_2.png&amp;diff=26458</id>
		<title>File:3 guards and 10 customers 2.png</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=File:3_guards_and_10_customers_2.png&amp;diff=26458"/>
		<updated>2025-01-10T22:05:38Z</updated>

		<summary type="html">&lt;p&gt;Holp11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=File:3_guards_and_10_customers_1.png&amp;diff=26457</id>
		<title>File:3 guards and 10 customers 1.png</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=File:3_guards_and_10_customers_1.png&amp;diff=26457"/>
		<updated>2025-01-10T22:04:57Z</updated>

		<summary type="html">&lt;p&gt;Holp11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26454</id>
		<title>Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26454"/>
		<updated>2025-01-10T22:03:17Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* 3 Guards and 10 Customers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 1.png]]&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
&lt;br /&gt;
[[File:3 guards 1.png]]&lt;br /&gt;
[[File:3 guards.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
&lt;br /&gt;
[[File:3 guards and 10 customers 1.png]]&lt;br /&gt;
[[File:3 guards and 10 customers 2]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
In both simulations, 60% of thieves were captured, while 40% escaped, even with six guards patrolling the shop. This shows that the guards were effective to some extent. The number of conflicts changed. In Screenshot 1, there were 19 conflicts, while Screenshot 2 had 28 conflicts. This suggests that guards were more engaged in the second simulation, but it didn’t result in a better capture rate. This could indicate inefficiencies in how guards respond after spotting thieves. Thieves spent more time in the shop in the second simulation, with an average of 33.6 ticks compared to 24.6 ticks in the first.&lt;br /&gt;
The guard's efficiency also showed a notable difference. In Screenshot 1, efficiency was 5.9%, while in Screenshot 2, it improved to 18.3%. Having up to 20 customers in the store added complexity to the guards’ task. With so many people, guards struggled to differentiate between thieves and customers. This could explain why the escape rate remained consistent despite the increased guard activity in the second scenario.&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
In the first screenshot, 2 thieves were caught, while 4 escaped. In the second screenshot, guards performed significantly better, capturing 4 thieves with only 2 escaping. This improvement suggests better guard effectiveness, potentially due to better positioning .&lt;br /&gt;
Conflicts more than doubled, rising from 10 in the first screenshot to 21 in the second screenshot. This indicates that guards were more actively engaging with thieves, which contributed to the higher capture rate.&lt;br /&gt;
The average time thieves spent in the shop decreased from 44 ticks in the first screenshot to 31.33 ticks in the second screenshot. This shows that guards were quicker at detecting and responding to thieves in the second scenario.&lt;br /&gt;
Despite the improvements, guard efficiency was very low in both screenshots—1.8% in the first screenshot and 3.8% in the second screenshot&lt;br /&gt;
With 15 customers in the store, guards faced difficulties distinguishing between thieves and shoppers. This added complexity likely led to lower capture rates and efficiency, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analysing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example, in a small store with two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8% but escapes still occurred. Additionally, thieves spent an average of 22 to 44 ticks in the store, depending on factors like steal delay. Shorter delays allowed thieves to escape faster, while longer ones gave guards more chances.&lt;br /&gt;
Store layout and customer traffic were also crucial factors. Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience. Similarly, high customer traffic, with spawn thresholds between 0.30 and 0.50, made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates. While the exact numbers and percentages may vary depending on specific scenarios, this simulation proved to be a useful tool for testing different security strategies. For Mr. Ha Son Do, it emphasizes the importance of placing guards strategically, optimizing store layouts, and focusing on guard training to improve theft prevention in a cost-effective and adaptable way.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
[[File:Obchod_zmeny.nlogo]]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=File:3_guards.png&amp;diff=26453</id>
		<title>File:3 guards.png</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=File:3_guards.png&amp;diff=26453"/>
		<updated>2025-01-10T22:02:04Z</updated>

		<summary type="html">&lt;p&gt;Holp11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=File:3_guards_1.png&amp;diff=26452</id>
		<title>File:3 guards 1.png</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=File:3_guards_1.png&amp;diff=26452"/>
		<updated>2025-01-10T22:01:46Z</updated>

		<summary type="html">&lt;p&gt;Holp11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26450</id>
		<title>Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26450"/>
		<updated>2025-01-10T22:00:14Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* 3 Guards */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 1.png]]&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
&lt;br /&gt;
[[File:3 guards 1.png]]&lt;br /&gt;
[[File:3 guards.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
In both simulations, 60% of thieves were captured, while 40% escaped, even with six guards patrolling the shop. This shows that the guards were effective to some extent. The number of conflicts changed. In Screenshot 1, there were 19 conflicts, while Screenshot 2 had 28 conflicts. This suggests that guards were more engaged in the second simulation, but it didn’t result in a better capture rate. This could indicate inefficiencies in how guards respond after spotting thieves. Thieves spent more time in the shop in the second simulation, with an average of 33.6 ticks compared to 24.6 ticks in the first.&lt;br /&gt;
The guard's efficiency also showed a notable difference. In Screenshot 1, efficiency was 5.9%, while in Screenshot 2, it improved to 18.3%. Having up to 20 customers in the store added complexity to the guards’ task. With so many people, guards struggled to differentiate between thieves and customers. This could explain why the escape rate remained consistent despite the increased guard activity in the second scenario.&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
In the first screenshot, 2 thieves were caught, while 4 escaped. In the second screenshot, guards performed significantly better, capturing 4 thieves with only 2 escaping. This improvement suggests better guard effectiveness, potentially due to better positioning .&lt;br /&gt;
Conflicts more than doubled, rising from 10 in the first screenshot to 21 in the second screenshot. This indicates that guards were more actively engaging with thieves, which contributed to the higher capture rate.&lt;br /&gt;
The average time thieves spent in the shop decreased from 44 ticks in the first screenshot to 31.33 ticks in the second screenshot. This shows that guards were quicker at detecting and responding to thieves in the second scenario.&lt;br /&gt;
Despite the improvements, guard efficiency was very low in both screenshots—1.8% in the first screenshot and 3.8% in the second screenshot&lt;br /&gt;
With 15 customers in the store, guards faced difficulties distinguishing between thieves and shoppers. This added complexity likely led to lower capture rates and efficiency, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analysing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example, in a small store with two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8% but escapes still occurred. Additionally, thieves spent an average of 22 to 44 ticks in the store, depending on factors like steal delay. Shorter delays allowed thieves to escape faster, while longer ones gave guards more chances.&lt;br /&gt;
Store layout and customer traffic were also crucial factors. Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience. Similarly, high customer traffic, with spawn thresholds between 0.30 and 0.50, made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates. While the exact numbers and percentages may vary depending on specific scenarios, this simulation proved to be a useful tool for testing different security strategies. For Mr. Ha Son Do, it emphasizes the importance of placing guards strategically, optimizing store layouts, and focusing on guard training to improve theft prevention in a cost-effective and adaptable way.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
[[File:Obchod_zmeny.nlogo]]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=File:Obchod_zmeny.nlogo&amp;diff=26449</id>
		<title>File:Obchod zmeny.nlogo</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=File:Obchod_zmeny.nlogo&amp;diff=26449"/>
		<updated>2025-01-10T21:58:03Z</updated>

		<summary type="html">&lt;p&gt;Holp11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26448</id>
		<title>Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26448"/>
		<updated>2025-01-10T21:57:48Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Downloadable Files */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 1.png]]&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
In both simulations, 60% of thieves were captured, while 40% escaped, even with six guards patrolling the shop. This shows that the guards were effective to some extent. The number of conflicts changed. In Screenshot 1, there were 19 conflicts, while Screenshot 2 had 28 conflicts. This suggests that guards were more engaged in the second simulation, but it didn’t result in a better capture rate. This could indicate inefficiencies in how guards respond after spotting thieves. Thieves spent more time in the shop in the second simulation, with an average of 33.6 ticks compared to 24.6 ticks in the first.&lt;br /&gt;
The guard's efficiency also showed a notable difference. In Screenshot 1, efficiency was 5.9%, while in Screenshot 2, it improved to 18.3%. Having up to 20 customers in the store added complexity to the guards’ task. With so many people, guards struggled to differentiate between thieves and customers. This could explain why the escape rate remained consistent despite the increased guard activity in the second scenario.&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
In the first screenshot, 2 thieves were caught, while 4 escaped. In the second screenshot, guards performed significantly better, capturing 4 thieves with only 2 escaping. This improvement suggests better guard effectiveness, potentially due to better positioning .&lt;br /&gt;
Conflicts more than doubled, rising from 10 in the first screenshot to 21 in the second screenshot. This indicates that guards were more actively engaging with thieves, which contributed to the higher capture rate.&lt;br /&gt;
The average time thieves spent in the shop decreased from 44 ticks in the first screenshot to 31.33 ticks in the second screenshot. This shows that guards were quicker at detecting and responding to thieves in the second scenario.&lt;br /&gt;
Despite the improvements, guard efficiency was very low in both screenshots—1.8% in the first screenshot and 3.8% in the second screenshot&lt;br /&gt;
With 15 customers in the store, guards faced difficulties distinguishing between thieves and shoppers. This added complexity likely led to lower capture rates and efficiency, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analysing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example, in a small store with two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8% but escapes still occurred. Additionally, thieves spent an average of 22 to 44 ticks in the store, depending on factors like steal delay. Shorter delays allowed thieves to escape faster, while longer ones gave guards more chances.&lt;br /&gt;
Store layout and customer traffic were also crucial factors. Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience. Similarly, high customer traffic, with spawn thresholds between 0.30 and 0.50, made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates. While the exact numbers and percentages may vary depending on specific scenarios, this simulation proved to be a useful tool for testing different security strategies. For Mr. Ha Son Do, it emphasizes the importance of placing guards strategically, optimizing store layouts, and focusing on guard training to improve theft prevention in a cost-effective and adaptable way.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
[[File:Obchod_zmeny.nlogo]]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=File:Small_world,_guard_speed_2_and_2_guards_2.png&amp;diff=26447</id>
		<title>File:Small world, guard speed 2 and 2 guards 2.png</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=File:Small_world,_guard_speed_2_and_2_guards_2.png&amp;diff=26447"/>
		<updated>2025-01-10T21:56:11Z</updated>

		<summary type="html">&lt;p&gt;Holp11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26446</id>
		<title>Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26446"/>
		<updated>2025-01-10T21:55:05Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Simulation Results with Analysis */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 1.png]]&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 2.png]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
In both simulations, 60% of thieves were captured, while 40% escaped, even with six guards patrolling the shop. This shows that the guards were effective to some extent. The number of conflicts changed. In Screenshot 1, there were 19 conflicts, while Screenshot 2 had 28 conflicts. This suggests that guards were more engaged in the second simulation, but it didn’t result in a better capture rate. This could indicate inefficiencies in how guards respond after spotting thieves. Thieves spent more time in the shop in the second simulation, with an average of 33.6 ticks compared to 24.6 ticks in the first.&lt;br /&gt;
The guard's efficiency also showed a notable difference. In Screenshot 1, efficiency was 5.9%, while in Screenshot 2, it improved to 18.3%. Having up to 20 customers in the store added complexity to the guards’ task. With so many people, guards struggled to differentiate between thieves and customers. This could explain why the escape rate remained consistent despite the increased guard activity in the second scenario.&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
In the first screenshot, 2 thieves were caught, while 4 escaped. In the second screenshot, guards performed significantly better, capturing 4 thieves with only 2 escaping. This improvement suggests better guard effectiveness, potentially due to better positioning .&lt;br /&gt;
Conflicts more than doubled, rising from 10 in the first screenshot to 21 in the second screenshot. This indicates that guards were more actively engaging with thieves, which contributed to the higher capture rate.&lt;br /&gt;
The average time thieves spent in the shop decreased from 44 ticks in the first screenshot to 31.33 ticks in the second screenshot. This shows that guards were quicker at detecting and responding to thieves in the second scenario.&lt;br /&gt;
Despite the improvements, guard efficiency was very low in both screenshots—1.8% in the first screenshot and 3.8% in the second screenshot&lt;br /&gt;
With 15 customers in the store, guards faced difficulties distinguishing between thieves and shoppers. This added complexity likely led to lower capture rates and efficiency, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analysing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example, in a small store with two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8% but escapes still occurred. Additionally, thieves spent an average of 22 to 44 ticks in the store, depending on factors like steal delay. Shorter delays allowed thieves to escape faster, while longer ones gave guards more chances.&lt;br /&gt;
Store layout and customer traffic were also crucial factors. Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience. Similarly, high customer traffic, with spawn thresholds between 0.30 and 0.50, made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates. While the exact numbers and percentages may vary depending on specific scenarios, this simulation proved to be a useful tool for testing different security strategies. For Mr. Ha Son Do, it emphasizes the importance of placing guards strategically, optimizing store layouts, and focusing on guard training to improve theft prevention in a cost-effective and adaptable way.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=File:Small_world,_guard_speed_2_and_2_guards_1.png&amp;diff=26442</id>
		<title>File:Small world, guard speed 2 and 2 guards 1.png</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=File:Small_world,_guard_speed_2_and_2_guards_1.png&amp;diff=26442"/>
		<updated>2025-01-10T21:53:53Z</updated>

		<summary type="html">&lt;p&gt;Holp11: Holp11 uploaded a new version of File:Small world, guard speed 2 and 2 guards 1.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=File:Small_world,_guard_speed_2_and_2_guards_1.png&amp;diff=26440</id>
		<title>File:Small world, guard speed 2 and 2 guards 1.png</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=File:Small_world,_guard_speed_2_and_2_guards_1.png&amp;diff=26440"/>
		<updated>2025-01-10T21:50:12Z</updated>

		<summary type="html">&lt;p&gt;Holp11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26439</id>
		<title>Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26439"/>
		<updated>2025-01-10T21:49:54Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Small World, Guard Speed 2, and 2 Guards */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
[[File:Small world, guard speed 2 and 2 guards 1.png]]&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
In both simulations, 60% of thieves were captured, while 40% escaped, even with six guards patrolling the shop. This shows that the guards were effective to some extent. The number of conflicts changed. In Screenshot 1, there were 19 conflicts, while Screenshot 2 had 28 conflicts. This suggests that guards were more engaged in the second simulation, but it didn’t result in a better capture rate. This could indicate inefficiencies in how guards respond after spotting thieves. Thieves spent more time in the shop in the second simulation, with an average of 33.6 ticks compared to 24.6 ticks in the first.&lt;br /&gt;
The guard's efficiency also showed a notable difference. In Screenshot 1, efficiency was 5.9%, while in Screenshot 2, it improved to 18.3%. Having up to 20 customers in the store added complexity to the guards’ task. With so many people, guards struggled to differentiate between thieves and customers. This could explain why the escape rate remained consistent despite the increased guard activity in the second scenario.&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
In the first screenshot, 2 thieves were caught, while 4 escaped. In the second screenshot, guards performed significantly better, capturing 4 thieves with only 2 escaping. This improvement suggests better guard effectiveness, potentially due to better positioning .&lt;br /&gt;
Conflicts more than doubled, rising from 10 in the first screenshot to 21 in the second screenshot. This indicates that guards were more actively engaging with thieves, which contributed to the higher capture rate.&lt;br /&gt;
The average time thieves spent in the shop decreased from 44 ticks in the first screenshot to 31.33 ticks in the second screenshot. This shows that guards were quicker at detecting and responding to thieves in the second scenario.&lt;br /&gt;
Despite the improvements, guard efficiency was very low in both screenshots—1.8% in the first screenshot and 3.8% in the second screenshot&lt;br /&gt;
With 15 customers in the store, guards faced difficulties distinguishing between thieves and shoppers. This added complexity likely led to lower capture rates and efficiency, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analysing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example, in a small store with two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8% but escapes still occurred. Additionally, thieves spent an average of 22 to 44 ticks in the store, depending on factors like steal delay. Shorter delays allowed thieves to escape faster, while longer ones gave guards more chances.&lt;br /&gt;
Store layout and customer traffic were also crucial factors. Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience. Similarly, high customer traffic, with spawn thresholds between 0.30 and 0.50, made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates. While the exact numbers and percentages may vary depending on specific scenarios, this simulation proved to be a useful tool for testing different security strategies. For Mr. Ha Son Do, it emphasizes the importance of placing guards strategically, optimizing store layouts, and focusing on guard training to improve theft prevention in a cost-effective and adaptable way.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26438</id>
		<title>Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Simulation_of_Security_Efficiency_in_a_Store:_Analyzing_Optimal_Guard_Allocation_Based_on_Obstruction_and_Escape_Dynamics&amp;diff=26438"/>
		<updated>2025-01-10T21:47:23Z</updated>

		<summary type="html">&lt;p&gt;Holp11: Created page with &amp;quot;= Simulation of Security Efficiency in a Store =  == Introduction == This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
In both simulations, 60% of thieves were captured, while 40% escaped, even with six guards patrolling the shop. This shows that the guards were effective to some extent. The number of conflicts changed. In Screenshot 1, there were 19 conflicts, while Screenshot 2 had 28 conflicts. This suggests that guards were more engaged in the second simulation, but it didn’t result in a better capture rate. This could indicate inefficiencies in how guards respond after spotting thieves. Thieves spent more time in the shop in the second simulation, with an average of 33.6 ticks compared to 24.6 ticks in the first.&lt;br /&gt;
The guard's efficiency also showed a notable difference. In Screenshot 1, efficiency was 5.9%, while in Screenshot 2, it improved to 18.3%. Having up to 20 customers in the store added complexity to the guards’ task. With so many people, guards struggled to differentiate between thieves and customers. This could explain why the escape rate remained consistent despite the increased guard activity in the second scenario.&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
In the first screenshot, 2 thieves were caught, while 4 escaped. In the second screenshot, guards performed significantly better, capturing 4 thieves with only 2 escaping. This improvement suggests better guard effectiveness, potentially due to better positioning .&lt;br /&gt;
Conflicts more than doubled, rising from 10 in the first screenshot to 21 in the second screenshot. This indicates that guards were more actively engaging with thieves, which contributed to the higher capture rate.&lt;br /&gt;
The average time thieves spent in the shop decreased from 44 ticks in the first screenshot to 31.33 ticks in the second screenshot. This shows that guards were quicker at detecting and responding to thieves in the second scenario.&lt;br /&gt;
Despite the improvements, guard efficiency was very low in both screenshots—1.8% in the first screenshot and 3.8% in the second screenshot&lt;br /&gt;
With 15 customers in the store, guards faced difficulties distinguishing between thieves and shoppers. This added complexity likely led to lower capture rates and efficiency, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analysing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example, in a small store with two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8% but escapes still occurred. Additionally, thieves spent an average of 22 to 44 ticks in the store, depending on factors like steal delay. Shorter delays allowed thieves to escape faster, while longer ones gave guards more chances.&lt;br /&gt;
Store layout and customer traffic were also crucial factors. Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience. Similarly, high customer traffic, with spawn thresholds between 0.30 and 0.50, made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates. While the exact numbers and percentages may vary depending on specific scenarios, this simulation proved to be a useful tool for testing different security strategies. For Mr. Ha Son Do, it emphasizes the importance of placing guards strategically, optimizing store layouts, and focusing on guard training to improve theft prevention in a cost-effective and adaptable way.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=WS_2024/2025&amp;diff=26437</id>
		<title>WS 2024/2025</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=WS_2024/2025&amp;diff=26437"/>
		<updated>2025-01-10T21:46:14Z</updated>

		<summary type="html">&lt;p&gt;Holp11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Semestral papers from winter term 2023/2024. Please, put here links to the pages with your paper. First you need to have your [[Assignments WS 2024/2025|assignment approved]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Simulations==&lt;br /&gt;
&lt;br /&gt;
--[[User:Filip Simulátor|Filip Simulátor]] ([[User talk:Filip Simulátor|talk]]) 21:37, 3 January 2025 (CET) Lightning Network Channel Dynamics Simulation (NetLogo): [[Lightning Network Channel Dynamics Simulation (NetLogo)]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Matj27|Matj27]] ([[User talk:Matj27|talk]]) 16:06, 2 January 2025 (CET) Performance of Solar Power Plant Based on ERA5 Data: [[Performance of Solar Power Plant Based on ERA5 Data]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Cesj05|Cesj05]] ([[User talk:Cesj05|talk]]) 11:05, 1 January 2025 (CET) Garden simulation:[[Garden simulation]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Tara04|Tara04]] ([[User talk:Tara04|talk]]) 20:24, 9 January 2025 (CET) Hybrid Work Dynamics: [[Hybrid Work Dynamics]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Omaj01|Omaj01]] ([[User talk:Omaj01|talk]]) 20:55, 9 January 2025 (CET) Simulation of pension reform in the Czech Republic: Analysis of long-term sustainability: [[Pension System Czech Republic]]&lt;br /&gt;
&lt;br /&gt;
-- [[User:Sim timm03|Sim timm03]] ([[User talk:Sim timm03|talk]]) 19:36, 10 January 2025 (CET) Traffic Accident Risk Analysis: [[Traffic Accident Risk Analysis]]&lt;br /&gt;
&lt;br /&gt;
-- [[User:Stej34|Stej34]] ([[User talk:Stej34|talk]]) 20:46, 10 January 2025 (CET) Urban Traffic Flow Optimization: [[Urban Traffic Flow Optimization]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Lozd00|Lozd00]] ([[User talk:Lozd00|talk]]) 20:57, 10 January 2025 (CET) Bee Foraging Behavior: [[Bee Foraging Behavior]]&lt;br /&gt;
&lt;br /&gt;
-- [[User:Holp11|Holp11]] ([[User talk:Holp11|talk]]) 22:46, 10 January 2025 (CET) Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics : [[Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics]]&lt;br /&gt;
&lt;br /&gt;
-- [[User:Misd01|Misd01]] ([[User talk:Misd01|talk]]) 22:14, 10 January 2025 (CET) Birds Beahvior Simulation [[Birds behavior]]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26431</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26431"/>
		<updated>2025-01-10T21:38:39Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Possible Model Extensions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
In both simulations, 60% of thieves were captured, while 40% escaped, even with six guards patrolling the shop. This shows that the guards were effective to some extent. The number of conflicts changed. In Screenshot 1, there were 19 conflicts, while Screenshot 2 had 28 conflicts. This suggests that guards were more engaged in the second simulation, but it didn’t result in a better capture rate. This could indicate inefficiencies in how guards respond after spotting thieves. Thieves spent more time in the shop in the second simulation, with an average of 33.6 ticks compared to 24.6 ticks in the first.&lt;br /&gt;
The guard's efficiency also showed a notable difference. In Screenshot 1, efficiency was 5.9%, while in Screenshot 2, it improved to 18.3%. Having up to 20 customers in the store added complexity to the guards’ task. With so many people, guards struggled to differentiate between thieves and customers. This could explain why the escape rate remained consistent despite the increased guard activity in the second scenario.&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
In the first screenshot, 2 thieves were caught, while 4 escaped. In the second screenshot, guards performed significantly better, capturing 4 thieves with only 2 escaping. This improvement suggests better guard effectiveness, potentially due to better positioning .&lt;br /&gt;
Conflicts more than doubled, rising from 10 in the first screenshot to 21 in the second screenshot. This indicates that guards were more actively engaging with thieves, which contributed to the higher capture rate.&lt;br /&gt;
The average time thieves spent in the shop decreased from 44 ticks in the first screenshot to 31.33 ticks in the second screenshot. This shows that guards were quicker at detecting and responding to thieves in the second scenario.&lt;br /&gt;
Despite the improvements, guard efficiency was very low in both screenshots—1.8% in the first screenshot and 3.8% in the second screenshot&lt;br /&gt;
With 15 customers in the store, guards faced difficulties distinguishing between thieves and shoppers. This added complexity likely led to lower capture rates and efficiency, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analysing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example, in a small store with two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8% but escapes still occurred. Additionally, thieves spent an average of 22 to 44 ticks in the store, depending on factors like steal delay. Shorter delays allowed thieves to escape faster, while longer ones gave guards more chances.&lt;br /&gt;
Store layout and customer traffic were also crucial factors. Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience. Similarly, high customer traffic, with spawn thresholds between 0.30 and 0.50, made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates. While the exact numbers and percentages may vary depending on specific scenarios, this simulation proved to be a useful tool for testing different security strategies. For Mr. Ha Son Do, it emphasizes the importance of placing guards strategically, optimizing store layouts, and focusing on guard training to improve theft prevention in a cost-effective and adaptable way.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26429</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26429"/>
		<updated>2025-01-10T21:36:39Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* References */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
In both simulations, 60% of thieves were captured, while 40% escaped, even with six guards patrolling the shop. This shows that the guards were effective to some extent. The number of conflicts changed. In Screenshot 1, there were 19 conflicts, while Screenshot 2 had 28 conflicts. This suggests that guards were more engaged in the second simulation, but it didn’t result in a better capture rate. This could indicate inefficiencies in how guards respond after spotting thieves. Thieves spent more time in the shop in the second simulation, with an average of 33.6 ticks compared to 24.6 ticks in the first.&lt;br /&gt;
The guard's efficiency also showed a notable difference. In Screenshot 1, efficiency was 5.9%, while in Screenshot 2, it improved to 18.3%. Having up to 20 customers in the store added complexity to the guards’ task. With so many people, guards struggled to differentiate between thieves and customers. This could explain why the escape rate remained consistent despite the increased guard activity in the second scenario.&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
In the first screenshot, 2 thieves were caught, while 4 escaped. In the second screenshot, guards performed significantly better, capturing 4 thieves with only 2 escaping. This improvement suggests better guard effectiveness, potentially due to better positioning .&lt;br /&gt;
Conflicts more than doubled, rising from 10 in the first screenshot to 21 in the second screenshot. This indicates that guards were more actively engaging with thieves, which contributed to the higher capture rate.&lt;br /&gt;
The average time thieves spent in the shop decreased from 44 ticks in the first screenshot to 31.33 ticks in the second screenshot. This shows that guards were quicker at detecting and responding to thieves in the second scenario.&lt;br /&gt;
Despite the improvements, guard efficiency was very low in both screenshots—1.8% in the first screenshot and 3.8% in the second screenshot&lt;br /&gt;
With 15 customers in the store, guards faced difficulties distinguishing between thieves and shoppers. This added complexity likely led to lower capture rates and efficiency, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analysing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example, in a small store with two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8% but escapes still occurred. Additionally, thieves spent an average of 22 to 44 ticks in the store, depending on factors like steal delay. Shorter delays allowed thieves to escape faster, while longer ones gave guards more chances.&lt;br /&gt;
Store layout and customer traffic were also crucial factors. Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience. Similarly, high customer traffic, with spawn thresholds between 0.30 and 0.50, made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates. While the exact numbers and percentages may vary depending on specific scenarios, this simulation proved to be a useful tool for testing different security strategies. For Mr. Ha Son Do, it emphasizes the importance of placing guards strategically, optimizing store layouts, and focusing on guard training to improve theft prevention in a cost-effective and adaptable way.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26428</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26428"/>
		<updated>2025-01-10T21:36:02Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Conclusion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
In both simulations, 60% of thieves were captured, while 40% escaped, even with six guards patrolling the shop. This shows that the guards were effective to some extent. The number of conflicts changed. In Screenshot 1, there were 19 conflicts, while Screenshot 2 had 28 conflicts. This suggests that guards were more engaged in the second simulation, but it didn’t result in a better capture rate. This could indicate inefficiencies in how guards respond after spotting thieves. Thieves spent more time in the shop in the second simulation, with an average of 33.6 ticks compared to 24.6 ticks in the first.&lt;br /&gt;
The guard's efficiency also showed a notable difference. In Screenshot 1, efficiency was 5.9%, while in Screenshot 2, it improved to 18.3%. Having up to 20 customers in the store added complexity to the guards’ task. With so many people, guards struggled to differentiate between thieves and customers. This could explain why the escape rate remained consistent despite the increased guard activity in the second scenario.&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
In the first screenshot, 2 thieves were caught, while 4 escaped. In the second screenshot, guards performed significantly better, capturing 4 thieves with only 2 escaping. This improvement suggests better guard effectiveness, potentially due to better positioning .&lt;br /&gt;
Conflicts more than doubled, rising from 10 in the first screenshot to 21 in the second screenshot. This indicates that guards were more actively engaging with thieves, which contributed to the higher capture rate.&lt;br /&gt;
The average time thieves spent in the shop decreased from 44 ticks in the first screenshot to 31.33 ticks in the second screenshot. This shows that guards were quicker at detecting and responding to thieves in the second scenario.&lt;br /&gt;
Despite the improvements, guard efficiency was very low in both screenshots—1.8% in the first screenshot and 3.8% in the second screenshot&lt;br /&gt;
With 15 customers in the store, guards faced difficulties distinguishing between thieves and shoppers. This added complexity likely led to lower capture rates and efficiency, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analysing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example, in a small store with two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8% but escapes still occurred. Additionally, thieves spent an average of 22 to 44 ticks in the store, depending on factors like steal delay. Shorter delays allowed thieves to escape faster, while longer ones gave guards more chances.&lt;br /&gt;
Store layout and customer traffic were also crucial factors. Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience. Similarly, high customer traffic, with spawn thresholds between 0.30 and 0.50, made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates. While the exact numbers and percentages may vary depending on specific scenarios, this simulation proved to be a useful tool for testing different security strategies. For Mr. Ha Son Do, it emphasizes the importance of placing guards strategically, optimizing store layouts, and focusing on guard training to improve theft prevention in a cost-effective and adaptable way.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26427</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26427"/>
		<updated>2025-01-10T21:35:39Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Second Large World */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
In both simulations, 60% of thieves were captured, while 40% escaped, even with six guards patrolling the shop. This shows that the guards were effective to some extent. The number of conflicts changed. In Screenshot 1, there were 19 conflicts, while Screenshot 2 had 28 conflicts. This suggests that guards were more engaged in the second simulation, but it didn’t result in a better capture rate. This could indicate inefficiencies in how guards respond after spotting thieves. Thieves spent more time in the shop in the second simulation, with an average of 33.6 ticks compared to 24.6 ticks in the first.&lt;br /&gt;
The guard's efficiency also showed a notable difference. In Screenshot 1, efficiency was 5.9%, while in Screenshot 2, it improved to 18.3%. Having up to 20 customers in the store added complexity to the guards’ task. With so many people, guards struggled to differentiate between thieves and customers. This could explain why the escape rate remained consistent despite the increased guard activity in the second scenario.&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
In the first screenshot, 2 thieves were caught, while 4 escaped. In the second screenshot, guards performed significantly better, capturing 4 thieves with only 2 escaping. This improvement suggests better guard effectiveness, potentially due to better positioning .&lt;br /&gt;
Conflicts more than doubled, rising from 10 in the first screenshot to 21 in the second screenshot. This indicates that guards were more actively engaging with thieves, which contributed to the higher capture rate.&lt;br /&gt;
The average time thieves spent in the shop decreased from 44 ticks in the first screenshot to 31.33 ticks in the second screenshot. This shows that guards were quicker at detecting and responding to thieves in the second scenario.&lt;br /&gt;
Despite the improvements, guard efficiency was very low in both screenshots—1.8% in the first screenshot and 3.8% in the second screenshot&lt;br /&gt;
With 15 customers in the store, guards faced difficulties distinguishing between thieves and shoppers. This added complexity likely led to lower capture rates and efficiency, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26426</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26426"/>
		<updated>2025-01-10T21:35:17Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Large World */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
In both simulations, 60% of thieves were captured, while 40% escaped, even with six guards patrolling the shop. This shows that the guards were effective to some extent. The number of conflicts changed. In Screenshot 1, there were 19 conflicts, while Screenshot 2 had 28 conflicts. This suggests that guards were more engaged in the second simulation, but it didn’t result in a better capture rate. This could indicate inefficiencies in how guards respond after spotting thieves. Thieves spent more time in the shop in the second simulation, with an average of 33.6 ticks compared to 24.6 ticks in the first.&lt;br /&gt;
The guard's efficiency also showed a notable difference. In Screenshot 1, efficiency was 5.9%, while in Screenshot 2, it improved to 18.3%. Having up to 20 customers in the store added complexity to the guards’ task. With so many people, guards struggled to differentiate between thieves and customers. This could explain why the escape rate remained consistent despite the increased guard activity in the second scenario.&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
* '''Captured Thieves''': 2–4&lt;br /&gt;
* '''Escaped Thieves''': 2–4&lt;br /&gt;
* '''Conflicts''': 10–21 interactions&lt;br /&gt;
* '''Average Time in Shop''': 31.33–44 ticks&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26425</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26425"/>
		<updated>2025-01-10T21:34:44Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* 3 Guards and 10 Customers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
In both screenshots, only 40% of thieves were caught, while 60% escaped. Despite having three guards, the thieves still managed to evade capture more often than not, highlighting how challenging it is to achieve full coverage of the shop.&lt;br /&gt;
The number of conflicts (instances where guards spotted thieves) were higher in Screenshot 2 (15) compared to Screenshot 1 (11). This could be due to differences in how the guards and thieves moved or interacted.&lt;br /&gt;
On average, thieves spent about 25-26 ticks in the shop before either being captured or escaping. This suggests that guards were relatively quick to respond but could benefit from slight improvements in speed or strategy.&lt;br /&gt;
The guard's efficiency was low in both scenarios, with values of 5.8% and 4.2%. This indicates that while guards were active, they weren't being utilized to their full potential, possibly due to their positioning or the number of customers in the shop.&lt;br /&gt;
The presence of up to 10 customers likely added complexity to the simulation. With more people in the shop, guards might have had a harder time distinguishing thieves from customers, leading to more escapes.&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 19–28 interactions&lt;br /&gt;
* '''Average Time in Shop''': 24.6–33.6 ticks&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
* '''Captured Thieves''': 2–4&lt;br /&gt;
* '''Escaped Thieves''': 2–4&lt;br /&gt;
* '''Conflicts''': 10–21 interactions&lt;br /&gt;
* '''Average Time in Shop''': 31.33–44 ticks&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26424</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26424"/>
		<updated>2025-01-10T21:34:13Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* 3 Guards */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In Screenshot 1, the caught 60% of the thieves. However, in Screenshot 2, they only managed to capture 20%, which shows that their performance wasn’t consistent. This difference might be because of how the guards were positioned or the random movements of the thieves.&lt;br /&gt;
The guards were clearly more active in Screenshot 1, with 26 conflicts recorded. In Screenshot 2, there were only 5 conflicts, which means the guards either didn’t spot the thieves as often or weren’t as engaged.&lt;br /&gt;
On average, thieves spent less time in the shop in Screenshot 1 (20.2 ticks) compared to Screenshot 2 (25.6 ticks). This shows that guards in Screenshot 1 were better at interrupting the thieves’ activities and making them leave sooner.&lt;br /&gt;
In Screenshot 1, only 2 thieves escaped (40%), while in Screenshot 2, 4 thieves escaped (80%). This suggests that the guards in Screenshot 1 were more effective at preventing thefts.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 15 interactions&lt;br /&gt;
* '''Average Time in Shop''': 25–26 ticks&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 19–28 interactions&lt;br /&gt;
* '''Average Time in Shop''': 24.6–33.6 ticks&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
* '''Captured Thieves''': 2–4&lt;br /&gt;
* '''Escaped Thieves''': 2–4&lt;br /&gt;
* '''Conflicts''': 10–21 interactions&lt;br /&gt;
* '''Average Time in Shop''': 31.33–44 ticks&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26422</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26422"/>
		<updated>2025-01-10T21:33:22Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Small World, Guard Speed 2, and 2 Guards */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
Analysis:&lt;br /&gt;
In the first screenshot, 2 thieves were captured (40%), while 3 thieves escaped (60%). This suggests improved guard effectiveness in the second scenario.&lt;br /&gt;
Conflicts, representing guard-thief interactions, increased slightly from 8 in the first screenshot to 9 in the second screenshot. This indicates a marginally more active engagement between guards and thieves.&lt;br /&gt;
Thieves spent an average of 28 ticks in the shop in the first screenshot, but this dropped to 22 ticks in the second. &lt;br /&gt;
Guard efficiency, measured by the percentage of time guards actively engaged with thieves, was low in both cases. It increased from 1.6% in the first screenshot to 4.8% in the second. &lt;br /&gt;
With 5 customers in the shop, the guards faced challenges in differentiating between thieves and shoppers. This complexity likely affected the guard´s overall performance, especially in the first screenshot.&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 26 interactions&lt;br /&gt;
* '''Average Time in Shop''': 20.2 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 15 interactions&lt;br /&gt;
* '''Average Time in Shop''': 25–26 ticks&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 19–28 interactions&lt;br /&gt;
* '''Average Time in Shop''': 24.6–33.6 ticks&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
* '''Captured Thieves''': 2–4&lt;br /&gt;
* '''Escaped Thieves''': 2–4&lt;br /&gt;
* '''Conflicts''': 10–21 interactions&lt;br /&gt;
* '''Average Time in Shop''': 31.33–44 ticks&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26421</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26421"/>
		<updated>2025-01-10T21:31:25Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Simulation User Interface */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
The user interface provides sliders for adjusting parameters, monitors for real-time metrics, and plots to visualize dynamics over time.&lt;br /&gt;
* '''Sliders''': Users can control key parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Displays real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualizes the number of guards, thieves, and customers in the shop over time using color-coded lines (yellow for guards, red for thieves, and blue for customers).&lt;br /&gt;
* '''Colour Indicators''':Guards are represented in yellow, thieves in red, customers in blue, and shelves in brown, allowing users to easily differentiate agents and obstacles&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 9 interactions&lt;br /&gt;
* '''Average Time in Shop''': 22 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 26 interactions&lt;br /&gt;
* '''Average Time in Shop''': 20.2 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 15 interactions&lt;br /&gt;
* '''Average Time in Shop''': 25–26 ticks&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 19–28 interactions&lt;br /&gt;
* '''Average Time in Shop''': 24.6–33.6 ticks&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
* '''Captured Thieves''': 2–4&lt;br /&gt;
* '''Escaped Thieves''': 2–4&lt;br /&gt;
* '''Conflicts''': 10–21 interactions&lt;br /&gt;
* '''Average Time in Shop''': 31.33–44 ticks&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26420</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26420"/>
		<updated>2025-01-10T21:29:47Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Tracked Indicators */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Definition: The total number of thieves caught by guards during the simulation.&lt;br /&gt;
Displayed Value: The number is shown in the box labelled &amp;quot;Captured thieves&amp;quot;.&lt;br /&gt;
Usage: Tracks guard efficiency in stopping thefts.&lt;br /&gt;
.&lt;br /&gt;
* '''Captured Thieves Percentage''': Definition: The percentage of thieves caught out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Captured thieves percentage&amp;quot;&lt;br /&gt;
Calculation: Captured Thieves Percentage = (Captured Thieves / Total Thieves) × 100&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves''': Definition: The total number of thieves who successfully left the store after stealing.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Escaped thieves&amp;quot;&lt;br /&gt;
Usage: Tracks how many thieves bypass guards and successfully exit.&lt;br /&gt;
&lt;br /&gt;
* '''Escaped Thieves Percentage''': Definition: The percentage of thieves who escaped out of the total number of thieves in the simulation.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Escaped thieves percentage&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Escaped Thieves Percentage = (Escaped Thieves / Total Thieves) × 100&lt;br /&gt;
.&lt;br /&gt;
* '''People in Shop (Graph)''': Definition: A real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
Displayed Value: &lt;br /&gt;
  Red Line: Number of thieves in the shop &lt;br /&gt;
  Blue Line: Number of customers in the shop &lt;br /&gt;
 Yellow Line: Number of guards in the &lt;br /&gt;
&lt;br /&gt;
* '''Thieves ''': Definition: The current count of thieves present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Thieves&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Customers''': Definition: The current count of customers present in the shop at any given time.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Customers&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Guards''':Definition: The total number of guards present in the shop, fixed as per the simulation parameters.&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Guards&amp;quot; &lt;br /&gt;
&lt;br /&gt;
* '''Conflicts''': Definition: The total number of interactions between guards and thieves (guards spotting or chasing thieves).&lt;br /&gt;
Displayed Value: Shown in the box labelled &amp;quot;Conflicts&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Thieves Average Time in Shop'': Definition: The average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Thieves average time in shop&amp;quot;&lt;br /&gt;
Calculation: &lt;br /&gt;
Thieves Average Time = Total Time Thieves Spend in Shop / (Captured Thieves + Escaped Thieves)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Use of Guards Percentage''': Definition: Represents how effectively guards are being utilized in the simulation, likely based on the time they spend actively chasing thieves.&lt;br /&gt;
Displayed Value: Shown in &amp;quot;Use of guards percentage&amp;quot;&lt;br /&gt;
Calculation: Use of Guards Percentage = (Active Guard Time (Chasing Thieves) / Total Guard Time) × 100&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
* '''Sliders''': Control parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Display real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualize the number of guards, thieves, and customers in the shop over time using color-coded lines.&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 9 interactions&lt;br /&gt;
* '''Average Time in Shop''': 22 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 26 interactions&lt;br /&gt;
* '''Average Time in Shop''': 20.2 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 15 interactions&lt;br /&gt;
* '''Average Time in Shop''': 25–26 ticks&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 19–28 interactions&lt;br /&gt;
* '''Average Time in Shop''': 24.6–33.6 ticks&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
* '''Captured Thieves''': 2–4&lt;br /&gt;
* '''Escaped Thieves''': 2–4&lt;br /&gt;
* '''Conflicts''': 10–21 interactions&lt;br /&gt;
* '''Average Time in Shop''': 31.33–44 ticks&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26416</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26416"/>
		<updated>2025-01-10T21:24:56Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Input Parameters of the Model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': Time required for a thief to steal from a shelf. Based on an interview with the owner, it can be set between 5 and 80. Realistically speaking, very low number of Steal Delay would make guards ineffective, as thieves can steal and escape quickly.&lt;br /&gt;
On the other side, very high number might discourage thieves entirely, as the simulation would overly favour the guards.&lt;br /&gt;
&lt;br /&gt;
* '''Spot While Stealing Threshold''': The probability of a guard spotting a thief while the thief is actively stealing items from a shelf. &lt;br /&gt;
A value of 0 means a guard will never spot a thief while stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief while stealing.&lt;br /&gt;
In the simulation it can be set from 0.7 to 1.0&lt;br /&gt;
The range for this parameter (0.7–1.0) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the store pay attention to the people close to the shelves.&lt;br /&gt;
&lt;br /&gt;
* '''Spot After Stealing Threshold''':  The probability of a guard spotting a thief after the thief has completed stealing and is moving toward the exit.&lt;br /&gt;
A value of 0 means a guard will never spot a thief after stealing.&lt;br /&gt;
A value of 1 means a guard will always spot a thief after stealing.&lt;br /&gt;
A value 0.05 would make guards almost unable to spot thieves after stealing, making the simulation too easy for thieves.&lt;br /&gt;
The range for this parameter (0.05–0.2) was determined based on an interview with Mr. Ha Son Do. During the interview. He mentioned that most of the guards in the stores are older and tend to pay less attention while working. This behaviour was taken into account to make the simulation reflect real-world conditions.&lt;br /&gt;
&lt;br /&gt;
* '''Leave Threshold''': The probability that a thief will decide to leave the store after completing a theft. &lt;br /&gt;
A value of 0 means the thief will not leave voluntarily.&lt;br /&gt;
A value of 1 means the thief will immediately attempt to leave the store after stealing.&lt;br /&gt;
A possible problem while setting this simulation might happen here as well.&lt;br /&gt;
Setting a value 0.2 would mean that the thieves are less likely to leave the store voluntarily after stealing. This would make the scenario very unrealistic where thieves stay in the store and are increasing the likelihood of being caught.&lt;br /&gt;
On the other hand, a value 0.8 would mean that the thieves try to leave the store immediately after stealing. This would result in a scenario where guards have very low chance to interact with thieves and would make the guard´s presence almost ineffective.&lt;br /&gt;
In the simulation it can be set from 0.2 to 0.8.&lt;br /&gt;
&lt;br /&gt;
* '''Customer Spawn Threshold''': The threshold controls the frequency of customer spawns in the store. &lt;br /&gt;
A value of 0 means no new customers will spawn during the simulation.&lt;br /&gt;
A value of 1 means customers will spawn at every possible opportunity.&lt;br /&gt;
A problem might happen while setting 0.9 in a small world, because it would make the store overcrowded, so the interaction between guards and thieves would be very unrealistic.&lt;br /&gt;
On the other hand, having 0.1 may create almost an empty store.&lt;br /&gt;
In the simulation it can be set from 0.1 to 0.9.&lt;br /&gt;
&lt;br /&gt;
* '''Display Padding''': Adjusts the amount of padding around the displayed simulation world for better visualization.&lt;br /&gt;
Higher values increase the space around the world, making the environment visually easier to observe.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Width''': Determines the width of the shelves in the store.&lt;br /&gt;
Higher values make shelves wider, creating more obstacles.&lt;br /&gt;
The problem might occur while setting high values of the parameter Width and Height. For example when having width 16 and height 8, it would block most of the store, making movement nearly impossible and creating unrealistic scenarios where thieves and guards struggle to navigate.&lt;br /&gt;
In the simulation it can be set from 4 to 16.&lt;br /&gt;
&lt;br /&gt;
* '''Shelf Height''': Determines the height of the shelves in the store.&lt;br /&gt;
Higher values make shelves taller, blocking more visibility.&lt;br /&gt;
In the simulation it can be set from 2 to 8.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Min Space Between Shelves''': Sets the minimum space between shelves.&lt;br /&gt;
Lower values place shelves closer together, making the area more crowded.&lt;br /&gt;
Higher values create more open space, allowing easier movement.&lt;br /&gt;
The problems might happen when setting both extremes. Because the low values for example 2–3 make the store too crowded, blocking movement.&lt;br /&gt;
But on the other side, high values make the store too open, reducing the main challenge of obstacle.&lt;br /&gt;
In the simulation it can be set from 2 to 10.&lt;br /&gt;
&lt;br /&gt;
* '''Shop Delay''': The threshold adjusts the delay between simulation ticks to control the speed of the simulation visually.&lt;br /&gt;
Very low delays might make the simulation too fast to observe meaningful interactions.&lt;br /&gt;
But on the other hand, very high delays would make the simulation too slow, reducing user engagement.&lt;br /&gt;
In the simulation it can be set from 5 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Guard Speed''': Describes how fast guards move across the store &lt;br /&gt;
A low speed can make guards ineffective in catching thieves.&lt;br /&gt;
But on the other hand, High speed might result in guards constantly chasing thieves and reducing the challenge.&lt;br /&gt;
In the simulation, if the speed was set more than 3, it would make the guards almost like supermen.&lt;br /&gt;
In the simulation it can be set from 1 to 4.&lt;br /&gt;
&lt;br /&gt;
* '''Maximum Customers''': Sets the maximum number of customers allowed in the store.&lt;br /&gt;
Too many customers in a small world can create overcrowding and unrealistic movement.&lt;br /&gt;
On the side, very few customers make the store feel empty and less realistic.&lt;br /&gt;
In the simulation it can be set from 1 to 30.&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Rows''':Determines the number of horizontal rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the thieves more powerful because they could move more easily between shelves &lt;br /&gt;
On the other hand, Too many Rows would make the store overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small store from 1 to 3 rows.&lt;br /&gt;
In a Medium store from 1 to 5 rows.&lt;br /&gt;
And in the Large store from 1 to 7 rows.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
* '''Shelves Columns''':  Determines the number of vertical rows of shelves in the store. &lt;br /&gt;
Setting the values faces some problems as well. When setting very low number, it would reduce the number of obstacles, creating a very open store. It would make the guards more powerful due to minimal obstacles in their patrol paths.&lt;br /&gt;
On the other hand, Too Many Rows would make the store Overcrowded, especially in smaller world, making it difficult for all agents to move.&lt;br /&gt;
In the simulation it can be set like this:&lt;br /&gt;
In a Small and medium store from 1 to 2 columns.&lt;br /&gt;
And in a Large store from 1 to 3 columns.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Total number of thieves caught by guards.&lt;br /&gt;
* '''Captured Thieves Percentage''': Percentage of thieves caught.&lt;br /&gt;
* '''Escaped Thieves''': Total number of thieves who successfully left the store after stealing.&lt;br /&gt;
* '''Escaped Thieves Percentage''': Percentage of thieves who escaped.&lt;br /&gt;
* '''People in Shop (Graph)''': Real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
* '''Thieves Average Time in Shop''': Average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
* '''Use of Guards Percentage''': Represents how effectively guards are being utilized.&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
* '''Sliders''': Control parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Display real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualize the number of guards, thieves, and customers in the shop over time using color-coded lines.&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 9 interactions&lt;br /&gt;
* '''Average Time in Shop''': 22 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 26 interactions&lt;br /&gt;
* '''Average Time in Shop''': 20.2 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 15 interactions&lt;br /&gt;
* '''Average Time in Shop''': 25–26 ticks&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 19–28 interactions&lt;br /&gt;
* '''Average Time in Shop''': 24.6–33.6 ticks&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
* '''Captured Thieves''': 2–4&lt;br /&gt;
* '''Escaped Thieves''': 2–4&lt;br /&gt;
* '''Conflicts''': 10–21 interactions&lt;br /&gt;
* '''Average Time in Shop''': 31.33–44 ticks&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26415</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26415"/>
		<updated>2025-01-10T21:20:22Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Input Parameters of the Model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
Small word size equals to approx 76,5 square meters. Because 4x4 patches equal to 1 square meters.&lt;br /&gt;
Medium word size equals to approx. 117,5 square meters.&lt;br /&gt;
Large word size equals to approx. 166,5 square meters.&lt;br /&gt;
All these three world options were requested by Mr. Ha Son Do due to the fact that he has multiple stores.&lt;br /&gt;
&lt;br /&gt;
* '''Number of Guards''': It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 10.&lt;br /&gt;
In a small world, having 10 guards may result in immediate detection of thieves, effectively breaking the purpose of the simulation. &lt;br /&gt;
.&lt;br /&gt;
* '''Number of Thieves''':  It is adjustable, but based on the request from Mr. Ha Son Do, it can be set between 1 and 15.&lt;br /&gt;
* '''Guard Vision Range''': Based on an interview with the owner, it can be set between 5 and 20. &lt;br /&gt;
A problem might occur with a very high number of vision range in medium or small world, because the guards may cover almost the entire store, making the shelves totally irrelevant.&lt;br /&gt;
&lt;br /&gt;
* '''Steal Delay''': 5–80 ticks.&lt;br /&gt;
* '''Spot While Stealing Threshold''': 0.7–1.0.&lt;br /&gt;
* '''Spot After Stealing Threshold''': 0.05–0.2.&lt;br /&gt;
* '''Leave Threshold''': 0.2–0.8.&lt;br /&gt;
* '''Customer Spawn Threshold''': 0.1–0.9.&lt;br /&gt;
* '''Display Padding''': 2–8.&lt;br /&gt;
* '''Shelf Dimensions''': Width (4–16) and Height (2–8).&lt;br /&gt;
* '''Min Space Between Shelves''': 2–10.&lt;br /&gt;
* '''Shop Delay''': 5–30 ticks.&lt;br /&gt;
* '''Guard Speed''': 1–4.&lt;br /&gt;
* '''Maximum Customers''': 1–30.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Total number of thieves caught by guards.&lt;br /&gt;
* '''Captured Thieves Percentage''': Percentage of thieves caught.&lt;br /&gt;
* '''Escaped Thieves''': Total number of thieves who successfully left the store after stealing.&lt;br /&gt;
* '''Escaped Thieves Percentage''': Percentage of thieves who escaped.&lt;br /&gt;
* '''People in Shop (Graph)''': Real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
* '''Thieves Average Time in Shop''': Average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
* '''Use of Guards Percentage''': Represents how effectively guards are being utilized.&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
* '''Sliders''': Control parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Display real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualize the number of guards, thieves, and customers in the shop over time using color-coded lines.&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 9 interactions&lt;br /&gt;
* '''Average Time in Shop''': 22 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 26 interactions&lt;br /&gt;
* '''Average Time in Shop''': 20.2 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 15 interactions&lt;br /&gt;
* '''Average Time in Shop''': 25–26 ticks&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 19–28 interactions&lt;br /&gt;
* '''Average Time in Shop''': 24.6–33.6 ticks&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
* '''Captured Thieves''': 2–4&lt;br /&gt;
* '''Escaped Thieves''': 2–4&lt;br /&gt;
* '''Conflicts''': 10–21 interactions&lt;br /&gt;
* '''Average Time in Shop''': 31.33–44 ticks&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26414</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26414"/>
		<updated>2025-01-10T21:19:04Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Exits */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
Exits are predefined during initialization and visually marked with white patches for easy identification.&lt;br /&gt;
* '''Behaviour''': Once thieves finish stealing, they target the nearest exit and try to escape. Customers leave the store by targeting exits after shopping, simulating real-world behaviour.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
* '''Number of Guards''': Adjustable (1–10).&lt;br /&gt;
* '''Number of Thieves''': Adjustable (1–15).&lt;br /&gt;
* '''Guard Vision Range''': 5–20.&lt;br /&gt;
* '''Steal Delay''': 5–80 ticks.&lt;br /&gt;
* '''Spot While Stealing Threshold''': 0.7–1.0.&lt;br /&gt;
* '''Spot After Stealing Threshold''': 0.05–0.2.&lt;br /&gt;
* '''Leave Threshold''': 0.2–0.8.&lt;br /&gt;
* '''Customer Spawn Threshold''': 0.1–0.9.&lt;br /&gt;
* '''Display Padding''': 2–8.&lt;br /&gt;
* '''Shelf Dimensions''': Width (4–16) and Height (2–8).&lt;br /&gt;
* '''Min Space Between Shelves''': 2–10.&lt;br /&gt;
* '''Shop Delay''': 5–30 ticks.&lt;br /&gt;
* '''Guard Speed''': 1–4.&lt;br /&gt;
* '''Maximum Customers''': 1–30.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Total number of thieves caught by guards.&lt;br /&gt;
* '''Captured Thieves Percentage''': Percentage of thieves caught.&lt;br /&gt;
* '''Escaped Thieves''': Total number of thieves who successfully left the store after stealing.&lt;br /&gt;
* '''Escaped Thieves Percentage''': Percentage of thieves who escaped.&lt;br /&gt;
* '''People in Shop (Graph)''': Real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
* '''Thieves Average Time in Shop''': Average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
* '''Use of Guards Percentage''': Represents how effectively guards are being utilized.&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
* '''Sliders''': Control parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Display real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualize the number of guards, thieves, and customers in the shop over time using color-coded lines.&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 9 interactions&lt;br /&gt;
* '''Average Time in Shop''': 22 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 26 interactions&lt;br /&gt;
* '''Average Time in Shop''': 20.2 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 15 interactions&lt;br /&gt;
* '''Average Time in Shop''': 25–26 ticks&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 19–28 interactions&lt;br /&gt;
* '''Average Time in Shop''': 24.6–33.6 ticks&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
* '''Captured Thieves''': 2–4&lt;br /&gt;
* '''Escaped Thieves''': 2–4&lt;br /&gt;
* '''Conflicts''': 10–21 interactions&lt;br /&gt;
* '''Average Time in Shop''': 31.33–44 ticks&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26412</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26412"/>
		<updated>2025-01-10T21:16:43Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Shelves */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.The dimensions of shelves are defined by the shelfWidth and shelfHeight sliders. The number of shelves is controlled by the shelvesRows and shelvesColumns sliders, and the spacing between shelves is determined by the minSpaceBetween slider.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behaviour. Shelves also affect guard vision, as they block line-of-sight diagonally and straight.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
* '''Behavior''': Once thieves finish stealing, they target the nearest exit and try to escape.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
* '''Number of Guards''': Adjustable (1–10).&lt;br /&gt;
* '''Number of Thieves''': Adjustable (1–15).&lt;br /&gt;
* '''Guard Vision Range''': 5–20.&lt;br /&gt;
* '''Steal Delay''': 5–80 ticks.&lt;br /&gt;
* '''Spot While Stealing Threshold''': 0.7–1.0.&lt;br /&gt;
* '''Spot After Stealing Threshold''': 0.05–0.2.&lt;br /&gt;
* '''Leave Threshold''': 0.2–0.8.&lt;br /&gt;
* '''Customer Spawn Threshold''': 0.1–0.9.&lt;br /&gt;
* '''Display Padding''': 2–8.&lt;br /&gt;
* '''Shelf Dimensions''': Width (4–16) and Height (2–8).&lt;br /&gt;
* '''Min Space Between Shelves''': 2–10.&lt;br /&gt;
* '''Shop Delay''': 5–30 ticks.&lt;br /&gt;
* '''Guard Speed''': 1–4.&lt;br /&gt;
* '''Maximum Customers''': 1–30.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Total number of thieves caught by guards.&lt;br /&gt;
* '''Captured Thieves Percentage''': Percentage of thieves caught.&lt;br /&gt;
* '''Escaped Thieves''': Total number of thieves who successfully left the store after stealing.&lt;br /&gt;
* '''Escaped Thieves Percentage''': Percentage of thieves who escaped.&lt;br /&gt;
* '''People in Shop (Graph)''': Real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
* '''Thieves Average Time in Shop''': Average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
* '''Use of Guards Percentage''': Represents how effectively guards are being utilized.&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
* '''Sliders''': Control parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Display real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualize the number of guards, thieves, and customers in the shop over time using color-coded lines.&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 9 interactions&lt;br /&gt;
* '''Average Time in Shop''': 22 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 26 interactions&lt;br /&gt;
* '''Average Time in Shop''': 20.2 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 15 interactions&lt;br /&gt;
* '''Average Time in Shop''': 25–26 ticks&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 19–28 interactions&lt;br /&gt;
* '''Average Time in Shop''': 24.6–33.6 ticks&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
* '''Captured Thieves''': 2–4&lt;br /&gt;
* '''Escaped Thieves''': 2–4&lt;br /&gt;
* '''Conflicts''': 10–21 interactions&lt;br /&gt;
* '''Average Time in Shop''': 31.33–44 ticks&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26411</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26411"/>
		<updated>2025-01-10T21:15:42Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Customers */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behaviour. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf. When the customer is not leaving, customer dynamically select a shelf as his target and moves toward it.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''': Customers are not spawn continuously. The maximum number of customers allowed in the store is determined by the maxCustomers slider.&lt;br /&gt;
New customers spawn is based on the customerSpawnThreshold slider, which controls the probability of a new customer appearing in each tick&lt;br /&gt;
Customers spawn from a randomly selected exit, simulating real-world entrance behaviour.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behavior.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
* '''Behavior''': Once thieves finish stealing, they target the nearest exit and try to escape.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
* '''Number of Guards''': Adjustable (1–10).&lt;br /&gt;
* '''Number of Thieves''': Adjustable (1–15).&lt;br /&gt;
* '''Guard Vision Range''': 5–20.&lt;br /&gt;
* '''Steal Delay''': 5–80 ticks.&lt;br /&gt;
* '''Spot While Stealing Threshold''': 0.7–1.0.&lt;br /&gt;
* '''Spot After Stealing Threshold''': 0.05–0.2.&lt;br /&gt;
* '''Leave Threshold''': 0.2–0.8.&lt;br /&gt;
* '''Customer Spawn Threshold''': 0.1–0.9.&lt;br /&gt;
* '''Display Padding''': 2–8.&lt;br /&gt;
* '''Shelf Dimensions''': Width (4–16) and Height (2–8).&lt;br /&gt;
* '''Min Space Between Shelves''': 2–10.&lt;br /&gt;
* '''Shop Delay''': 5–30 ticks.&lt;br /&gt;
* '''Guard Speed''': 1–4.&lt;br /&gt;
* '''Maximum Customers''': 1–30.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Total number of thieves caught by guards.&lt;br /&gt;
* '''Captured Thieves Percentage''': Percentage of thieves caught.&lt;br /&gt;
* '''Escaped Thieves''': Total number of thieves who successfully left the store after stealing.&lt;br /&gt;
* '''Escaped Thieves Percentage''': Percentage of thieves who escaped.&lt;br /&gt;
* '''People in Shop (Graph)''': Real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
* '''Thieves Average Time in Shop''': Average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
* '''Use of Guards Percentage''': Represents how effectively guards are being utilized.&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
* '''Sliders''': Control parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Display real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualize the number of guards, thieves, and customers in the shop over time using color-coded lines.&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 9 interactions&lt;br /&gt;
* '''Average Time in Shop''': 22 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 26 interactions&lt;br /&gt;
* '''Average Time in Shop''': 20.2 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 15 interactions&lt;br /&gt;
* '''Average Time in Shop''': 25–26 ticks&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 19–28 interactions&lt;br /&gt;
* '''Average Time in Shop''': 24.6–33.6 ticks&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
* '''Captured Thieves''': 2–4&lt;br /&gt;
* '''Escaped Thieves''': 2–4&lt;br /&gt;
* '''Conflicts''': 10–21 interactions&lt;br /&gt;
* '''Average Time in Shop''': 31.33–44 ticks&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26407</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26407"/>
		<updated>2025-01-10T21:14:16Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Thieves */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behavior. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behavior.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
* '''Behavior''': Once thieves finish stealing, they target the nearest exit and try to escape.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
* '''Number of Guards''': Adjustable (1–10).&lt;br /&gt;
* '''Number of Thieves''': Adjustable (1–15).&lt;br /&gt;
* '''Guard Vision Range''': 5–20.&lt;br /&gt;
* '''Steal Delay''': 5–80 ticks.&lt;br /&gt;
* '''Spot While Stealing Threshold''': 0.7–1.0.&lt;br /&gt;
* '''Spot After Stealing Threshold''': 0.05–0.2.&lt;br /&gt;
* '''Leave Threshold''': 0.2–0.8.&lt;br /&gt;
* '''Customer Spawn Threshold''': 0.1–0.9.&lt;br /&gt;
* '''Display Padding''': 2–8.&lt;br /&gt;
* '''Shelf Dimensions''': Width (4–16) and Height (2–8).&lt;br /&gt;
* '''Min Space Between Shelves''': 2–10.&lt;br /&gt;
* '''Shop Delay''': 5–30 ticks.&lt;br /&gt;
* '''Guard Speed''': 1–4.&lt;br /&gt;
* '''Maximum Customers''': 1–30.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Total number of thieves caught by guards.&lt;br /&gt;
* '''Captured Thieves Percentage''': Percentage of thieves caught.&lt;br /&gt;
* '''Escaped Thieves''': Total number of thieves who successfully left the store after stealing.&lt;br /&gt;
* '''Escaped Thieves Percentage''': Percentage of thieves who escaped.&lt;br /&gt;
* '''People in Shop (Graph)''': Real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
* '''Thieves Average Time in Shop''': Average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
* '''Use of Guards Percentage''': Represents how effectively guards are being utilized.&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
* '''Sliders''': Control parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Display real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualize the number of guards, thieves, and customers in the shop over time using color-coded lines.&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 9 interactions&lt;br /&gt;
* '''Average Time in Shop''': 22 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 26 interactions&lt;br /&gt;
* '''Average Time in Shop''': 20.2 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 15 interactions&lt;br /&gt;
* '''Average Time in Shop''': 25–26 ticks&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 19–28 interactions&lt;br /&gt;
* '''Average Time in Shop''': 24.6–33.6 ticks&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
* '''Captured Thieves''': 2–4&lt;br /&gt;
* '''Escaped Thieves''': 2–4&lt;br /&gt;
* '''Conflicts''': 10–21 interactions&lt;br /&gt;
* '''Average Time in Shop''': 31.33–44 ticks&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26405</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26405"/>
		<updated>2025-01-10T21:13:43Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Thieves */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving. When a thief reaches the target shelf, they begin the “stealing process”. This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape. If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.&lt;br /&gt;
Thieves check if they are within the vision radius of a guard. If they are spotted, they might try to evade capture by adjusting their movements.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-coloured agents in the simulation.&lt;br /&gt;
* '''Spawn Mechanics''':Thieves do not spawn at the start of the simulation. Instead:&lt;br /&gt;
They begin spawning after 100 ticks.&lt;br /&gt;
New thieves spawn every 20 ticks until the total number of thieves reaches the count set by the thievesCount slider.&lt;br /&gt;
Thieves enter the store from a randomly selected exit.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behavior. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behavior.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
* '''Behavior''': Once thieves finish stealing, they target the nearest exit and try to escape.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
* '''Number of Guards''': Adjustable (1–10).&lt;br /&gt;
* '''Number of Thieves''': Adjustable (1–15).&lt;br /&gt;
* '''Guard Vision Range''': 5–20.&lt;br /&gt;
* '''Steal Delay''': 5–80 ticks.&lt;br /&gt;
* '''Spot While Stealing Threshold''': 0.7–1.0.&lt;br /&gt;
* '''Spot After Stealing Threshold''': 0.05–0.2.&lt;br /&gt;
* '''Leave Threshold''': 0.2–0.8.&lt;br /&gt;
* '''Customer Spawn Threshold''': 0.1–0.9.&lt;br /&gt;
* '''Display Padding''': 2–8.&lt;br /&gt;
* '''Shelf Dimensions''': Width (4–16) and Height (2–8).&lt;br /&gt;
* '''Min Space Between Shelves''': 2–10.&lt;br /&gt;
* '''Shop Delay''': 5–30 ticks.&lt;br /&gt;
* '''Guard Speed''': 1–4.&lt;br /&gt;
* '''Maximum Customers''': 1–30.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Total number of thieves caught by guards.&lt;br /&gt;
* '''Captured Thieves Percentage''': Percentage of thieves caught.&lt;br /&gt;
* '''Escaped Thieves''': Total number of thieves who successfully left the store after stealing.&lt;br /&gt;
* '''Escaped Thieves Percentage''': Percentage of thieves who escaped.&lt;br /&gt;
* '''People in Shop (Graph)''': Real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
* '''Thieves Average Time in Shop''': Average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
* '''Use of Guards Percentage''': Represents how effectively guards are being utilized.&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
* '''Sliders''': Control parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Display real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualize the number of guards, thieves, and customers in the shop over time using color-coded lines.&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 9 interactions&lt;br /&gt;
* '''Average Time in Shop''': 22 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 26 interactions&lt;br /&gt;
* '''Average Time in Shop''': 20.2 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 15 interactions&lt;br /&gt;
* '''Average Time in Shop''': 25–26 ticks&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 19–28 interactions&lt;br /&gt;
* '''Average Time in Shop''': 24.6–33.6 ticks&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
* '''Captured Thieves''': 2–4&lt;br /&gt;
* '''Escaped Thieves''': 2–4&lt;br /&gt;
* '''Conflicts''': 10–21 interactions&lt;br /&gt;
* '''Average Time in Shop''': 31.33–44 ticks&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26402</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26402"/>
		<updated>2025-01-10T21:10:30Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Euclidean Distance */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
d = √((x₂ - x₁)² + (y₂ - y₁)²)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving.&lt;br /&gt;
  * When a thief reaches the target shelf, they begin the “stealing process.” This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape.&lt;br /&gt;
  * If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-colored agents in the simulation.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behavior. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behavior.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
* '''Behavior''': Once thieves finish stealing, they target the nearest exit and try to escape.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
* '''Number of Guards''': Adjustable (1–10).&lt;br /&gt;
* '''Number of Thieves''': Adjustable (1–15).&lt;br /&gt;
* '''Guard Vision Range''': 5–20.&lt;br /&gt;
* '''Steal Delay''': 5–80 ticks.&lt;br /&gt;
* '''Spot While Stealing Threshold''': 0.7–1.0.&lt;br /&gt;
* '''Spot After Stealing Threshold''': 0.05–0.2.&lt;br /&gt;
* '''Leave Threshold''': 0.2–0.8.&lt;br /&gt;
* '''Customer Spawn Threshold''': 0.1–0.9.&lt;br /&gt;
* '''Display Padding''': 2–8.&lt;br /&gt;
* '''Shelf Dimensions''': Width (4–16) and Height (2–8).&lt;br /&gt;
* '''Min Space Between Shelves''': 2–10.&lt;br /&gt;
* '''Shop Delay''': 5–30 ticks.&lt;br /&gt;
* '''Guard Speed''': 1–4.&lt;br /&gt;
* '''Maximum Customers''': 1–30.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Total number of thieves caught by guards.&lt;br /&gt;
* '''Captured Thieves Percentage''': Percentage of thieves caught.&lt;br /&gt;
* '''Escaped Thieves''': Total number of thieves who successfully left the store after stealing.&lt;br /&gt;
* '''Escaped Thieves Percentage''': Percentage of thieves who escaped.&lt;br /&gt;
* '''People in Shop (Graph)''': Real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
* '''Thieves Average Time in Shop''': Average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
* '''Use of Guards Percentage''': Represents how effectively guards are being utilized.&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
* '''Sliders''': Control parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Display real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualize the number of guards, thieves, and customers in the shop over time using color-coded lines.&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 9 interactions&lt;br /&gt;
* '''Average Time in Shop''': 22 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 26 interactions&lt;br /&gt;
* '''Average Time in Shop''': 20.2 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 15 interactions&lt;br /&gt;
* '''Average Time in Shop''': 25–26 ticks&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 19–28 interactions&lt;br /&gt;
* '''Average Time in Shop''': 24.6–33.6 ticks&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
* '''Captured Thieves''': 2–4&lt;br /&gt;
* '''Escaped Thieves''': 2–4&lt;br /&gt;
* '''Conflicts''': 10–21 interactions&lt;br /&gt;
* '''Average Time in Shop''': 31.33–44 ticks&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26401</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26401"/>
		<updated>2025-01-10T21:09:16Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Objective */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
Key factors include how far guards can see (guardVisionRange), how fast they move (guardSpeed), and how likely they are to spot thieves while stealing (spotWhileStealingThreshold) or after stealing (spotAfterStealingThreshold). The simulation also considers customer behaviour, like how many are in the store (maxCustomers) and how often new customers arrive (customerSpawnThreshold), which makes the environment more dynamic and challenging.&lt;br /&gt;
By adjusting these settings, the simulation helps to understand how to find the right balance—how many guards are needed, how shelves should be arranged, and how to prevent theft without overspending on security.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behaviour, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
\( d = \sqrt{(x₂ - x₁)^2 + (y₂ - y₁)^2} \)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving.&lt;br /&gt;
  * When a thief reaches the target shelf, they begin the “stealing process.” This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape.&lt;br /&gt;
  * If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-colored agents in the simulation.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behavior. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behavior.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
* '''Behavior''': Once thieves finish stealing, they target the nearest exit and try to escape.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
* '''Number of Guards''': Adjustable (1–10).&lt;br /&gt;
* '''Number of Thieves''': Adjustable (1–15).&lt;br /&gt;
* '''Guard Vision Range''': 5–20.&lt;br /&gt;
* '''Steal Delay''': 5–80 ticks.&lt;br /&gt;
* '''Spot While Stealing Threshold''': 0.7–1.0.&lt;br /&gt;
* '''Spot After Stealing Threshold''': 0.05–0.2.&lt;br /&gt;
* '''Leave Threshold''': 0.2–0.8.&lt;br /&gt;
* '''Customer Spawn Threshold''': 0.1–0.9.&lt;br /&gt;
* '''Display Padding''': 2–8.&lt;br /&gt;
* '''Shelf Dimensions''': Width (4–16) and Height (2–8).&lt;br /&gt;
* '''Min Space Between Shelves''': 2–10.&lt;br /&gt;
* '''Shop Delay''': 5–30 ticks.&lt;br /&gt;
* '''Guard Speed''': 1–4.&lt;br /&gt;
* '''Maximum Customers''': 1–30.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Total number of thieves caught by guards.&lt;br /&gt;
* '''Captured Thieves Percentage''': Percentage of thieves caught.&lt;br /&gt;
* '''Escaped Thieves''': Total number of thieves who successfully left the store after stealing.&lt;br /&gt;
* '''Escaped Thieves Percentage''': Percentage of thieves who escaped.&lt;br /&gt;
* '''People in Shop (Graph)''': Real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
* '''Thieves Average Time in Shop''': Average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
* '''Use of Guards Percentage''': Represents how effectively guards are being utilized.&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
* '''Sliders''': Control parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Display real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualize the number of guards, thieves, and customers in the shop over time using color-coded lines.&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 9 interactions&lt;br /&gt;
* '''Average Time in Shop''': 22 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 26 interactions&lt;br /&gt;
* '''Average Time in Shop''': 20.2 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 15 interactions&lt;br /&gt;
* '''Average Time in Shop''': 25–26 ticks&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 19–28 interactions&lt;br /&gt;
* '''Average Time in Shop''': 24.6–33.6 ticks&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
* '''Captured Thieves''': 2–4&lt;br /&gt;
* '''Escaped Thieves''': 2–4&lt;br /&gt;
* '''Conflicts''': 10–21 interactions&lt;br /&gt;
* '''Average Time in Shop''': 31.33–44 ticks&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26399</id>
		<title>User:Holp11</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=User:Holp11&amp;diff=26399"/>
		<updated>2025-01-10T21:07:15Z</updated>

		<summary type="html">&lt;p&gt;Holp11: Created page with &amp;quot;= Simulation of Security Efficiency in a Store =  == Introduction == This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulation of Security Efficiency in a Store =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
This page details the simulation project: &amp;quot;Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
* '''Subject''': Multi-Agent Simulation&lt;br /&gt;
* '''Author''': Bc. Petr Hollan&lt;br /&gt;
* '''Model Type''': Multi-Agent&lt;br /&gt;
* '''Modelling Tool''': NetLogo&lt;br /&gt;
&lt;br /&gt;
== Problem Definition ==&lt;br /&gt;
This simulation analyses how the number of guards (guardsCount) and thieves (thievesCount), as well as the way shelves are arranged (shelvesRows, shelvesColumns, shelfWidth, shelfHeight, and minSpaceBetween), affect security in a store. It focuses on the interactions between guards, thieves, and customers in a realistic retail environment.&lt;br /&gt;
&lt;br /&gt;
=== Objective ===&lt;br /&gt;
The main goal of this simulation is to figure out how many guards are needed to prevent theft as effectively as possible without overspending. It also looks at how factors like thief behavior, how well guards can see, and how the shelves are arranged in the store impact security.&lt;br /&gt;
&lt;br /&gt;
This simulation is for Mr. Ha Son Do, a dedicated store owner with over 20 years of experience running shops in Praha, Prostějov, and Zábřeh na Moravě. His stores come in different sizes, each with its own challenges. Mr. Ha Son Do wants to know if hiring more guards is worth the investment or if there are smarter ways to improve security. He’s especially concerned about how effective his guards are since many of them are older and might not be as attentive as needed.&lt;br /&gt;
&lt;br /&gt;
== Methodology ==&lt;br /&gt;
The simulation uses the NetLogo agent-based modelling environment to study dynamic interactions between agents in a controlled retail environment. The flexibility of NetLogo allows users to adjust input parameters and observe how agent behavior and environmental settings influence results.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Algorithm ===&lt;br /&gt;
==== Euclidean Distance ====&lt;br /&gt;
This method calculates the direct distance between two points (x₁, y₁) and (x₂, y₂) in Cartesian coordinates using the formula:&lt;br /&gt;
&lt;br /&gt;
\( d = \sqrt{(x₂ - x₁)^2 + (y₂ - y₁)^2} \)&lt;br /&gt;
&lt;br /&gt;
In the simulation, Euclidean distance is used to determine whether a thief is within the vision range of a guard and to identify the nearest target, which is either a shelf or an exit for thieves and customers.&lt;br /&gt;
&lt;br /&gt;
==== Bresenham’s Algorithm ====&lt;br /&gt;
Bresenham’s algorithm is used to check if a guard can see a thief by calculating a straight or diagonal line between them on the grid. The algorithm efficiently handles this by working with integer arithmetic, which makes it fast and suitable for simulations. It also takes shelves into account.&lt;br /&gt;
&lt;br /&gt;
In reality, if a straight or diagonal line is blocked by an obstacle, the guard cannot detect the thief. This approach ensures that the simulation is realistic.&lt;br /&gt;
&lt;br /&gt;
== Model – Detailed Description ==&lt;br /&gt;
=== Model Limitations ===&lt;br /&gt;
* All agents act simultaneously, which may oversimplify real-world situations.&lt;br /&gt;
* Obstacles (shelves) and exits are fixed in predefined locations.&lt;br /&gt;
* The model assumes a uniform decision-making process for thieves and guards, which may not capture individual variations.&lt;br /&gt;
&lt;br /&gt;
=== Initialization ===&lt;br /&gt;
* The store environment is initialized based on the selected size (small, medium, large).&lt;br /&gt;
* Shelves, guards, and thieves are placed according to input parameters.&lt;br /&gt;
* Metrics for tracking thefts, escapes, and guard performance are reset.&lt;br /&gt;
* Customers can enter and exit the store through both entrances, simulating real-world customer behavior.&lt;br /&gt;
* During initialization, all patches are checked for exits, and any patch containing an exit is visually marked with white to help identify the store's entry and exit points.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Execution ===&lt;br /&gt;
* Guards patrol the store and reactively chase thieves when spotted.&lt;br /&gt;
* Thieves target shelves, steal items, and attempt to escape through exits.&lt;br /&gt;
* Customers move passively, simulating store traffic.&lt;br /&gt;
* Obstacles (shelves) block visibility and movement, affecting interactions.&lt;br /&gt;
* Thieves are not present in the store from the beginning. Instead, they spawn after the 100th tick to simulate a dynamic arrival process.&lt;br /&gt;
* After the initial delay, thieves spawn every 20 ticks, maintaining a steady flow of new thieves entering the store.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Termination ===&lt;br /&gt;
The simulation ends when all thieves are either caught or have escaped.&lt;br /&gt;
&lt;br /&gt;
=== Agents and Their Properties ===&lt;br /&gt;
==== Guards ====&lt;br /&gt;
* '''Properties''': Vision range, chasing status, speed, target, visited.&lt;br /&gt;
* '''Behavior''': Guards move around the store and pursue thieves when spotted. Guards are placed randomly during initialization on patches where there are no shelves or exits, ensuring they are positioned in open and accessible areas.&lt;br /&gt;
* '''Vision''': Guards’ vision works diagonally, allowing them to detect thieves across both straight and diagonal lines of sight, increasing the realism of their observation capabilities.&lt;br /&gt;
* '''Visual Representation''': Guards are visually represented in the simulation by yellow-colored agents.&lt;br /&gt;
&lt;br /&gt;
==== Thieves ====&lt;br /&gt;
* '''Properties''': Target, stealing, visited, delay, readyToLeave, ticksOnEnter.&lt;br /&gt;
* '''Behavior''': Thieves dynamically select a shelf as their target when they are not being pursued by guards or in the process of leaving.&lt;br /&gt;
  * When a thief reaches the target shelf, they begin the “stealing process.” This involves a delay (based on the stealDelay slider), after which they mark themselves as ready to leave. Once ready to leave, thieves target the nearest exit and attempt to escape.&lt;br /&gt;
  * If a guard captures them during this process, they are removed from the simulation and the status is shown on the monitor.&lt;br /&gt;
* '''Visual Representation''': Thieves are visually represented by red-colored agents in the simulation.&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Properties''': Target, visited, delay.&lt;br /&gt;
* '''Behavior''': Customers move randomly around the store, targeting shelves to simulate shopping behavior. Customers may decide to leave the store after a random shopping duration. The decision to leave is influenced by the leaveThreshold slider, which determines the probability of a customer targeting an exit instead of another shelf.&lt;br /&gt;
* '''Visual Representation''': Customers are visually represented by blue-colored agents in the simulation.&lt;br /&gt;
&lt;br /&gt;
==== Shelves ====&lt;br /&gt;
* '''Properties''': Shelves act as obstacles, blocking both movement and visibility for guards, thieves, and customers.&lt;br /&gt;
* '''Behavior''': Shelves serve as the primary targets for thieves and customers. Thieves steal from shelves, and customers stop at shelves to simulate shopping behavior.&lt;br /&gt;
* '''Visual Representation''': Shelves are visually represented as brown-colored patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
==== Exits ====&lt;br /&gt;
* '''Properties''': Exits are fixed patches where thieves attempt to escape the store, and customers leave after shopping.&lt;br /&gt;
* '''Behavior''': Once thieves finish stealing, they target the nearest exit and try to escape.&lt;br /&gt;
* '''Visual Representation''': Exits are represented by white patches in the simulation interface.&lt;br /&gt;
&lt;br /&gt;
=== Input Parameters of the Model ===&lt;br /&gt;
* '''World Size''': Small, medium, or large.&lt;br /&gt;
* '''Number of Guards''': Adjustable (1–10).&lt;br /&gt;
* '''Number of Thieves''': Adjustable (1–15).&lt;br /&gt;
* '''Guard Vision Range''': 5–20.&lt;br /&gt;
* '''Steal Delay''': 5–80 ticks.&lt;br /&gt;
* '''Spot While Stealing Threshold''': 0.7–1.0.&lt;br /&gt;
* '''Spot After Stealing Threshold''': 0.05–0.2.&lt;br /&gt;
* '''Leave Threshold''': 0.2–0.8.&lt;br /&gt;
* '''Customer Spawn Threshold''': 0.1–0.9.&lt;br /&gt;
* '''Display Padding''': 2–8.&lt;br /&gt;
* '''Shelf Dimensions''': Width (4–16) and Height (2–8).&lt;br /&gt;
* '''Min Space Between Shelves''': 2–10.&lt;br /&gt;
* '''Shop Delay''': 5–30 ticks.&lt;br /&gt;
* '''Guard Speed''': 1–4.&lt;br /&gt;
* '''Maximum Customers''': 1–30.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Controls ===&lt;br /&gt;
* '''Setup''': Initializes the simulation environment.&lt;br /&gt;
* '''Go''': Starts or pauses the simulation loop.&lt;br /&gt;
&lt;br /&gt;
=== Tracked Indicators ===&lt;br /&gt;
* '''Captured Thieves''': Total number of thieves caught by guards.&lt;br /&gt;
* '''Captured Thieves Percentage''': Percentage of thieves caught.&lt;br /&gt;
* '''Escaped Thieves''': Total number of thieves who successfully left the store after stealing.&lt;br /&gt;
* '''Escaped Thieves Percentage''': Percentage of thieves who escaped.&lt;br /&gt;
* '''People in Shop (Graph)''': Real-time graph showing the number of thieves, customers, and guards in the shop over time.&lt;br /&gt;
* '''Thieves Average Time in Shop''': Average time thieves spend in the shop before being captured or escaping.&lt;br /&gt;
* '''Use of Guards Percentage''': Represents how effectively guards are being utilized.&lt;br /&gt;
&lt;br /&gt;
=== Simulation User Interface ===&lt;br /&gt;
* '''Sliders''': Control parameters such as the number of guards, thieves, and customers, as well as properties like vision range, guard speed, and shelf dimensions.&lt;br /&gt;
* '''Monitors''': Display real-time metrics such as the number of captured thieves, escaped thieves, and conflicts.&lt;br /&gt;
* '''Graphs''': Visualize the number of guards, thieves, and customers in the shop over time using color-coded lines.&lt;br /&gt;
&lt;br /&gt;
== Simulation Results with Analysis ==&lt;br /&gt;
=== Small World, Guard Speed 2, and 2 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 9 interactions&lt;br /&gt;
* '''Average Time in Shop''': 22 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 26 interactions&lt;br /&gt;
* '''Average Time in Shop''': 20.2 ticks&lt;br /&gt;
&lt;br /&gt;
=== 3 Guards and 10 Customers ===&lt;br /&gt;
* '''Captured Thieves''': 40%&lt;br /&gt;
* '''Escaped Thieves''': 60%&lt;br /&gt;
* '''Conflicts''': 15 interactions&lt;br /&gt;
* '''Average Time in Shop''': 25–26 ticks&lt;br /&gt;
&lt;br /&gt;
=== Large World ===&lt;br /&gt;
* '''Captured Thieves''': 60%&lt;br /&gt;
* '''Escaped Thieves''': 40%&lt;br /&gt;
* '''Conflicts''': 19–28 interactions&lt;br /&gt;
* '''Average Time in Shop''': 24.6–33.6 ticks&lt;br /&gt;
&lt;br /&gt;
=== Second Large World ===&lt;br /&gt;
* '''Captured Thieves''': 2–4&lt;br /&gt;
* '''Escaped Thieves''': 2–4&lt;br /&gt;
* '''Conflicts''': 10–21 interactions&lt;br /&gt;
* '''Average Time in Shop''': 31.33–44 ticks&lt;br /&gt;
&lt;br /&gt;
== Conclusion ==&lt;br /&gt;
This simulation revealed valuable insights into improving store security by analyzing how guards, thieves, customers, and store layouts interact. Preventing theft isn’t just about hiring more guards—it’s about making smarter, targeted changes to store operations. For example:&lt;br /&gt;
&lt;br /&gt;
* '''Small Store''': With two guards, only 40% of thieves were caught while 60% escaped, leading to a guard efficiency of just 1.8%. Increasing the guard count to three improved capture rates to 60% and raised efficiency to 3.8%, but escapes still occurred.&lt;br /&gt;
* '''Store Layout''': Narrow shelves with minimal spacing made it harder for guards to see, while wider shelves created blind spots thieves could exploit. Balancing shelf spacing is key to ensuring guards can patrol effectively without disrupting the shopping experience.&lt;br /&gt;
* '''Customer Traffic''': High customer traffic made it more difficult for guards to distinguish thieves from shoppers, often increasing escape rates.&lt;br /&gt;
&lt;br /&gt;
== Possible Model Extensions ==&lt;br /&gt;
* Adding more realistic guard and thief behaviors.&lt;br /&gt;
* Introducing dynamic shelf arrangements.&lt;br /&gt;
* Simulating multiple store scenarios simultaneously.&lt;br /&gt;
&lt;br /&gt;
== References ==&lt;br /&gt;
* [https://www.geeksforgeeks.org/bresenhams-line-generation-algorithm/ Bresenham's Algorithm]&lt;br /&gt;
* [https://www.geeksforgeeks.org/euclidean-distance/ Euclidean Distance]&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;br /&gt;
&lt;br /&gt;
== Downloadable Files ==&lt;br /&gt;
* [http://www.robotomie.cz/pocitadlo/pridej_zaznam.php?nazev=obsah/netlogo/netlogo.zip Simulation File: NetLogo for Store Security Simulation]&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=WS_2024/2025&amp;diff=26391</id>
		<title>WS 2024/2025</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=WS_2024/2025&amp;diff=26391"/>
		<updated>2025-01-10T21:00:00Z</updated>

		<summary type="html">&lt;p&gt;Holp11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Semestral papers from winter term 2023/2024. Please, put here links to the pages with your paper. First you need to have your [[Assignments WS 2024/2025|assignment approved]]&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Simulations==&lt;br /&gt;
&lt;br /&gt;
--[[User:Filip Simulátor|Filip Simulátor]] ([[User talk:Filip Simulátor|talk]]) 21:37, 3 January 2025 (CET) Lightning Network Channel Dynamics Simulation (NetLogo): [[Lightning Network Channel Dynamics Simulation (NetLogo)]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Matj27|Matj27]] ([[User talk:Matj27|talk]]) 16:06, 2 January 2025 (CET) Performance of Solar Power Plant Based on ERA5 Data: [[Performance of Solar Power Plant Based on ERA5 Data]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Cesj05|Cesj05]] ([[User talk:Cesj05|talk]]) 11:05, 1 January 2025 (CET) Garden simulation:[[Garden simulation]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Tara04|Tara04]] ([[User talk:Tara04|talk]]) 20:24, 9 January 2025 (CET) Hybrid Work Dynamics: [[Hybrid Work Dynamics]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Omaj01|Omaj01]] ([[User talk:Omaj01|talk]]) 20:55, 9 January 2025 (CET) Simulation of pension reform in the Czech Republic: Analysis of long-term sustainability: [[Pension System Czech Republic]]&lt;br /&gt;
&lt;br /&gt;
-- [[User:Sim timm03|Sim timm03]] ([[User talk:Sim timm03|talk]]) 19:36, 10 January 2025 (CET) Traffic Accident Risk Analysis: [[Traffic Accident Risk Analysis]]&lt;br /&gt;
&lt;br /&gt;
-- [[User:Stej34|Stej34]] ([[User talk:Stej34|talk]]) 20:46, 10 January 2025 (CET) Urban Traffic Flow Optimization: [[Urban Traffic Flow Optimization]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Lozd00|Lozd00]] ([[User talk:Lozd00|talk]]) 20:57, 10 January 2025 (CET) Bee Foraging Behavior: [[Bee Foraging Behavior]]&lt;br /&gt;
&lt;br /&gt;
Holp11: Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Assignments_WS_2024/2025&amp;diff=26100</id>
		<title>Assignments WS 2024/2025</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Assignments_WS_2024/2025&amp;diff=26100"/>
		<updated>2024-12-07T20:07:55Z</updated>

		<summary type="html">&lt;p&gt;Holp11: /* Deterministic Variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Ambox&lt;br /&gt;
| text  = &amp;lt;div&amp;gt;&lt;br /&gt;
Please, put here your assignments. Do not forget to sign them. You can use &amp;lt;nowiki&amp;gt;~~~~&amp;lt;/nowiki&amp;gt; (four tildas) for an automatic signature. Use Show preview in order to check the result before your final sumbition.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Ambox&lt;br /&gt;
| text  = &amp;lt;div&amp;gt;&lt;br /&gt;
Please, strive to formulate your assignment carefully. We expect an adequate effort to formulate the assignment as it is your semestral paper. Do not forget that your main goal is a research paper. It means your simulation model must generate the results that are specific, measurable and verifiable. Think twice how you will develop your model, which entities you will use, draw a model diagram, consider what you will measure. No sooner than when you have a good idea about the model, submit your assignment. And of course, read [[How to deal with the simulation assignment|How to deal with the simulation assignment]].&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Ambox&lt;br /&gt;
| text  = &amp;lt;div&amp;gt;&lt;br /&gt;
Topics on gambling, cards, etc. are not welcome.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Ambox&lt;br /&gt;
| type  = content&lt;br /&gt;
| text  = &amp;lt;div&amp;gt;&lt;br /&gt;
In order to avoid possible confusion, please, check if you have added '''approved''' in bold somewhere in our comment under your submission. If there is no '''approved''', it means the assignment was not approved yet.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Ambox&lt;br /&gt;
| text  = &amp;lt;div&amp;gt;&lt;br /&gt;
'''Criteria for evaluation of the simulation proposal'''&lt;br /&gt;
&lt;br /&gt;
The proposal must contain:&lt;br /&gt;
*What you will simulate&lt;br /&gt;
*The goal of the simulation (what you analyze - i.e. not &amp;quot;to simulate balloon factory&amp;quot;, but what problem should the simulation solve).&lt;br /&gt;
*Who would actually use such simulation (example of such user) and how would it help him&lt;br /&gt;
*What method and simulation environment you plan to use. Choose only from the development environments that we have used in the course.&lt;br /&gt;
*What variables will be incorporated&lt;br /&gt;
*What variables will be random&lt;br /&gt;
*What exact data you will base values of your variables on&lt;br /&gt;
*(In case of Monte Carlo) What exact data you will base your determination of probability distribution of your random variables on&lt;br /&gt;
*What exact data you will base your formulas in the simulation (simulation behavior) on &lt;br /&gt;
&lt;br /&gt;
'''If any of the above points are missing from the simulation proposal, the proposal is considered incomplete. Unless the proposal contains all of the above points it will not be evaluated at all (and therefore cannot be approved).'''&lt;br /&gt;
&lt;br /&gt;
# Is it clear from the proposed assignment how the simulation will work?&lt;br /&gt;
# Does the simulation make sense?&lt;br /&gt;
# Is the simulation model complex enough to simulate credibly the real-world phenomenon that the simulation tries to simulate?&lt;br /&gt;
# Is the data used real and relevant for the real-world phenomenon that the simulation tries to simulate?&lt;br /&gt;
# Is the simulation feasible? (in given time by the course)&lt;br /&gt;
&lt;br /&gt;
'''If the answer to any of the above points is no, you need to improve your proposal. Don't wait for us to tell you so - you're wasting your time.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
'''Assignment Proposal (Draft) Title:'''&lt;br /&gt;
*Simulation of pension reform in the Czech Republic: Analysis of long-term sustainability&lt;br /&gt;
&lt;br /&gt;
'''What will be simulated:'''&lt;br /&gt;
*A system dynamics model of the Czech pension system that simulates the long-term financial sustainability under varying demographic, economic, and policy scenarios. The simulation will project future balances of the pension system, incorporating the flows of revenues (social insurance contributions) and expenditures (pension payouts)&lt;br /&gt;
&lt;br /&gt;
'''Goal of the simulation (What problem should the simulation solve):'''&lt;br /&gt;
*The main goal is to analyze how different pension reform strategies (e.g., adjusting retirement age, altering contribution rates, changing the indexation formula of pensions) will affect the long-term stability of the Czech pension system. The simulation aims to identify specific policy levers and thresholds that ensure the pension system’s financial equilibrium over a multi-decade horizon, despite changing demographic and economic conditions.&lt;br /&gt;
&lt;br /&gt;
'''Who would use the simulation and how it helps them:'''&lt;br /&gt;
*The potential users include not only the Ministry of Finance, the Ministry of Labour and Social Affairs, but also the general public and the media. Although the model does not simulate the pension system in complete detail, it provides a general overview and helps users understand the basic mechanisms and trends that will shape the future of the pension system. In this way, users can:&lt;br /&gt;
**Gain a preliminary orientation and inspiration: By experimenting with simple scenarios (e.g., raising the retirement age or altering contribution rates), users can gain a clearer picture of how different reform steps could influence the stability of the pension system.&lt;br /&gt;
**Provide context for public debate: The model can assist citizens, journalists, and non-profit organizations in better understanding the issues surrounding pension reform. This allows them to critically evaluate political proposals or expert recommendations.&lt;br /&gt;
**Lead to more informed decision-making: While this is not a tool for detailed macroeconomic forecasting, the simulation provides a general insight into potential long-term trends. This can contribute to a broader understanding of the necessity for reforms and their impact on future generations.&lt;br /&gt;
&lt;br /&gt;
'''Method and simulation environment:'''&lt;br /&gt;
&lt;br /&gt;
*Method: System Dynamics&lt;br /&gt;
*Simulation environment: Vensim PLE (freely available for academic use)&lt;br /&gt;
&lt;br /&gt;
'''Variables in the model (deterministic and random):'''&lt;br /&gt;
&lt;br /&gt;
*Core Population Variables:&lt;br /&gt;
**Number of children (new entrants to future workforce)&lt;br /&gt;
**Number of working-age population (workers contributing to the system)&lt;br /&gt;
**Number of pensioners (beneficiaries)&lt;br /&gt;
&lt;br /&gt;
*Policy Variables:&lt;br /&gt;
**Statutory retirement age&lt;br /&gt;
**Contribution rate to social insurance (percentage of wage)&lt;br /&gt;
**Pension benefit formula and indexation mechanism&lt;br /&gt;
&lt;br /&gt;
*Economic Variables:&lt;br /&gt;
**Average wage (influences contributions)&lt;br /&gt;
**Inflation rate (influences indexation of pensions and wage growth)&lt;br /&gt;
&lt;br /&gt;
*Fiscal Variables:&lt;br /&gt;
**Total contributions collected (based on number of workers, contribution rate, and average wage)&lt;br /&gt;
**Total pension expenditure (based on number of pensioners and average pension)&lt;br /&gt;
**Pension system reserve fund (if applicable) and its depletion or accumulation&lt;br /&gt;
&lt;br /&gt;
*Random Variables:&lt;br /&gt;
**The model will incorporate stochastic elements through probability distributions derived from historical data and OECD/EUROSTAT projections to reflect uncertainty in:&lt;br /&gt;
***Fertility rate (affects future workforce size; random from projected distribution)&lt;br /&gt;
***Mortality rate / Life expectancy changes (stochastic variation around central OECD forecasts)&lt;br /&gt;
***Inflation rate (stochastic variation around central forecast from CNB/OECD data)&lt;br /&gt;
***Retirement rate (number of people retire each year +-)&lt;br /&gt;
&lt;br /&gt;
'''Data sources (for deterministic baseline and to derive distributions):'''&lt;br /&gt;
*Czech Statistical Office (ČSÚ) for historical demographic data&lt;br /&gt;
*OECD demographic and economic projections for Czech Republic&lt;br /&gt;
*Eurostat long-term demographic projections for EU countries&lt;br /&gt;
&lt;br /&gt;
'''Formulas in the simulation (examples):'''&lt;br /&gt;
*Pension Expenditure: Total Pension Expenditure = Number of Pensioners * Average Pension&lt;br /&gt;
*Average Pension Calculation: Average Pension(t+1) = Average Pension(t) * (1 + InflationIndex)&lt;br /&gt;
*Contribution Revenue: Total Contributions = Number of Workers * Average Wage * Contribution Rate&lt;br /&gt;
*System Balance: Annual Balance = Total Contributions - Total Pension Expenditure&lt;br /&gt;
*Accumulation or depletion of the pension reserve fund is then modeled as a stock: Reserve(t+1) = Reserve(t) + Annual Balance.&lt;br /&gt;
&lt;br /&gt;
'''Model complexity and data linking:'''&lt;br /&gt;
*'''Causal loop diagrams (CLD):''' Will illustrate feedback loops such as how employment and wage growth influence contributions, and how demographic changes influence the ratio of workers to retirees.&lt;br /&gt;
*'''Stock and Flow Diagrams:''' Will detail population stocks (children, workers, retirees), and financial stocks (pension fund reserves), along with flows (entrants to workforce, retirees, death rates, pension contributions, and payouts).&lt;br /&gt;
&lt;br /&gt;
'''Specific, measurable, and verifiable results:'''&lt;br /&gt;
*Specificity: The model will project the pension system’s financial status from year X to year X+50 under various reform scenarios, providing exact quantitative outcomes (e.g., fund balance in billions CZK, pension-to-wage ratio).&lt;br /&gt;
&lt;br /&gt;
*Measurable metrics:&lt;br /&gt;
**Dependency ratio (number of pensioners per 100 workers)&lt;br /&gt;
**Pension system annual balance (CZK) and cumulative reserves over time&lt;br /&gt;
**Average replacement rate (pension/average wage ratio)&lt;br /&gt;
**Sensitivity of sustainability gap to changes in retirement age or contribution rate&lt;br /&gt;
&lt;br /&gt;
*Verifiability: The initial model run will be calibrated against historical data for the past decade. Adjustments to parameters and comparison with known OECD and ČSÚ forecasts will verify the model’s credibility.&lt;br /&gt;
&lt;br /&gt;
[[User:Omaj01|Omaj01]] ([[User talk:Omaj01|talk]])&lt;br /&gt;
::'''APPROVED'''[[User:Oleg.Svatos|Oleg.Svatos]] ([[User talk:Oleg.Svatos|talk]]) 17:57, 6 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' Simulation concept – Invasive Plant Species vs. Native Plants vs. Herbivores Jan César (cesj05) '''&lt;br /&gt;
&lt;br /&gt;
''' Objectives: '''&lt;br /&gt;
&lt;br /&gt;
Understand the dynamics of competition between invasive plant species and native plants in a shared environment&lt;br /&gt;
&lt;br /&gt;
Explore the conditions under which either the invasive species dominates, coexists, or fails to establish.&lt;br /&gt;
&lt;br /&gt;
''' Environment: '''&lt;br /&gt;
&lt;br /&gt;
Each patch represents a piece of land that can grow either a natrive or invasive plant (or remain empty)&lt;br /&gt;
&lt;br /&gt;
Plants compete for resources on each path&lt;br /&gt;
&lt;br /&gt;
''' Agents: '''&lt;br /&gt;
&lt;br /&gt;
Native Plants: Slower growth but more resistant to herbivores or harsh conditions.&lt;br /&gt;
&lt;br /&gt;
Invasive Plants: Faster growth and higher seed dispersal rate but less resistant to herbivores.&lt;br /&gt;
&lt;br /&gt;
Herbivores: Agents that eat plants, with a preference for invasive or native species (modifiable by the user).&lt;br /&gt;
&lt;br /&gt;
''' Methods '''&lt;br /&gt;
&lt;br /&gt;
Initialization:&lt;br /&gt;
&lt;br /&gt;
Randomly populate the grid with a mix of invasive and native plants.&lt;br /&gt;
&lt;br /&gt;
Set up resource levels for each patch.&lt;br /&gt;
&lt;br /&gt;
Place herbivores randomly across the grid.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' Simulation Steps (Turtles/Agents): '''&lt;br /&gt;
&lt;br /&gt;
Each plant (agent) checks:&lt;br /&gt;
&lt;br /&gt;
Whether it has resources to grow or reproduce.&lt;br /&gt;
&lt;br /&gt;
If conditions are favorable, it spreads seeds to nearby patches.&lt;br /&gt;
&lt;br /&gt;
Herbivores move and consume plants on the patches they visit.&lt;br /&gt;
&lt;br /&gt;
Competition between plants on shared patches determines which survives.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' Interaction Dynamics: Modify the probability of herbivory or the effectiveness of seed dispersal as sliders to explore different scenarios.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The simulation will be done in NetLogo, as for the data, it will not be used from real world, but it will be set up, so the behaviour of agents will be as close as it can to real life.&lt;br /&gt;
&lt;br /&gt;
Used studies for setting up the behaviour of plants and herbivores will be: &lt;br /&gt;
https://www.mdpi.com/1424-2818/16/6/317&lt;br /&gt;
https://academic.oup.com/jpe/article/17/2/rtae007/7589693&lt;br /&gt;
&lt;br /&gt;
If needed, more studies will be used.&lt;br /&gt;
&lt;br /&gt;
This simulation can be used by gardeners trying to maintain their garden.   [[User:Cesj05|Cesj05]] ([[User talk:Cesj05|talk]]) 17:53, 6 December 2024 (CET)&lt;br /&gt;
----&lt;br /&gt;
== Simulation Concept – Traffic Accident Risk Analysis ==&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
* Understand the dynamics of traffic accidents based on road conditions, traffic density, and driver behavior.&lt;br /&gt;
* Explore the conditions under which accidents become frequent, and how they impact overall traffic flow.&lt;br /&gt;
* Test mitigation strategies like improved road quality or stricter speed limits.&lt;br /&gt;
&lt;br /&gt;
=== Environment ===&lt;br /&gt;
* '''Patches''': Represent road segments and intersections, each with a defined condition:&lt;br /&gt;
** '''Good''': Low accident probability.&lt;br /&gt;
** '''Bad''': Increased accident probability.&lt;br /&gt;
** '''Under Construction''': High accident probability and slower movement for cars.&lt;br /&gt;
* '''Road Network''': A grid-based layout with straight roads and intersections where traffic can flow.&lt;br /&gt;
&lt;br /&gt;
=== Agents ===&lt;br /&gt;
# '''Cars (Turtles):'''&lt;br /&gt;
## Each car has a speed, a destination, and a probability of making a driving error.&lt;br /&gt;
## Movement is influenced by traffic density and road conditions.&lt;br /&gt;
# '''Accidents:'''&lt;br /&gt;
## Simulated as blocked road segments.&lt;br /&gt;
## Cause delays and force cars to reroute.&lt;br /&gt;
# '''Traffic Lights (Optional):'''&lt;br /&gt;
## Located at intersections to control flow.&lt;br /&gt;
## Can be toggled on/off to explore their impact on accidents.&lt;br /&gt;
&lt;br /&gt;
=== Methods ===&lt;br /&gt;
==== Initialization ====&lt;br /&gt;
* Randomly distribute cars across the road network with initial speeds and destinations.&lt;br /&gt;
* Assign random conditions (good, bad, under construction) to road segments based on user input.&lt;br /&gt;
&lt;br /&gt;
==== Simulation Steps (Turtles/Agents) ====&lt;br /&gt;
# '''Movement:'''&lt;br /&gt;
## Cars follow road segments, moving faster on good roads and slower on bad/under-construction ones.&lt;br /&gt;
# '''Accident Risk:'''&lt;br /&gt;
## Probability of an accident increases with:&lt;br /&gt;
### Poor road conditions.&lt;br /&gt;
### High speed.&lt;br /&gt;
### High traffic density.&lt;br /&gt;
# '''Accident Handling:'''&lt;br /&gt;
## If an accident occurs, the road segment is temporarily blocked.&lt;br /&gt;
## Cars reroute to avoid the blocked segment, increasing congestion elsewhere.&lt;br /&gt;
# '''Recovery:'''&lt;br /&gt;
## Accidents are cleared after a set duration, restoring traffic flow.&lt;br /&gt;
&lt;br /&gt;
==== Interaction Dynamics ====&lt;br /&gt;
* '''User Controls:'''&lt;br /&gt;
** Traffic density, road condition distribution, speed limits, and driver error probabilities can be adjusted with sliders.&lt;br /&gt;
* '''Scenarios:'''&lt;br /&gt;
** Test high traffic density with poor roads versus low traffic density with good roads.&lt;br /&gt;
** Simulate stricter traffic laws by reducing driver errors and imposing speed limits.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Details ===&lt;br /&gt;
* '''Platform''': NetLogo.&lt;br /&gt;
* '''Data Source''': Synthetic data will be used to mimic real-world traffic dynamics based on studies and assumptions.&lt;br /&gt;
* '''Behavior Setup''': Modeled on findings from traffic and safety research:&lt;br /&gt;
** [https://www.tandfonline.com/doi/full/10.1080/13669877.2010.547259 Study 1]&lt;br /&gt;
** [https://www.tandfonline.com/doi/pdf/10.1080/23311916.2020.1834659 Study 2]&lt;br /&gt;
** [https://www.tandfonline.com/doi/pdf/10.1080/16483840.2003.10414070 Study 3]&lt;br /&gt;
* Additional studies will be incorporated if needed to refine parameters.&lt;br /&gt;
[[User:Sim timm03|Sim timm03]] ([[User talk:Sim timm03|talk]]) 16:11, 7 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Assignment Proposal (Draft) =&lt;br /&gt;
&lt;br /&gt;
== Title ==&lt;br /&gt;
'''Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics'''&lt;br /&gt;
&lt;br /&gt;
== What will be simulated ==&lt;br /&gt;
*A simulation of a store environment where security guards patrol to prevent thieves from stealing goods and escaping through designated exits. The store layout includes customizable obstacles (regals), guards, and thieves. The simulation focuses on the limited visibility due to obstacles and models the dynamic interaction between guards and thieves, exploring how the required number of guards changes based on the number of thieves.*&lt;br /&gt;
&lt;br /&gt;
== Goal of the simulation (What problem should the simulation solve) ==&lt;br /&gt;
*The simulation aims to determine the optimal number of guards needed to secure a store effectively under varying conditions of thief count. The ultimate goal is to provide recommendations for store security design based on quantitative analysis.*&lt;br /&gt;
&lt;br /&gt;
== Who would use the simulation and how it helps them ==&lt;br /&gt;
*Store Managers and Security Companies*: Helps in designing security layouts and determining the number of security guards needed to maximize efficiency and minimize theft.  &lt;br /&gt;
*Students*: Offers insights into visibility-limited environments and agent-based modeling techniques.&lt;br /&gt;
&lt;br /&gt;
== Method and simulation environment ==&lt;br /&gt;
* '''Method''': Agent-based modeling  &lt;br /&gt;
* '''Simulation environment''': NetLogo  &lt;br /&gt;
&lt;br /&gt;
== Variables in the model (deterministic and random) ==&lt;br /&gt;
&lt;br /&gt;
=== Deterministic Variables ===&lt;br /&gt;
* Number of guards  &lt;br /&gt;
* Number of thieves  &lt;br /&gt;
* Number of regals (obstacles): Fixed positions  &lt;br /&gt;
* Store size:   &lt;br /&gt;
* Guard and thief placement: Guards are placed on opposite sides of the store to maximize coverage; thieves are placed randomly.&lt;br /&gt;
&lt;br /&gt;
=== Random Variables ===&lt;br /&gt;
* Movement paths: Thieves and guards move dynamically based on patrol or escape strategies.  &lt;br /&gt;
* Thief behavior: Randomized target selection for obstacles and exits.  &lt;br /&gt;
* Guard patrol patterns: Random movement within patrol zones unless a thief is spotted.  &lt;br /&gt;
&lt;br /&gt;
== Formulas in the simulation (examples) ==&lt;br /&gt;
* '''Guard visibility''':  &lt;br /&gt;
  * \( \text{Visible range} = d \), where \( d \) is the number of unobstructed cells (line of sight blocked by obstacles).  &lt;br /&gt;
* '''Thief capture condition''':  &lt;br /&gt;
  * A thief is captured if a guard moves onto the same cell.  &lt;br /&gt;
* '''Escape success''':  &lt;br /&gt;
  * A thief escapes if it reaches an exit before being captured.  &lt;br /&gt;
* '''Capture efficiency''':  &lt;br /&gt;
  * \( \text{Efficiency} = \frac{\text{Captured thieves}}{\text{Total thieves}} \)  &lt;br /&gt;
&lt;br /&gt;
== Model complexity and data linking ==&lt;br /&gt;
* '''Guard and thief dynamics''':  &lt;br /&gt;
  * Guards patrol predefined zones or reactively chase thieves if spotted.  &lt;br /&gt;
  * Thieves move toward regals to &amp;quot;steal&amp;quot; and then to exits to escape.  &lt;br /&gt;
* '''Obstacle placement''':  &lt;br /&gt;
  * Regals are fixed in predefined locations that block visibility and movement.  &lt;br /&gt;
* '''Outputs''':  &lt;br /&gt;
  * Capture success rate  &lt;br /&gt;
  * Number of escaped thieves  &lt;br /&gt;
  * Guard efficiency metrics  &lt;br /&gt;
&lt;br /&gt;
== Specific, measurable, and verifiable results ==&lt;br /&gt;
* '''Specificity''':  &lt;br /&gt;
  * The model provides quantitative insights into the number of guards needed to maintain security across various scenarios.  &lt;br /&gt;
* '''Measurable metrics''':  &lt;br /&gt;
  * Capture rate (% of thieves caught)  &lt;br /&gt;
  * Escape rate (% of thieves successfully escaped)  &lt;br /&gt;
  * Average patrol effectiveness (distance covered by guards and time to interception).  &lt;br /&gt;
&lt;br /&gt;
== Key questions the simulation will answer ==&lt;br /&gt;
# How does the number of guards required to secure the store change with varying numbers of thieves?  &lt;br /&gt;
# What are the most effective patrol strategies for guards in a fixed environment with limited visibility?  &lt;br /&gt;
# How does the coordination or randomness of thieves’ behavior influence the effectiveness of the store's security?  &lt;br /&gt;
&lt;br /&gt;
[[User:Holp11|Holp11]] ([[User talk:Holp11|talk]]) 21:06, 7 December 2024 (CET)&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Assignments_WS_2024/2025&amp;diff=26099</id>
		<title>Assignments WS 2024/2025</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Assignments_WS_2024/2025&amp;diff=26099"/>
		<updated>2024-12-07T20:06:57Z</updated>

		<summary type="html">&lt;p&gt;Holp11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Ambox&lt;br /&gt;
| text  = &amp;lt;div&amp;gt;&lt;br /&gt;
Please, put here your assignments. Do not forget to sign them. You can use &amp;lt;nowiki&amp;gt;~~~~&amp;lt;/nowiki&amp;gt; (four tildas) for an automatic signature. Use Show preview in order to check the result before your final sumbition.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Ambox&lt;br /&gt;
| text  = &amp;lt;div&amp;gt;&lt;br /&gt;
Please, strive to formulate your assignment carefully. We expect an adequate effort to formulate the assignment as it is your semestral paper. Do not forget that your main goal is a research paper. It means your simulation model must generate the results that are specific, measurable and verifiable. Think twice how you will develop your model, which entities you will use, draw a model diagram, consider what you will measure. No sooner than when you have a good idea about the model, submit your assignment. And of course, read [[How to deal with the simulation assignment|How to deal with the simulation assignment]].&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Ambox&lt;br /&gt;
| text  = &amp;lt;div&amp;gt;&lt;br /&gt;
Topics on gambling, cards, etc. are not welcome.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Ambox&lt;br /&gt;
| type  = content&lt;br /&gt;
| text  = &amp;lt;div&amp;gt;&lt;br /&gt;
In order to avoid possible confusion, please, check if you have added '''approved''' in bold somewhere in our comment under your submission. If there is no '''approved''', it means the assignment was not approved yet.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Ambox&lt;br /&gt;
| text  = &amp;lt;div&amp;gt;&lt;br /&gt;
'''Criteria for evaluation of the simulation proposal'''&lt;br /&gt;
&lt;br /&gt;
The proposal must contain:&lt;br /&gt;
*What you will simulate&lt;br /&gt;
*The goal of the simulation (what you analyze - i.e. not &amp;quot;to simulate balloon factory&amp;quot;, but what problem should the simulation solve).&lt;br /&gt;
*Who would actually use such simulation (example of such user) and how would it help him&lt;br /&gt;
*What method and simulation environment you plan to use. Choose only from the development environments that we have used in the course.&lt;br /&gt;
*What variables will be incorporated&lt;br /&gt;
*What variables will be random&lt;br /&gt;
*What exact data you will base values of your variables on&lt;br /&gt;
*(In case of Monte Carlo) What exact data you will base your determination of probability distribution of your random variables on&lt;br /&gt;
*What exact data you will base your formulas in the simulation (simulation behavior) on &lt;br /&gt;
&lt;br /&gt;
'''If any of the above points are missing from the simulation proposal, the proposal is considered incomplete. Unless the proposal contains all of the above points it will not be evaluated at all (and therefore cannot be approved).'''&lt;br /&gt;
&lt;br /&gt;
# Is it clear from the proposed assignment how the simulation will work?&lt;br /&gt;
# Does the simulation make sense?&lt;br /&gt;
# Is the simulation model complex enough to simulate credibly the real-world phenomenon that the simulation tries to simulate?&lt;br /&gt;
# Is the data used real and relevant for the real-world phenomenon that the simulation tries to simulate?&lt;br /&gt;
# Is the simulation feasible? (in given time by the course)&lt;br /&gt;
&lt;br /&gt;
'''If the answer to any of the above points is no, you need to improve your proposal. Don't wait for us to tell you so - you're wasting your time.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
'''Assignment Proposal (Draft) Title:'''&lt;br /&gt;
*Simulation of pension reform in the Czech Republic: Analysis of long-term sustainability&lt;br /&gt;
&lt;br /&gt;
'''What will be simulated:'''&lt;br /&gt;
*A system dynamics model of the Czech pension system that simulates the long-term financial sustainability under varying demographic, economic, and policy scenarios. The simulation will project future balances of the pension system, incorporating the flows of revenues (social insurance contributions) and expenditures (pension payouts)&lt;br /&gt;
&lt;br /&gt;
'''Goal of the simulation (What problem should the simulation solve):'''&lt;br /&gt;
*The main goal is to analyze how different pension reform strategies (e.g., adjusting retirement age, altering contribution rates, changing the indexation formula of pensions) will affect the long-term stability of the Czech pension system. The simulation aims to identify specific policy levers and thresholds that ensure the pension system’s financial equilibrium over a multi-decade horizon, despite changing demographic and economic conditions.&lt;br /&gt;
&lt;br /&gt;
'''Who would use the simulation and how it helps them:'''&lt;br /&gt;
*The potential users include not only the Ministry of Finance, the Ministry of Labour and Social Affairs, but also the general public and the media. Although the model does not simulate the pension system in complete detail, it provides a general overview and helps users understand the basic mechanisms and trends that will shape the future of the pension system. In this way, users can:&lt;br /&gt;
**Gain a preliminary orientation and inspiration: By experimenting with simple scenarios (e.g., raising the retirement age or altering contribution rates), users can gain a clearer picture of how different reform steps could influence the stability of the pension system.&lt;br /&gt;
**Provide context for public debate: The model can assist citizens, journalists, and non-profit organizations in better understanding the issues surrounding pension reform. This allows them to critically evaluate political proposals or expert recommendations.&lt;br /&gt;
**Lead to more informed decision-making: While this is not a tool for detailed macroeconomic forecasting, the simulation provides a general insight into potential long-term trends. This can contribute to a broader understanding of the necessity for reforms and their impact on future generations.&lt;br /&gt;
&lt;br /&gt;
'''Method and simulation environment:'''&lt;br /&gt;
&lt;br /&gt;
*Method: System Dynamics&lt;br /&gt;
*Simulation environment: Vensim PLE (freely available for academic use)&lt;br /&gt;
&lt;br /&gt;
'''Variables in the model (deterministic and random):'''&lt;br /&gt;
&lt;br /&gt;
*Core Population Variables:&lt;br /&gt;
**Number of children (new entrants to future workforce)&lt;br /&gt;
**Number of working-age population (workers contributing to the system)&lt;br /&gt;
**Number of pensioners (beneficiaries)&lt;br /&gt;
&lt;br /&gt;
*Policy Variables:&lt;br /&gt;
**Statutory retirement age&lt;br /&gt;
**Contribution rate to social insurance (percentage of wage)&lt;br /&gt;
**Pension benefit formula and indexation mechanism&lt;br /&gt;
&lt;br /&gt;
*Economic Variables:&lt;br /&gt;
**Average wage (influences contributions)&lt;br /&gt;
**Inflation rate (influences indexation of pensions and wage growth)&lt;br /&gt;
&lt;br /&gt;
*Fiscal Variables:&lt;br /&gt;
**Total contributions collected (based on number of workers, contribution rate, and average wage)&lt;br /&gt;
**Total pension expenditure (based on number of pensioners and average pension)&lt;br /&gt;
**Pension system reserve fund (if applicable) and its depletion or accumulation&lt;br /&gt;
&lt;br /&gt;
*Random Variables:&lt;br /&gt;
**The model will incorporate stochastic elements through probability distributions derived from historical data and OECD/EUROSTAT projections to reflect uncertainty in:&lt;br /&gt;
***Fertility rate (affects future workforce size; random from projected distribution)&lt;br /&gt;
***Mortality rate / Life expectancy changes (stochastic variation around central OECD forecasts)&lt;br /&gt;
***Inflation rate (stochastic variation around central forecast from CNB/OECD data)&lt;br /&gt;
***Retirement rate (number of people retire each year +-)&lt;br /&gt;
&lt;br /&gt;
'''Data sources (for deterministic baseline and to derive distributions):'''&lt;br /&gt;
*Czech Statistical Office (ČSÚ) for historical demographic data&lt;br /&gt;
*OECD demographic and economic projections for Czech Republic&lt;br /&gt;
*Eurostat long-term demographic projections for EU countries&lt;br /&gt;
&lt;br /&gt;
'''Formulas in the simulation (examples):'''&lt;br /&gt;
*Pension Expenditure: Total Pension Expenditure = Number of Pensioners * Average Pension&lt;br /&gt;
*Average Pension Calculation: Average Pension(t+1) = Average Pension(t) * (1 + InflationIndex)&lt;br /&gt;
*Contribution Revenue: Total Contributions = Number of Workers * Average Wage * Contribution Rate&lt;br /&gt;
*System Balance: Annual Balance = Total Contributions - Total Pension Expenditure&lt;br /&gt;
*Accumulation or depletion of the pension reserve fund is then modeled as a stock: Reserve(t+1) = Reserve(t) + Annual Balance.&lt;br /&gt;
&lt;br /&gt;
'''Model complexity and data linking:'''&lt;br /&gt;
*'''Causal loop diagrams (CLD):''' Will illustrate feedback loops such as how employment and wage growth influence contributions, and how demographic changes influence the ratio of workers to retirees.&lt;br /&gt;
*'''Stock and Flow Diagrams:''' Will detail population stocks (children, workers, retirees), and financial stocks (pension fund reserves), along with flows (entrants to workforce, retirees, death rates, pension contributions, and payouts).&lt;br /&gt;
&lt;br /&gt;
'''Specific, measurable, and verifiable results:'''&lt;br /&gt;
*Specificity: The model will project the pension system’s financial status from year X to year X+50 under various reform scenarios, providing exact quantitative outcomes (e.g., fund balance in billions CZK, pension-to-wage ratio).&lt;br /&gt;
&lt;br /&gt;
*Measurable metrics:&lt;br /&gt;
**Dependency ratio (number of pensioners per 100 workers)&lt;br /&gt;
**Pension system annual balance (CZK) and cumulative reserves over time&lt;br /&gt;
**Average replacement rate (pension/average wage ratio)&lt;br /&gt;
**Sensitivity of sustainability gap to changes in retirement age or contribution rate&lt;br /&gt;
&lt;br /&gt;
*Verifiability: The initial model run will be calibrated against historical data for the past decade. Adjustments to parameters and comparison with known OECD and ČSÚ forecasts will verify the model’s credibility.&lt;br /&gt;
&lt;br /&gt;
[[User:Omaj01|Omaj01]] ([[User talk:Omaj01|talk]])&lt;br /&gt;
::'''APPROVED'''[[User:Oleg.Svatos|Oleg.Svatos]] ([[User talk:Oleg.Svatos|talk]]) 17:57, 6 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' Simulation concept – Invasive Plant Species vs. Native Plants vs. Herbivores Jan César (cesj05) '''&lt;br /&gt;
&lt;br /&gt;
''' Objectives: '''&lt;br /&gt;
&lt;br /&gt;
Understand the dynamics of competition between invasive plant species and native plants in a shared environment&lt;br /&gt;
&lt;br /&gt;
Explore the conditions under which either the invasive species dominates, coexists, or fails to establish.&lt;br /&gt;
&lt;br /&gt;
''' Environment: '''&lt;br /&gt;
&lt;br /&gt;
Each patch represents a piece of land that can grow either a natrive or invasive plant (or remain empty)&lt;br /&gt;
&lt;br /&gt;
Plants compete for resources on each path&lt;br /&gt;
&lt;br /&gt;
''' Agents: '''&lt;br /&gt;
&lt;br /&gt;
Native Plants: Slower growth but more resistant to herbivores or harsh conditions.&lt;br /&gt;
&lt;br /&gt;
Invasive Plants: Faster growth and higher seed dispersal rate but less resistant to herbivores.&lt;br /&gt;
&lt;br /&gt;
Herbivores: Agents that eat plants, with a preference for invasive or native species (modifiable by the user).&lt;br /&gt;
&lt;br /&gt;
''' Methods '''&lt;br /&gt;
&lt;br /&gt;
Initialization:&lt;br /&gt;
&lt;br /&gt;
Randomly populate the grid with a mix of invasive and native plants.&lt;br /&gt;
&lt;br /&gt;
Set up resource levels for each patch.&lt;br /&gt;
&lt;br /&gt;
Place herbivores randomly across the grid.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' Simulation Steps (Turtles/Agents): '''&lt;br /&gt;
&lt;br /&gt;
Each plant (agent) checks:&lt;br /&gt;
&lt;br /&gt;
Whether it has resources to grow or reproduce.&lt;br /&gt;
&lt;br /&gt;
If conditions are favorable, it spreads seeds to nearby patches.&lt;br /&gt;
&lt;br /&gt;
Herbivores move and consume plants on the patches they visit.&lt;br /&gt;
&lt;br /&gt;
Competition between plants on shared patches determines which survives.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' Interaction Dynamics: Modify the probability of herbivory or the effectiveness of seed dispersal as sliders to explore different scenarios.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The simulation will be done in NetLogo, as for the data, it will not be used from real world, but it will be set up, so the behaviour of agents will be as close as it can to real life.&lt;br /&gt;
&lt;br /&gt;
Used studies for setting up the behaviour of plants and herbivores will be: &lt;br /&gt;
https://www.mdpi.com/1424-2818/16/6/317&lt;br /&gt;
https://academic.oup.com/jpe/article/17/2/rtae007/7589693&lt;br /&gt;
&lt;br /&gt;
If needed, more studies will be used.&lt;br /&gt;
&lt;br /&gt;
This simulation can be used by gardeners trying to maintain their garden.   [[User:Cesj05|Cesj05]] ([[User talk:Cesj05|talk]]) 17:53, 6 December 2024 (CET)&lt;br /&gt;
----&lt;br /&gt;
== Simulation Concept – Traffic Accident Risk Analysis ==&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
* Understand the dynamics of traffic accidents based on road conditions, traffic density, and driver behavior.&lt;br /&gt;
* Explore the conditions under which accidents become frequent, and how they impact overall traffic flow.&lt;br /&gt;
* Test mitigation strategies like improved road quality or stricter speed limits.&lt;br /&gt;
&lt;br /&gt;
=== Environment ===&lt;br /&gt;
* '''Patches''': Represent road segments and intersections, each with a defined condition:&lt;br /&gt;
** '''Good''': Low accident probability.&lt;br /&gt;
** '''Bad''': Increased accident probability.&lt;br /&gt;
** '''Under Construction''': High accident probability and slower movement for cars.&lt;br /&gt;
* '''Road Network''': A grid-based layout with straight roads and intersections where traffic can flow.&lt;br /&gt;
&lt;br /&gt;
=== Agents ===&lt;br /&gt;
# '''Cars (Turtles):'''&lt;br /&gt;
## Each car has a speed, a destination, and a probability of making a driving error.&lt;br /&gt;
## Movement is influenced by traffic density and road conditions.&lt;br /&gt;
# '''Accidents:'''&lt;br /&gt;
## Simulated as blocked road segments.&lt;br /&gt;
## Cause delays and force cars to reroute.&lt;br /&gt;
# '''Traffic Lights (Optional):'''&lt;br /&gt;
## Located at intersections to control flow.&lt;br /&gt;
## Can be toggled on/off to explore their impact on accidents.&lt;br /&gt;
&lt;br /&gt;
=== Methods ===&lt;br /&gt;
==== Initialization ====&lt;br /&gt;
* Randomly distribute cars across the road network with initial speeds and destinations.&lt;br /&gt;
* Assign random conditions (good, bad, under construction) to road segments based on user input.&lt;br /&gt;
&lt;br /&gt;
==== Simulation Steps (Turtles/Agents) ====&lt;br /&gt;
# '''Movement:'''&lt;br /&gt;
## Cars follow road segments, moving faster on good roads and slower on bad/under-construction ones.&lt;br /&gt;
# '''Accident Risk:'''&lt;br /&gt;
## Probability of an accident increases with:&lt;br /&gt;
### Poor road conditions.&lt;br /&gt;
### High speed.&lt;br /&gt;
### High traffic density.&lt;br /&gt;
# '''Accident Handling:'''&lt;br /&gt;
## If an accident occurs, the road segment is temporarily blocked.&lt;br /&gt;
## Cars reroute to avoid the blocked segment, increasing congestion elsewhere.&lt;br /&gt;
# '''Recovery:'''&lt;br /&gt;
## Accidents are cleared after a set duration, restoring traffic flow.&lt;br /&gt;
&lt;br /&gt;
==== Interaction Dynamics ====&lt;br /&gt;
* '''User Controls:'''&lt;br /&gt;
** Traffic density, road condition distribution, speed limits, and driver error probabilities can be adjusted with sliders.&lt;br /&gt;
* '''Scenarios:'''&lt;br /&gt;
** Test high traffic density with poor roads versus low traffic density with good roads.&lt;br /&gt;
** Simulate stricter traffic laws by reducing driver errors and imposing speed limits.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Details ===&lt;br /&gt;
* '''Platform''': NetLogo.&lt;br /&gt;
* '''Data Source''': Synthetic data will be used to mimic real-world traffic dynamics based on studies and assumptions.&lt;br /&gt;
* '''Behavior Setup''': Modeled on findings from traffic and safety research:&lt;br /&gt;
** [https://www.tandfonline.com/doi/full/10.1080/13669877.2010.547259 Study 1]&lt;br /&gt;
** [https://www.tandfonline.com/doi/pdf/10.1080/23311916.2020.1834659 Study 2]&lt;br /&gt;
** [https://www.tandfonline.com/doi/pdf/10.1080/16483840.2003.10414070 Study 3]&lt;br /&gt;
* Additional studies will be incorporated if needed to refine parameters.&lt;br /&gt;
[[User:Sim timm03|Sim timm03]] ([[User talk:Sim timm03|talk]]) 16:11, 7 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= Assignment Proposal (Draft) =&lt;br /&gt;
&lt;br /&gt;
== Title ==&lt;br /&gt;
'''Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics'''&lt;br /&gt;
&lt;br /&gt;
== What will be simulated ==&lt;br /&gt;
*A simulation of a store environment where security guards patrol to prevent thieves from stealing goods and escaping through designated exits. The store layout includes customizable obstacles (regals), guards, and thieves. The simulation focuses on the limited visibility due to obstacles and models the dynamic interaction between guards and thieves, exploring how the required number of guards changes based on the number of thieves.*&lt;br /&gt;
&lt;br /&gt;
== Goal of the simulation (What problem should the simulation solve) ==&lt;br /&gt;
*The simulation aims to determine the optimal number of guards needed to secure a store effectively under varying conditions of thief count. The ultimate goal is to provide recommendations for store security design based on quantitative analysis.*&lt;br /&gt;
&lt;br /&gt;
== Who would use the simulation and how it helps them ==&lt;br /&gt;
*Store Managers and Security Companies*: Helps in designing security layouts and determining the number of security guards needed to maximize efficiency and minimize theft.  &lt;br /&gt;
*Students*: Offers insights into visibility-limited environments and agent-based modeling techniques.&lt;br /&gt;
&lt;br /&gt;
== Method and simulation environment ==&lt;br /&gt;
* '''Method''': Agent-based modeling  &lt;br /&gt;
* '''Simulation environment''': NetLogo  &lt;br /&gt;
&lt;br /&gt;
== Variables in the model (deterministic and random) ==&lt;br /&gt;
&lt;br /&gt;
=== Deterministic Variables ===&lt;br /&gt;
* Number of guards  &lt;br /&gt;
* Number of thieves  &lt;br /&gt;
* Number of regals (obstacles): Fixed positions  &lt;br /&gt;
* Store size: Fixed at 8×8 grid  &lt;br /&gt;
* Guard and thief placement: Guards are placed on opposite sides of the store to maximize coverage; thieves are placed randomly.  &lt;br /&gt;
&lt;br /&gt;
=== Random Variables ===&lt;br /&gt;
* Movement paths: Thieves and guards move dynamically based on patrol or escape strategies.  &lt;br /&gt;
* Thief behavior: Randomized target selection for obstacles and exits.  &lt;br /&gt;
* Guard patrol patterns: Random movement within patrol zones unless a thief is spotted.  &lt;br /&gt;
&lt;br /&gt;
== Formulas in the simulation (examples) ==&lt;br /&gt;
* '''Guard visibility''':  &lt;br /&gt;
  * \( \text{Visible range} = d \), where \( d \) is the number of unobstructed cells (line of sight blocked by obstacles).  &lt;br /&gt;
* '''Thief capture condition''':  &lt;br /&gt;
  * A thief is captured if a guard moves onto the same cell.  &lt;br /&gt;
* '''Escape success''':  &lt;br /&gt;
  * A thief escapes if it reaches an exit before being captured.  &lt;br /&gt;
* '''Capture efficiency''':  &lt;br /&gt;
  * \( \text{Efficiency} = \frac{\text{Captured thieves}}{\text{Total thieves}} \)  &lt;br /&gt;
&lt;br /&gt;
== Model complexity and data linking ==&lt;br /&gt;
* '''Guard and thief dynamics''':  &lt;br /&gt;
  * Guards patrol predefined zones or reactively chase thieves if spotted.  &lt;br /&gt;
  * Thieves move toward regals to &amp;quot;steal&amp;quot; and then to exits to escape.  &lt;br /&gt;
* '''Obstacle placement''':  &lt;br /&gt;
  * Regals are fixed in predefined locations that block visibility and movement.  &lt;br /&gt;
* '''Outputs''':  &lt;br /&gt;
  * Capture success rate  &lt;br /&gt;
  * Number of escaped thieves  &lt;br /&gt;
  * Guard efficiency metrics  &lt;br /&gt;
&lt;br /&gt;
== Specific, measurable, and verifiable results ==&lt;br /&gt;
* '''Specificity''':  &lt;br /&gt;
  * The model provides quantitative insights into the number of guards needed to maintain security across various scenarios.  &lt;br /&gt;
* '''Measurable metrics''':  &lt;br /&gt;
  * Capture rate (% of thieves caught)  &lt;br /&gt;
  * Escape rate (% of thieves successfully escaped)  &lt;br /&gt;
  * Average patrol effectiveness (distance covered by guards and time to interception).  &lt;br /&gt;
&lt;br /&gt;
== Key questions the simulation will answer ==&lt;br /&gt;
# How does the number of guards required to secure the store change with varying numbers of thieves?  &lt;br /&gt;
# What are the most effective patrol strategies for guards in a fixed environment with limited visibility?  &lt;br /&gt;
# How does the coordination or randomness of thieves’ behavior influence the effectiveness of the store's security?  &lt;br /&gt;
&lt;br /&gt;
[[User:Holp11|Holp11]] ([[User talk:Holp11|talk]]) 21:06, 7 December 2024 (CET)&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Assignments_WS_2024/2025&amp;diff=26098</id>
		<title>Assignments WS 2024/2025</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Assignments_WS_2024/2025&amp;diff=26098"/>
		<updated>2024-12-07T19:50:38Z</updated>

		<summary type="html">&lt;p&gt;Holp11: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Ambox&lt;br /&gt;
| text  = &amp;lt;div&amp;gt;&lt;br /&gt;
Please, put here your assignments. Do not forget to sign them. You can use &amp;lt;nowiki&amp;gt;~~~~&amp;lt;/nowiki&amp;gt; (four tildas) for an automatic signature. Use Show preview in order to check the result before your final sumbition.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Ambox&lt;br /&gt;
| text  = &amp;lt;div&amp;gt;&lt;br /&gt;
Please, strive to formulate your assignment carefully. We expect an adequate effort to formulate the assignment as it is your semestral paper. Do not forget that your main goal is a research paper. It means your simulation model must generate the results that are specific, measurable and verifiable. Think twice how you will develop your model, which entities you will use, draw a model diagram, consider what you will measure. No sooner than when you have a good idea about the model, submit your assignment. And of course, read [[How to deal with the simulation assignment|How to deal with the simulation assignment]].&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Ambox&lt;br /&gt;
| text  = &amp;lt;div&amp;gt;&lt;br /&gt;
Topics on gambling, cards, etc. are not welcome.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Ambox&lt;br /&gt;
| type  = content&lt;br /&gt;
| text  = &amp;lt;div&amp;gt;&lt;br /&gt;
In order to avoid possible confusion, please, check if you have added '''approved''' in bold somewhere in our comment under your submission. If there is no '''approved''', it means the assignment was not approved yet.&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
{{Ambox&lt;br /&gt;
| text  = &amp;lt;div&amp;gt;&lt;br /&gt;
'''Criteria for evaluation of the simulation proposal'''&lt;br /&gt;
&lt;br /&gt;
The proposal must contain:&lt;br /&gt;
*What you will simulate&lt;br /&gt;
*The goal of the simulation (what you analyze - i.e. not &amp;quot;to simulate balloon factory&amp;quot;, but what problem should the simulation solve).&lt;br /&gt;
*Who would actually use such simulation (example of such user) and how would it help him&lt;br /&gt;
*What method and simulation environment you plan to use. Choose only from the development environments that we have used in the course.&lt;br /&gt;
*What variables will be incorporated&lt;br /&gt;
*What variables will be random&lt;br /&gt;
*What exact data you will base values of your variables on&lt;br /&gt;
*(In case of Monte Carlo) What exact data you will base your determination of probability distribution of your random variables on&lt;br /&gt;
*What exact data you will base your formulas in the simulation (simulation behavior) on &lt;br /&gt;
&lt;br /&gt;
'''If any of the above points are missing from the simulation proposal, the proposal is considered incomplete. Unless the proposal contains all of the above points it will not be evaluated at all (and therefore cannot be approved).'''&lt;br /&gt;
&lt;br /&gt;
# Is it clear from the proposed assignment how the simulation will work?&lt;br /&gt;
# Does the simulation make sense?&lt;br /&gt;
# Is the simulation model complex enough to simulate credibly the real-world phenomenon that the simulation tries to simulate?&lt;br /&gt;
# Is the data used real and relevant for the real-world phenomenon that the simulation tries to simulate?&lt;br /&gt;
# Is the simulation feasible? (in given time by the course)&lt;br /&gt;
&lt;br /&gt;
'''If the answer to any of the above points is no, you need to improve your proposal. Don't wait for us to tell you so - you're wasting your time.'''&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/div&amp;gt;&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
'''Assignment Proposal (Draft) Title:'''&lt;br /&gt;
*Simulation of pension reform in the Czech Republic: Analysis of long-term sustainability&lt;br /&gt;
&lt;br /&gt;
'''What will be simulated:'''&lt;br /&gt;
*A system dynamics model of the Czech pension system that simulates the long-term financial sustainability under varying demographic, economic, and policy scenarios. The simulation will project future balances of the pension system, incorporating the flows of revenues (social insurance contributions) and expenditures (pension payouts)&lt;br /&gt;
&lt;br /&gt;
'''Goal of the simulation (What problem should the simulation solve):'''&lt;br /&gt;
*The main goal is to analyze how different pension reform strategies (e.g., adjusting retirement age, altering contribution rates, changing the indexation formula of pensions) will affect the long-term stability of the Czech pension system. The simulation aims to identify specific policy levers and thresholds that ensure the pension system’s financial equilibrium over a multi-decade horizon, despite changing demographic and economic conditions.&lt;br /&gt;
&lt;br /&gt;
'''Who would use the simulation and how it helps them:'''&lt;br /&gt;
*The potential users include not only the Ministry of Finance, the Ministry of Labour and Social Affairs, but also the general public and the media. Although the model does not simulate the pension system in complete detail, it provides a general overview and helps users understand the basic mechanisms and trends that will shape the future of the pension system. In this way, users can:&lt;br /&gt;
**Gain a preliminary orientation and inspiration: By experimenting with simple scenarios (e.g., raising the retirement age or altering contribution rates), users can gain a clearer picture of how different reform steps could influence the stability of the pension system.&lt;br /&gt;
**Provide context for public debate: The model can assist citizens, journalists, and non-profit organizations in better understanding the issues surrounding pension reform. This allows them to critically evaluate political proposals or expert recommendations.&lt;br /&gt;
**Lead to more informed decision-making: While this is not a tool for detailed macroeconomic forecasting, the simulation provides a general insight into potential long-term trends. This can contribute to a broader understanding of the necessity for reforms and their impact on future generations.&lt;br /&gt;
&lt;br /&gt;
'''Method and simulation environment:'''&lt;br /&gt;
&lt;br /&gt;
*Method: System Dynamics&lt;br /&gt;
*Simulation environment: Vensim PLE (freely available for academic use)&lt;br /&gt;
&lt;br /&gt;
'''Variables in the model (deterministic and random):'''&lt;br /&gt;
&lt;br /&gt;
*Core Population Variables:&lt;br /&gt;
**Number of children (new entrants to future workforce)&lt;br /&gt;
**Number of working-age population (workers contributing to the system)&lt;br /&gt;
**Number of pensioners (beneficiaries)&lt;br /&gt;
&lt;br /&gt;
*Policy Variables:&lt;br /&gt;
**Statutory retirement age&lt;br /&gt;
**Contribution rate to social insurance (percentage of wage)&lt;br /&gt;
**Pension benefit formula and indexation mechanism&lt;br /&gt;
&lt;br /&gt;
*Economic Variables:&lt;br /&gt;
**Average wage (influences contributions)&lt;br /&gt;
**Inflation rate (influences indexation of pensions and wage growth)&lt;br /&gt;
&lt;br /&gt;
*Fiscal Variables:&lt;br /&gt;
**Total contributions collected (based on number of workers, contribution rate, and average wage)&lt;br /&gt;
**Total pension expenditure (based on number of pensioners and average pension)&lt;br /&gt;
**Pension system reserve fund (if applicable) and its depletion or accumulation&lt;br /&gt;
&lt;br /&gt;
*Random Variables:&lt;br /&gt;
**The model will incorporate stochastic elements through probability distributions derived from historical data and OECD/EUROSTAT projections to reflect uncertainty in:&lt;br /&gt;
***Fertility rate (affects future workforce size; random from projected distribution)&lt;br /&gt;
***Mortality rate / Life expectancy changes (stochastic variation around central OECD forecasts)&lt;br /&gt;
***Inflation rate (stochastic variation around central forecast from CNB/OECD data)&lt;br /&gt;
***Retirement rate (number of people retire each year +-)&lt;br /&gt;
&lt;br /&gt;
'''Data sources (for deterministic baseline and to derive distributions):'''&lt;br /&gt;
*Czech Statistical Office (ČSÚ) for historical demographic data&lt;br /&gt;
*OECD demographic and economic projections for Czech Republic&lt;br /&gt;
*Eurostat long-term demographic projections for EU countries&lt;br /&gt;
&lt;br /&gt;
'''Formulas in the simulation (examples):'''&lt;br /&gt;
*Pension Expenditure: Total Pension Expenditure = Number of Pensioners * Average Pension&lt;br /&gt;
*Average Pension Calculation: Average Pension(t+1) = Average Pension(t) * (1 + InflationIndex)&lt;br /&gt;
*Contribution Revenue: Total Contributions = Number of Workers * Average Wage * Contribution Rate&lt;br /&gt;
*System Balance: Annual Balance = Total Contributions - Total Pension Expenditure&lt;br /&gt;
*Accumulation or depletion of the pension reserve fund is then modeled as a stock: Reserve(t+1) = Reserve(t) + Annual Balance.&lt;br /&gt;
&lt;br /&gt;
'''Model complexity and data linking:'''&lt;br /&gt;
*'''Causal loop diagrams (CLD):''' Will illustrate feedback loops such as how employment and wage growth influence contributions, and how demographic changes influence the ratio of workers to retirees.&lt;br /&gt;
*'''Stock and Flow Diagrams:''' Will detail population stocks (children, workers, retirees), and financial stocks (pension fund reserves), along with flows (entrants to workforce, retirees, death rates, pension contributions, and payouts).&lt;br /&gt;
&lt;br /&gt;
'''Specific, measurable, and verifiable results:'''&lt;br /&gt;
*Specificity: The model will project the pension system’s financial status from year X to year X+50 under various reform scenarios, providing exact quantitative outcomes (e.g., fund balance in billions CZK, pension-to-wage ratio).&lt;br /&gt;
&lt;br /&gt;
*Measurable metrics:&lt;br /&gt;
**Dependency ratio (number of pensioners per 100 workers)&lt;br /&gt;
**Pension system annual balance (CZK) and cumulative reserves over time&lt;br /&gt;
**Average replacement rate (pension/average wage ratio)&lt;br /&gt;
**Sensitivity of sustainability gap to changes in retirement age or contribution rate&lt;br /&gt;
&lt;br /&gt;
*Verifiability: The initial model run will be calibrated against historical data for the past decade. Adjustments to parameters and comparison with known OECD and ČSÚ forecasts will verify the model’s credibility.&lt;br /&gt;
&lt;br /&gt;
[[User:Omaj01|Omaj01]] ([[User talk:Omaj01|talk]])&lt;br /&gt;
::'''APPROVED'''[[User:Oleg.Svatos|Oleg.Svatos]] ([[User talk:Oleg.Svatos|talk]]) 17:57, 6 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' Simulation concept – Invasive Plant Species vs. Native Plants vs. Herbivores Jan César (cesj05) '''&lt;br /&gt;
&lt;br /&gt;
''' Objectives: '''&lt;br /&gt;
&lt;br /&gt;
Understand the dynamics of competition between invasive plant species and native plants in a shared environment&lt;br /&gt;
&lt;br /&gt;
Explore the conditions under which either the invasive species dominates, coexists, or fails to establish.&lt;br /&gt;
&lt;br /&gt;
''' Environment: '''&lt;br /&gt;
&lt;br /&gt;
Each patch represents a piece of land that can grow either a natrive or invasive plant (or remain empty)&lt;br /&gt;
&lt;br /&gt;
Plants compete for resources on each path&lt;br /&gt;
&lt;br /&gt;
''' Agents: '''&lt;br /&gt;
&lt;br /&gt;
Native Plants: Slower growth but more resistant to herbivores or harsh conditions.&lt;br /&gt;
&lt;br /&gt;
Invasive Plants: Faster growth and higher seed dispersal rate but less resistant to herbivores.&lt;br /&gt;
&lt;br /&gt;
Herbivores: Agents that eat plants, with a preference for invasive or native species (modifiable by the user).&lt;br /&gt;
&lt;br /&gt;
''' Methods '''&lt;br /&gt;
&lt;br /&gt;
Initialization:&lt;br /&gt;
&lt;br /&gt;
Randomly populate the grid with a mix of invasive and native plants.&lt;br /&gt;
&lt;br /&gt;
Set up resource levels for each patch.&lt;br /&gt;
&lt;br /&gt;
Place herbivores randomly across the grid.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' Simulation Steps (Turtles/Agents): '''&lt;br /&gt;
&lt;br /&gt;
Each plant (agent) checks:&lt;br /&gt;
&lt;br /&gt;
Whether it has resources to grow or reproduce.&lt;br /&gt;
&lt;br /&gt;
If conditions are favorable, it spreads seeds to nearby patches.&lt;br /&gt;
&lt;br /&gt;
Herbivores move and consume plants on the patches they visit.&lt;br /&gt;
&lt;br /&gt;
Competition between plants on shared patches determines which survives.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' Interaction Dynamics: Modify the probability of herbivory or the effectiveness of seed dispersal as sliders to explore different scenarios.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The simulation will be done in NetLogo, as for the data, it will not be used from real world, but it will be set up, so the behaviour of agents will be as close as it can to real life.&lt;br /&gt;
&lt;br /&gt;
Used studies for setting up the behaviour of plants and herbivores will be: &lt;br /&gt;
https://www.mdpi.com/1424-2818/16/6/317&lt;br /&gt;
https://academic.oup.com/jpe/article/17/2/rtae007/7589693&lt;br /&gt;
&lt;br /&gt;
If needed, more studies will be used.&lt;br /&gt;
&lt;br /&gt;
This simulation can be used by gardeners trying to maintain their garden.   [[User:Cesj05|Cesj05]] ([[User talk:Cesj05|talk]]) 17:53, 6 December 2024 (CET)&lt;br /&gt;
----&lt;br /&gt;
== Simulation Concept – Traffic Accident Risk Analysis ==&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
* Understand the dynamics of traffic accidents based on road conditions, traffic density, and driver behavior.&lt;br /&gt;
* Explore the conditions under which accidents become frequent, and how they impact overall traffic flow.&lt;br /&gt;
* Test mitigation strategies like improved road quality or stricter speed limits.&lt;br /&gt;
&lt;br /&gt;
=== Environment ===&lt;br /&gt;
* '''Patches''': Represent road segments and intersections, each with a defined condition:&lt;br /&gt;
** '''Good''': Low accident probability.&lt;br /&gt;
** '''Bad''': Increased accident probability.&lt;br /&gt;
** '''Under Construction''': High accident probability and slower movement for cars.&lt;br /&gt;
* '''Road Network''': A grid-based layout with straight roads and intersections where traffic can flow.&lt;br /&gt;
&lt;br /&gt;
=== Agents ===&lt;br /&gt;
# '''Cars (Turtles):'''&lt;br /&gt;
## Each car has a speed, a destination, and a probability of making a driving error.&lt;br /&gt;
## Movement is influenced by traffic density and road conditions.&lt;br /&gt;
# '''Accidents:'''&lt;br /&gt;
## Simulated as blocked road segments.&lt;br /&gt;
## Cause delays and force cars to reroute.&lt;br /&gt;
# '''Traffic Lights (Optional):'''&lt;br /&gt;
## Located at intersections to control flow.&lt;br /&gt;
## Can be toggled on/off to explore their impact on accidents.&lt;br /&gt;
&lt;br /&gt;
=== Methods ===&lt;br /&gt;
==== Initialization ====&lt;br /&gt;
* Randomly distribute cars across the road network with initial speeds and destinations.&lt;br /&gt;
* Assign random conditions (good, bad, under construction) to road segments based on user input.&lt;br /&gt;
&lt;br /&gt;
==== Simulation Steps (Turtles/Agents) ====&lt;br /&gt;
# '''Movement:'''&lt;br /&gt;
## Cars follow road segments, moving faster on good roads and slower on bad/under-construction ones.&lt;br /&gt;
# '''Accident Risk:'''&lt;br /&gt;
## Probability of an accident increases with:&lt;br /&gt;
### Poor road conditions.&lt;br /&gt;
### High speed.&lt;br /&gt;
### High traffic density.&lt;br /&gt;
# '''Accident Handling:'''&lt;br /&gt;
## If an accident occurs, the road segment is temporarily blocked.&lt;br /&gt;
## Cars reroute to avoid the blocked segment, increasing congestion elsewhere.&lt;br /&gt;
# '''Recovery:'''&lt;br /&gt;
## Accidents are cleared after a set duration, restoring traffic flow.&lt;br /&gt;
&lt;br /&gt;
==== Interaction Dynamics ====&lt;br /&gt;
* '''User Controls:'''&lt;br /&gt;
** Traffic density, road condition distribution, speed limits, and driver error probabilities can be adjusted with sliders.&lt;br /&gt;
* '''Scenarios:'''&lt;br /&gt;
** Test high traffic density with poor roads versus low traffic density with good roads.&lt;br /&gt;
** Simulate stricter traffic laws by reducing driver errors and imposing speed limits.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Details ===&lt;br /&gt;
* '''Platform''': NetLogo.&lt;br /&gt;
* '''Data Source''': Synthetic data will be used to mimic real-world traffic dynamics based on studies and assumptions.&lt;br /&gt;
* '''Behavior Setup''': Modeled on findings from traffic and safety research:&lt;br /&gt;
** [https://www.tandfonline.com/doi/full/10.1080/13669877.2010.547259 Study 1]&lt;br /&gt;
** [https://www.tandfonline.com/doi/pdf/10.1080/23311916.2020.1834659 Study 2]&lt;br /&gt;
** [https://www.tandfonline.com/doi/pdf/10.1080/16483840.2003.10414070 Study 3]&lt;br /&gt;
* Additional studies will be incorporated if needed to refine parameters.&lt;br /&gt;
[[User:Sim timm03|Sim timm03]] ([[User talk:Sim timm03|talk]]) 16:11, 7 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
**'''Assignment Proposal (Draft)'''**&lt;br /&gt;
&lt;br /&gt;
**'''Title:'''**  &lt;br /&gt;
*Simulation of Security Efficiency in a Store: Analyzing Optimal Guard Allocation Based on Obstruction and Escape Dynamics*&lt;br /&gt;
&lt;br /&gt;
**'''What will be simulated:'''**  &lt;br /&gt;
*A simulation of a store environment where security guards patrol to prevent thieves from stealing goods and escaping through designated exits. The store layout includes customizable obstacles (regals), guards, and thieves. The simulation focuses on the limited visibility due to obstacles and models the dynamic interaction between guards and thieves, exploring how the required number of guards changes based on the number of thieves.*&lt;br /&gt;
&lt;br /&gt;
**'''Goal of the simulation (What problem should the simulation solve):'''**  &lt;br /&gt;
*The simulation aims to determine the optimal number of guards needed to secure a store effectively under varying conditions of thief count. The ultimate goal is to provide recommendations for store security design based on quantitative analysis.*&lt;br /&gt;
&lt;br /&gt;
**'''Who would use the simulation and how it helps them:'''**  &lt;br /&gt;
- *Store Managers and Security Companies*: Helps in designing security layouts and determining the number of security guards needed to maximize efficiency and minimize theft.  &lt;br /&gt;
- *Students*: Offers insights into visibility-limited environments and agent-based modeling techniques.&lt;br /&gt;
&lt;br /&gt;
**'''Method and simulation environment:'''**  &lt;br /&gt;
- *Method*: Agent-based modeling  &lt;br /&gt;
- *Simulation environment*: NetLogo  &lt;br /&gt;
&lt;br /&gt;
**'''Variables in the model (deterministic and random):'''**&lt;br /&gt;
&lt;br /&gt;
- *Deterministic Variables*:  &lt;br /&gt;
  - Number of guards  &lt;br /&gt;
  - Number of thieves  &lt;br /&gt;
  - Number of regals (obstacles): Fixed positions  &lt;br /&gt;
  - Store size: Fixed at 8×8 grid  &lt;br /&gt;
  - Guard and thief placement: Guards are placed on opposite sides of the store to maximize coverage; thieves are placed randomly.  &lt;br /&gt;
&lt;br /&gt;
- *Random Variables*:  &lt;br /&gt;
  - Movement paths: Thieves and guards move dynamically based on patrol or escape strategies.  &lt;br /&gt;
  - Thief behavior: Randomized target selection for obstacles and exits.  &lt;br /&gt;
  - Guard patrol patterns: Random movement within patrol zones unless a thief is spotted.  &lt;br /&gt;
&lt;br /&gt;
**'''Formulas in the simulation (examples):'''**  &lt;br /&gt;
- *Guard visibility*:  &lt;br /&gt;
  - \( \text{Visible range} = d \), where \( d \) is the number of unobstructed cells (line of sight blocked by obstacles).  &lt;br /&gt;
- *Thief capture condition*:  &lt;br /&gt;
  - A thief is captured if a guard moves onto the same cell.  &lt;br /&gt;
- *Escape success*:  &lt;br /&gt;
  - A thief escapes if it reaches an exit before being captured.  &lt;br /&gt;
- *Capture efficiency*:  &lt;br /&gt;
  - \( \text{Efficiency} = \frac{\text{Captured thieves}}{\text{Total thieves}} \)  &lt;br /&gt;
&lt;br /&gt;
**'''Model complexity and data linking:'''**  &lt;br /&gt;
- *Guard and thief dynamics*:  &lt;br /&gt;
  - Guards patrol predefined zones or reactively chase thieves if spotted.  &lt;br /&gt;
  - Thieves move toward regals to &amp;quot;steal&amp;quot; and then to exits to escape.  &lt;br /&gt;
- *Obstacle placement*:  &lt;br /&gt;
  - Regals are fixed in predefined locations that block visibility and movement.  &lt;br /&gt;
- *Outputs*:  &lt;br /&gt;
  - Capture success rate  &lt;br /&gt;
  - Number of escaped thieves  &lt;br /&gt;
  - Guard efficiency metrics  &lt;br /&gt;
&lt;br /&gt;
**'''Specific, measurable, and verifiable results:'''**  &lt;br /&gt;
- *Specificity*:  &lt;br /&gt;
  - The model provides quantitative insights into the number of guards needed to maintain security across various scenarios.  &lt;br /&gt;
- *Measurable metrics*:  &lt;br /&gt;
  - Capture rate (% of thieves caught)  &lt;br /&gt;
  - Escape rate (% of thieves successfully escaped)  &lt;br /&gt;
  - Average patrol effectiveness (distance covered by guards and time to interception).  &lt;br /&gt;
&lt;br /&gt;
**'''Key questions the simulation will answer:'''**  &lt;br /&gt;
1. How does the number of guards required to secure the store change with varying numbers of thieves?  &lt;br /&gt;
2. What are the most effective patrol strategies for guards in a fixed environment with limited visibility?  &lt;br /&gt;
3. How does the coordination or randomness of thieves’ behavior influence the effectiveness of the store's security?  &lt;br /&gt;
&lt;br /&gt;
[[User:Holp11|Holp11]] ([[User talk:Holp11|talk]]) 20:49, 7 December 2024 (CET)&lt;/div&gt;</summary>
		<author><name>Holp11</name></author>
		
	</entry>
</feed>