<?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=Tros01</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=Tros01"/>
	<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php/Special:Contributions/Tros01"/>
	<updated>2026-07-27T16:31:21Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.31.1</generator>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26620</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26620"/>
		<updated>2025-01-26T22:53:18Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Discussion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
The simulation is implemented in Julia using the Distributions, StatsBase, and Logging packages.&lt;br /&gt;
Logging is enabled to output data about records, agents and overall progress of simulation to a log file called simulation.log.&lt;br /&gt;
&lt;br /&gt;
Plots are used for visualization and stored as *.png files.&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
: It is because in our group we have three active leaders for the regular meating.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10, 30, 50].&lt;br /&gt;
: I do not expect to have higher hundreds of the records in the db and I am mainly interested in the begining of the process so here chosen values provide enough info. &lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
:Because I originally intended to have Records quality kept in range from 1-10 I picked the lognormal distribution with parameters that would result in relatively low to mid quality of records created. Thats reflect better the reality because records can not have high quality without feedback from kids after at least few tries of given activity, which can not be accumulated earlier than after some time, so new records should not have higher initialQuality.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
: This value was was chosen in hope that leaders will tend to return the favor after using the found record. Also its easier than creating new record, but of course it can not be in all cases so 0.7 seems appropriet.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
: According to logic applied in qualityImprovementProb here I assume that because the agent didnt found a useful record, he wont be that much interested in investing his time to write down the activity so it could be recorded. And much less when realizing how much pain is to create a quality and useful record.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
: Originaly I intended to have categories explicitly named for closer resemblance with reality but I failed to find a real contribution for the simulation, because real live categories are much more comple so this simplified idea is not much realistic to begin with therefore i came to conclusion that using just simple intagers to represent the categories will be better choice for this case.&lt;br /&gt;
The original idea was something like this. &lt;br /&gt;
 const TYPES = [&amp;quot;running&amp;quot;, &amp;quot;creative&amp;quot;, &amp;quot;thinking&amp;quot;, &amp;quot;discussion&amp;quot;, &amp;quot;history&amp;quot;]  # Types of activities&lt;br /&gt;
 const PLACES = [&amp;quot;room&amp;quot;, &amp;quot;forest&amp;quot;, &amp;quot;city&amp;quot;, &amp;quot;playground&amp;quot;]  # Possible places for activities&lt;br /&gt;
 const CATEGORIES = [(t, p) for t in TYPES for p in PLACES]  # Generate all combinations of types and places&lt;br /&gt;
:Using intager instead makes for example much easier change the number of categories, which could be interesting to see how its change influences the observed values.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next three variables limits how long will the simulation run, respectively how long needs the system to be usefull without &amp;quot;fail&amp;quot;.&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
Such a long time period was chosen based on my requirements, but in the end this choice proved somewhat contraproductive for getting a good results.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
&lt;br /&gt;
*Simplified Categories: The categories used in the model are represented by integers and lack any explicit meaning. It was intended to use a combination of string as category representation, but the complexity has no effect on the results, therefore integer representation is used to make code simpler.&lt;br /&gt;
*Agent Uniformity: Each agent has an identical recordCreationProb which is not realistic, and does not model different level of contributing to the db.&lt;br /&gt;
*Fixed Parameters: Many model parameters, such as qualityImprovementProb, recordCreationProb, NUM_AGENTS are fixed values and don't change during simulation, which makes the simulation a bit static.&lt;br /&gt;
*Single Activity Per Week: Each agent prepares only one activity per week, which may be an oversimplification of real user behavior.&lt;br /&gt;
*Limited Complexity: The simulation lacks a deeper understanding of how records relate to each other or have a more diverse properties than just an &amp;quot;quality&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
&lt;br /&gt;
Also in the github repository with code, there are plots showing how the successrate evolves in time.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately the implementation can not ends earlier then after at least small fixed timeframe.&lt;br /&gt;
Its obvious that the results are heavily influenced by the randomness in the model.&lt;br /&gt;
&lt;br /&gt;
It seems that the first small batch upload has the largest influence on the resulting values and larger batches brings only relatively smaller improvements, that suggests to use the batch upload in real life, but its redundant to focus on optimizing the upload process for larger amounts, because they are not needed and only small amount of records (10) is enough to significantly boost the speed of populating.&lt;br /&gt;
&lt;br /&gt;
Also the amounts of records additionally created after 50 batch upload seems a bit unexpected, because after results seen in smaller batches one would expect a number around 15 or smaller. If it is not another bug in my code, I would guess that its bacause of small sample of results. batch50[22, 27, 19, 22, 70], batch30[39, 25, 14, 24, 26] are the results obtained by additional runs, its still strange how much records is created in case of 50 batch, but also the cause of small sample is still viable explanation.&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
:weeks: [55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
:records: [32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: [35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
:records: [35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: [21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
:records: [13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: [33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
:records: [58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
Well, those are here just for fun because there is not much value in such results except for showing something does not work as expected.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
In this simulation I managed to create heavily simplified model of database populating process in our boy scouts group.&lt;br /&gt;
&lt;br /&gt;
Therefore the resuls appears to be approximately as they should, but they lack on the reliability if they should be used as a base for a decision.&lt;br /&gt;
At most I can take a hint about the amount of records to batch upload. That relatively small amount makes a major difference.&lt;br /&gt;
&lt;br /&gt;
To further improve the model there should be implemented:&lt;br /&gt;
*Chance for agents to &amp;quot;not like the record&amp;quot;, that would sometimes stoped the agent from picking a record to use. It could try picking another if there would be more, if not the search would fail. This would be a small improvment to a model realisticity.&lt;br /&gt;
*Enhance the feature of records quality so it could not be increased infinitely. &lt;br /&gt;
*Add monitoring for values of records quality, so I can see better what is the state of the db like.&lt;br /&gt;
&lt;br /&gt;
Besides improving the model, the simulation would greatly benefit from basing used probabilities on real live &amp;quot;agents&amp;quot;, not on fixed value for everyone.&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
This is my code on github, because I could not upload .jl file and a did not wanted to make zip: [https://raw.githubusercontent.com/simik394/simulace-populatingskautdb/refs/heads/main/simulace-nobatch.jl]&lt;br /&gt;
&lt;br /&gt;
And the home repo [https://github.com/simik394/simulace-populatingskautdb]&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26619</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26619"/>
		<updated>2025-01-26T22:47:39Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Single run */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
The simulation is implemented in Julia using the Distributions, StatsBase, and Logging packages.&lt;br /&gt;
Logging is enabled to output data about records, agents and overall progress of simulation to a log file called simulation.log.&lt;br /&gt;
&lt;br /&gt;
Plots are used for visualization and stored as *.png files.&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
: It is because in our group we have three active leaders for the regular meating.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10, 30, 50].&lt;br /&gt;
: I do not expect to have higher hundreds of the records in the db and I am mainly interested in the begining of the process so here chosen values provide enough info. &lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
:Because I originally intended to have Records quality kept in range from 1-10 I picked the lognormal distribution with parameters that would result in relatively low to mid quality of records created. Thats reflect better the reality because records can not have high quality without feedback from kids after at least few tries of given activity, which can not be accumulated earlier than after some time, so new records should not have higher initialQuality.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
: This value was was chosen in hope that leaders will tend to return the favor after using the found record. Also its easier than creating new record, but of course it can not be in all cases so 0.7 seems appropriet.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
: According to logic applied in qualityImprovementProb here I assume that because the agent didnt found a useful record, he wont be that much interested in investing his time to write down the activity so it could be recorded. And much less when realizing how much pain is to create a quality and useful record.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
: Originaly I intended to have categories explicitly named for closer resemblance with reality but I failed to find a real contribution for the simulation, because real live categories are much more comple so this simplified idea is not much realistic to begin with therefore i came to conclusion that using just simple intagers to represent the categories will be better choice for this case.&lt;br /&gt;
The original idea was something like this. &lt;br /&gt;
 const TYPES = [&amp;quot;running&amp;quot;, &amp;quot;creative&amp;quot;, &amp;quot;thinking&amp;quot;, &amp;quot;discussion&amp;quot;, &amp;quot;history&amp;quot;]  # Types of activities&lt;br /&gt;
 const PLACES = [&amp;quot;room&amp;quot;, &amp;quot;forest&amp;quot;, &amp;quot;city&amp;quot;, &amp;quot;playground&amp;quot;]  # Possible places for activities&lt;br /&gt;
 const CATEGORIES = [(t, p) for t in TYPES for p in PLACES]  # Generate all combinations of types and places&lt;br /&gt;
:Using intager instead makes for example much easier change the number of categories, which could be interesting to see how its change influences the observed values.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next three variables limits how long will the simulation run, respectively how long needs the system to be usefull without &amp;quot;fail&amp;quot;.&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
Such a long time period was chosen based on my requirements, but in the end this choice proved somewhat contraproductive for getting a good results.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
&lt;br /&gt;
*Simplified Categories: The categories used in the model are represented by integers and lack any explicit meaning. It was intended to use a combination of string as category representation, but the complexity has no effect on the results, therefore integer representation is used to make code simpler.&lt;br /&gt;
*Agent Uniformity: Each agent has an identical recordCreationProb which is not realistic, and does not model different level of contributing to the db.&lt;br /&gt;
*Fixed Parameters: Many model parameters, such as qualityImprovementProb, recordCreationProb, NUM_AGENTS are fixed values and don't change during simulation, which makes the simulation a bit static.&lt;br /&gt;
*Single Activity Per Week: Each agent prepares only one activity per week, which may be an oversimplification of real user behavior.&lt;br /&gt;
*Limited Complexity: The simulation lacks a deeper understanding of how records relate to each other or have a more diverse properties than just an &amp;quot;quality&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
&lt;br /&gt;
Also in the github repository with code, there are plots showing how the successrate evolves in time.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately the implementation can not ends earlier then after at least small fixed timeframe.&lt;br /&gt;
Its obvious that the results are heavily influenced by the randomness in the model.&lt;br /&gt;
&lt;br /&gt;
It seems that the first small batch upload has the largest influence on the resulting values and larger batches brings only relatively smaller improvements, that suggests to use the batch upload in real life, but its redundant to focus on optimizing the upload process for larger amounts, because they are not needed and only small amount of records (10) is enough to significantly boost the speed of populating.&lt;br /&gt;
&lt;br /&gt;
Also the amounts of records additionally created after 50 batch upload seems a bit unexpected, because after results seen in smaller batches one would expect a number around 15 or smaller. If it is not another bug in my code, I would guess that its bacause of small sample of results. batch50[22, 27, 19, 22, 70], batch30[39, 25, 14, 24, 26] are the results obtained by additional runs, its still strange how much records is created in case of 50 batch, but also the cause of small sample is still viable explanation.&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
:weeks: [55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
:records: [32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: [35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
:records: [35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: [21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
:records: [13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: [33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
:records: [58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
Well, those are here just for fun because there is not much value in such results except for showing something does not work as expected.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
In this simulation I managed to create heavily simplified model of database populating process in our boy scouts group.&lt;br /&gt;
&lt;br /&gt;
Therefore the resuls appears to be approximately as they should, but they lack on the reliability if they should be used as a base for a decision.&lt;br /&gt;
At most I can take a hint about the amount of records to batch upload. That relatively small amount makes a major difference.&lt;br /&gt;
&lt;br /&gt;
To further improve the model there should be implemented:&lt;br /&gt;
*Chance for agents to &amp;quot;not like the record&amp;quot;, that would sometimes stoped the agent from picking a record to use. It could try picking another if there would be more, if not the search would fail. This would be a small improvment to a model realisticity.&lt;br /&gt;
*Enhance the feature of records quality so it could not be increased infinitely. &lt;br /&gt;
*Add monitoring for values of records quality, so I can see better what is the state of the db like.&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
This is my code on github, because I could not upload .jl file and a did not wanted to make zip: [https://raw.githubusercontent.com/simik394/simulace-populatingskautdb/refs/heads/main/simulace-nobatch.jl]&lt;br /&gt;
&lt;br /&gt;
And the home repo [https://github.com/simik394/simulace-populatingskautdb]&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26618</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26618"/>
		<updated>2025-01-26T22:34:51Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Single run */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
The simulation is implemented in Julia using the Distributions, StatsBase, and Logging packages.&lt;br /&gt;
Logging is enabled to output data about records, agents and overall progress of simulation to a log file called simulation.log.&lt;br /&gt;
&lt;br /&gt;
Plots are used for visualization and stored as *.png files.&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
: It is because in our group we have three active leaders for the regular meating.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10, 30, 50].&lt;br /&gt;
: I do not expect to have higher hundreds of the records in the db and I am mainly interested in the begining of the process so here chosen values provide enough info. &lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
:Because I originally intended to have Records quality kept in range from 1-10 I picked the lognormal distribution with parameters that would result in relatively low to mid quality of records created. Thats reflect better the reality because records can not have high quality without feedback from kids after at least few tries of given activity, which can not be accumulated earlier than after some time, so new records should not have higher initialQuality.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
: This value was was chosen in hope that leaders will tend to return the favor after using the found record. Also its easier than creating new record, but of course it can not be in all cases so 0.7 seems appropriet.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
: According to logic applied in qualityImprovementProb here I assume that because the agent didnt found a useful record, he wont be that much interested in investing his time to write down the activity so it could be recorded. And much less when realizing how much pain is to create a quality and useful record.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
: Originaly I intended to have categories explicitly named for closer resemblance with reality but I failed to find a real contribution for the simulation, because real live categories are much more comple so this simplified idea is not much realistic to begin with therefore i came to conclusion that using just simple intagers to represent the categories will be better choice for this case.&lt;br /&gt;
The original idea was something like this. &lt;br /&gt;
 const TYPES = [&amp;quot;running&amp;quot;, &amp;quot;creative&amp;quot;, &amp;quot;thinking&amp;quot;, &amp;quot;discussion&amp;quot;, &amp;quot;history&amp;quot;]  # Types of activities&lt;br /&gt;
 const PLACES = [&amp;quot;room&amp;quot;, &amp;quot;forest&amp;quot;, &amp;quot;city&amp;quot;, &amp;quot;playground&amp;quot;]  # Possible places for activities&lt;br /&gt;
 const CATEGORIES = [(t, p) for t in TYPES for p in PLACES]  # Generate all combinations of types and places&lt;br /&gt;
:Using intager instead makes for example much easier change the number of categories, which could be interesting to see how its change influences the observed values.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next three variables limits how long will the simulation run, respectively how long needs the system to be usefull without &amp;quot;fail&amp;quot;.&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
Such a long time period was chosen based on my requirements, but in the end this choice proved somewhat contraproductive for getting a good results.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
&lt;br /&gt;
*Simplified Categories: The categories used in the model are represented by integers and lack any explicit meaning. It was intended to use a combination of string as category representation, but the complexity has no effect on the results, therefore integer representation is used to make code simpler.&lt;br /&gt;
*Agent Uniformity: Each agent has an identical recordCreationProb which is not realistic, and does not model different level of contributing to the db.&lt;br /&gt;
*Fixed Parameters: Many model parameters, such as qualityImprovementProb, recordCreationProb, NUM_AGENTS are fixed values and don't change during simulation, which makes the simulation a bit static.&lt;br /&gt;
*Single Activity Per Week: Each agent prepares only one activity per week, which may be an oversimplification of real user behavior.&lt;br /&gt;
*Limited Complexity: The simulation lacks a deeper understanding of how records relate to each other or have a more diverse properties than just an &amp;quot;quality&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
&lt;br /&gt;
Also in the github repository with code, there are plots showing how the successrate evolves in time.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately the implementation can not ends earlier then after at least small fixed timeframe.&lt;br /&gt;
Its obvious that the results are heavily influenced by the randomness in the model.&lt;br /&gt;
&lt;br /&gt;
It seems that the first small batch upload has the largest influence on the resulting values and larger batches brings only relatively smaller improvements, that suggests to use the batch upload in real life, but its redundant to focus on optimizing the upload process for larger amounts, because they are not needed and only small amount of records (10) is enough to significantly boost the speed of populating.&lt;br /&gt;
&lt;br /&gt;
Also the amounts of records additionally created after 50 batch upload seems a bit unexpected, because after results seen in smaller batches one would expect a number around 15 or smaller. If it is not another bug in my code, I would guess that its bacause of small sample of results.&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
:weeks: [55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
:records: [32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: [35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
:records: [35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: [21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
:records: [13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: [33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
:records: [58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
Well, those are here just for fun because there is not much value in such results except for showing something does not work as expected.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
In this simulation I managed to create heavily simplified model of database populating process in our boy scouts group.&lt;br /&gt;
&lt;br /&gt;
Therefore the resuls appears to be approximately as they should, but they lack on the reliability if they should be used as a base for a decision.&lt;br /&gt;
At most I can take a hint about the amount of records to batch upload. That relatively small amount makes a major difference.&lt;br /&gt;
&lt;br /&gt;
To further improve the model there should be implemented:&lt;br /&gt;
*Chance for agents to &amp;quot;not like the record&amp;quot;, that would sometimes stoped the agent from picking a record to use. It could try picking another if there would be more, if not the search would fail. This would be a small improvment to a model realisticity.&lt;br /&gt;
*Enhance the feature of records quality so it could not be increased infinitely. &lt;br /&gt;
*Add monitoring for values of records quality, so I can see better what is the state of the db like.&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
This is my code on github, because I could not upload .jl file and a did not wanted to make zip: [https://raw.githubusercontent.com/simik394/simulace-populatingskautdb/refs/heads/main/simulace-nobatch.jl]&lt;br /&gt;
&lt;br /&gt;
And the home repo [https://github.com/simik394/simulace-populatingskautdb]&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26616</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26616"/>
		<updated>2025-01-26T22:16:20Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
The simulation is implemented in Julia using the Distributions, StatsBase, and Logging packages.&lt;br /&gt;
Logging is enabled to output data about records, agents and overall progress of simulation to a log file called simulation.log.&lt;br /&gt;
&lt;br /&gt;
Plots are used for visualization and stored as *.png files.&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
: It is because in our group we have three active leaders for the regular meating.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10, 30, 50].&lt;br /&gt;
: I do not expect to have higher hundreds of the records in the db and I am mainly interested in the begining of the process so here chosen values provide enough info. &lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
:Because I originally intended to have Records quality kept in range from 1-10 I picked the lognormal distribution with parameters that would result in relatively low to mid quality of records created. Thats reflect better the reality because records can not have high quality without feedback from kids after at least few tries of given activity, which can not be accumulated earlier than after some time, so new records should not have higher initialQuality.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
: This value was was chosen in hope that leaders will tend to return the favor after using the found record. Also its easier than creating new record, but of course it can not be in all cases so 0.7 seems appropriet.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
: According to logic applied in qualityImprovementProb here I assume that because the agent didnt found a useful record, he wont be that much interested in investing his time to write down the activity so it could be recorded. And much less when realizing how much pain is to create a quality and useful record.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
: Originaly I intended to have categories explicitly named for closer resemblance with reality but I failed to find a real contribution for the simulation, because real live categories are much more comple so this simplified idea is not much realistic to begin with therefore i came to conclusion that using just simple intagers to represent the categories will be better choice for this case.&lt;br /&gt;
The original idea was something like this. &lt;br /&gt;
 const TYPES = [&amp;quot;running&amp;quot;, &amp;quot;creative&amp;quot;, &amp;quot;thinking&amp;quot;, &amp;quot;discussion&amp;quot;, &amp;quot;history&amp;quot;]  # Types of activities&lt;br /&gt;
 const PLACES = [&amp;quot;room&amp;quot;, &amp;quot;forest&amp;quot;, &amp;quot;city&amp;quot;, &amp;quot;playground&amp;quot;]  # Possible places for activities&lt;br /&gt;
 const CATEGORIES = [(t, p) for t in TYPES for p in PLACES]  # Generate all combinations of types and places&lt;br /&gt;
:Using intager instead makes for example much easier change the number of categories, which could be interesting to see how its change influences the observed values.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Next three variables limits how long will the simulation run, respectively how long needs the system to be usefull without &amp;quot;fail&amp;quot;.&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
Such a long time period was chosen based on my requirements, but in the end this choice proved somewhat contraproductive for getting a good results.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
&lt;br /&gt;
*Simplified Categories: The categories used in the model are represented by integers and lack any explicit meaning. It was intended to use a combination of string as category representation, but the complexity has no effect on the results, therefore integer representation is used to make code simpler.&lt;br /&gt;
*Agent Uniformity: Each agent has an identical recordCreationProb which is not realistic, and does not model different level of contributing to the db.&lt;br /&gt;
*Fixed Parameters: Many model parameters, such as qualityImprovementProb, recordCreationProb, NUM_AGENTS are fixed values and don't change during simulation, which makes the simulation a bit static.&lt;br /&gt;
*Single Activity Per Week: Each agent prepares only one activity per week, which may be an oversimplification of real user behavior.&lt;br /&gt;
*Limited Complexity: The simulation lacks a deeper understanding of how records relate to each other or have a more diverse properties than just an &amp;quot;quality&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
&lt;br /&gt;
Also in the github repository with code, there are plots showing how the successrate evolves in time.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately the implementation can not ends earlier then after at least small fixed timeframe.&lt;br /&gt;
Its obvious that the results are heavily influenced by the randomness in the model.&lt;br /&gt;
&lt;br /&gt;
It seems that the first small batch upload has the largest influence on the resulting values and larger batches brings only relatively smaller improvements, that suggests to use the batch upload in real life, but its redundant to focus on optimizing the upload process for larger amounts, because they are not needed and only small amount of records (10) is enough to significantly boost the speed of populating.&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
:weeks: [55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
:records: [32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: [35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
:records: [35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: [21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
:records: [13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: [33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
:records: [58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
Well, those are here just for fun because there is not much value in such results except for showing something does not work as expected.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
In this simulation I managed to create heavily simplified model of database populating process in our boy scouts group.&lt;br /&gt;
&lt;br /&gt;
Therefore the resuls appears to be approximately as they should, but they lack on the reliability if they should be used as a base for a decision.&lt;br /&gt;
At most I can take a hint about the amount of records to batch upload. That relatively small amount makes a major difference.&lt;br /&gt;
&lt;br /&gt;
To further improve the model there should be implemented:&lt;br /&gt;
*Chance for agents to &amp;quot;not like the record&amp;quot;, that would sometimes stoped the agent from picking a record to use. It could try picking another if there would be more, if not the search would fail. This would be a small improvment to a model realisticity.&lt;br /&gt;
*Enhance the feature of records quality so it could not be increased infinitely. &lt;br /&gt;
*Add monitoring for values of records quality, so I can see better what is the state of the db like.&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
This is my code on github, because I could not upload .jl file and a did not wanted to make zip: [https://raw.githubusercontent.com/simik394/simulace-populatingskautdb/refs/heads/main/simulace-nobatch.jl]&lt;br /&gt;
&lt;br /&gt;
And the home repo [https://github.com/simik394/simulace-populatingskautdb]&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26550</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26550"/>
		<updated>2025-01-20T00:00:37Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Discussion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
The simulation is implemented in Julia using the Distributions, StatsBase, and Logging packages.&lt;br /&gt;
Logging is enabled to output data about records, agents and overall progress of simulation to a log file called simulation.log.&lt;br /&gt;
&lt;br /&gt;
Plots are used for visualization and stored as *.png files.&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
&lt;br /&gt;
*Simplified Categories: The categories used in the model are represented by integers and lack any explicit meaning. It was intended to use a combination of string as category representation, but the complexity has no effect on the results, therefore integer representation is used to make code simpler.&lt;br /&gt;
*Agent Uniformity: Each agent has an identical recordCreationProb which is not realistic, and does not model different level of contributing to the db.&lt;br /&gt;
*Fixed Parameters: Many model parameters, such as qualityImprovementProb, recordCreationProb, NUM_AGENTS are fixed values and don't change during simulation, which makes the simulation a bit static.&lt;br /&gt;
*Single Activity Per Week: Each agent prepares only one activity per week, which may be an oversimplification of real user behavior.&lt;br /&gt;
*Limited Complexity: The simulation lacks a deeper understanding of how records relate to each other or have a more diverse properties than just an &amp;quot;quality&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
&lt;br /&gt;
Also in the github repository with code, there are plots showing how the successrate evolves in time.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately the implementation can not ends earlier then after at least small fixed timeframe.&lt;br /&gt;
Its obvious that the results are heavily influenced by the randomness in the model.&lt;br /&gt;
&lt;br /&gt;
It seems that the first small batch upload has the largest influence on the resulting values and larger batches brings only relatively smaller improvements, that suggests to use the batch upload in real life, but its redundant to focus on optimizing the upload process for larger amounts, because they are not needed and only small amount of records (10) is enough to significantly boost the speed of populating.&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
:weeks: [55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
:records: [32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: [35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
:records: [35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: [21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
:records: [13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: [33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
:records: [58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
Well, those are here just for fun because there is not much value in such results except for showing something does not work as expected.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
In this simulation I managed to create heavily simplified model of database populating process in our boy scouts group.&lt;br /&gt;
&lt;br /&gt;
Therefore the resuls appears to be approximately as they should, but they lack on the reliability if they should be used as a base for a decision.&lt;br /&gt;
At most I can take a hint about the amount of records to batch upload. That relatively small amount makes a major difference.&lt;br /&gt;
&lt;br /&gt;
To further improve the model there should be implemented:&lt;br /&gt;
*Chance for agents to &amp;quot;not like the record&amp;quot;, that would sometimes stoped the agent from picking a record to use. It could try picking another if there would be more, if not the search would fail. This would be a small improvment to a model realisticity.&lt;br /&gt;
*Enhance the feature of records quality so it could not be increased infinitely. &lt;br /&gt;
*Add monitoring for values of records quality, so I can see better what is the state of the db like.&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
This is my code on github, because I could not upload .jl file and a did not wanted to make zip: [https://raw.githubusercontent.com/simik394/simulace-populatingskautdb/refs/heads/main/simulace-nobatch.jl]&lt;br /&gt;
&lt;br /&gt;
And the home repo [https://github.com/simik394/simulace-populatingskautdb]&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26549</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26549"/>
		<updated>2025-01-19T23:49:52Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Discussion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
The simulation is implemented in Julia using the Distributions, StatsBase, and Logging packages.&lt;br /&gt;
Logging is enabled to output data about records, agents and overall progress of simulation to a log file called simulation.log.&lt;br /&gt;
&lt;br /&gt;
Plots are used for visualization and stored as *.png files.&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
&lt;br /&gt;
*Simplified Categories: The categories used in the model are represented by integers and lack any explicit meaning. It was intended to use a combination of string as category representation, but the complexity has no effect on the results, therefore integer representation is used to make code simpler.&lt;br /&gt;
*Agent Uniformity: Each agent has an identical recordCreationProb which is not realistic, and does not model different level of contributing to the db.&lt;br /&gt;
*Fixed Parameters: Many model parameters, such as qualityImprovementProb, recordCreationProb, NUM_AGENTS are fixed values and don't change during simulation, which makes the simulation a bit static.&lt;br /&gt;
*Single Activity Per Week: Each agent prepares only one activity per week, which may be an oversimplification of real user behavior.&lt;br /&gt;
*Limited Complexity: The simulation lacks a deeper understanding of how records relate to each other or have a more diverse properties than just an &amp;quot;quality&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
&lt;br /&gt;
Also in the github repository with code, there are plots showing how the successrate evolves in time.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately the implementation can not ends earlier then after at least small fixed timeframe.&lt;br /&gt;
Its obvious that the results are heavily influenced by the randomness in the model.&lt;br /&gt;
&lt;br /&gt;
It seems that the first small batch upload has the largest influence on the resulting values and larger batches brings only relatively smaller improvements, that suggests to use the batch upload in real life, but its redundant to focus on optimizing the upload process for larger amounts, because they are not needed and only small amount of records (10) is enough to significantly boost the speed of populating.&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
:weeks: [55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
:records: [32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: [35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
:records: [35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: [21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
:records: [13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: [33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
:records: [58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
Well, those are here just for fun because there is not much value in such results except for showing something does not work as expected.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
In this simulation I managed to create heavily simplified model of database populating process in our boy scouts group.&lt;br /&gt;
&lt;br /&gt;
Therefore the resuls appears to be approximately as they should, but they lack on the reliability if they should be used as a base for a decision.&lt;br /&gt;
At most I can take a hint about the amount of records to batch upload. That relatively small amount makes a major difference.&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
This is my code on github, because I could not upload .jl file and a did not wanted to make zip: [https://raw.githubusercontent.com/simik394/simulace-populatingskautdb/refs/heads/main/simulace-nobatch.jl]&lt;br /&gt;
&lt;br /&gt;
And the home repo [https://github.com/simik394/simulace-populatingskautdb]&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26548</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26548"/>
		<updated>2025-01-19T23:47:29Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Single run */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
The simulation is implemented in Julia using the Distributions, StatsBase, and Logging packages.&lt;br /&gt;
Logging is enabled to output data about records, agents and overall progress of simulation to a log file called simulation.log.&lt;br /&gt;
&lt;br /&gt;
Plots are used for visualization and stored as *.png files.&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
&lt;br /&gt;
*Simplified Categories: The categories used in the model are represented by integers and lack any explicit meaning. It was intended to use a combination of string as category representation, but the complexity has no effect on the results, therefore integer representation is used to make code simpler.&lt;br /&gt;
*Agent Uniformity: Each agent has an identical recordCreationProb which is not realistic, and does not model different level of contributing to the db.&lt;br /&gt;
*Fixed Parameters: Many model parameters, such as qualityImprovementProb, recordCreationProb, NUM_AGENTS are fixed values and don't change during simulation, which makes the simulation a bit static.&lt;br /&gt;
*Single Activity Per Week: Each agent prepares only one activity per week, which may be an oversimplification of real user behavior.&lt;br /&gt;
*Limited Complexity: The simulation lacks a deeper understanding of how records relate to each other or have a more diverse properties than just an &amp;quot;quality&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
&lt;br /&gt;
Also in the github repository with code, there are plots showing how the successrate evolves in time.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately the implementation can not ends earlier then after at least small fixed timeframe.&lt;br /&gt;
Its obvious that the results are heavily influenced by the randomness in the model.&lt;br /&gt;
&lt;br /&gt;
It seems that the first small batch upload has the largest influence on the resulting values and larger batches brings only relatively smaller improvements, that suggests to use the batch upload in real life, but its redundant to focus on optimizing the upload process for larger amounts, because they are not needed and only small amount of records (10) is enough to significantly boost the speed of populating.&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
:weeks: [55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
:records: [32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: [35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
:records: [35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: [21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
:records: [13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: [33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
:records: [58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
Well, those are here just for fun because there is not much value in such results except for showing something does not work as expected.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
In this simulation I managed to create heavily simplified model of database populating process in our boy scouts group.&lt;br /&gt;
&lt;br /&gt;
Therefore the resuls appears to be approximately as they should, but they lack on the reliability if they should be used as a base for a decision.&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
This is my code on github, because I could not upload .jl file and a did not wanted to make zip: [https://raw.githubusercontent.com/simik394/simulace-populatingskautdb/refs/heads/main/simulace-nobatch.jl]&lt;br /&gt;
&lt;br /&gt;
And the home repo [https://github.com/simik394/simulace-populatingskautdb]&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26547</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26547"/>
		<updated>2025-01-19T23:40:09Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Julia */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
The simulation is implemented in Julia using the Distributions, StatsBase, and Logging packages.&lt;br /&gt;
Logging is enabled to output data about records, agents and overall progress of simulation to a log file called simulation.log.&lt;br /&gt;
&lt;br /&gt;
Plots are used for visualization and stored as *.png files.&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
&lt;br /&gt;
*Simplified Categories: The categories used in the model are represented by integers and lack any explicit meaning. It was intended to use a combination of string as category representation, but the complexity has no effect on the results, therefore integer representation is used to make code simpler.&lt;br /&gt;
*Agent Uniformity: Each agent has an identical recordCreationProb which is not realistic, and does not model different level of contributing to the db.&lt;br /&gt;
*Fixed Parameters: Many model parameters, such as qualityImprovementProb, recordCreationProb, NUM_AGENTS are fixed values and don't change during simulation, which makes the simulation a bit static.&lt;br /&gt;
*Single Activity Per Week: Each agent prepares only one activity per week, which may be an oversimplification of real user behavior.&lt;br /&gt;
*Limited Complexity: The simulation lacks a deeper understanding of how records relate to each other or have a more diverse properties than just an &amp;quot;quality&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
&lt;br /&gt;
Also in the github repository with code, there are plots showing how the successrate evolves in time.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately the implementation can not ends earlier then after at least small fixed timeframe.&lt;br /&gt;
Its obvious that the results are heavily influenced by the randomness in the model.&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
:weeks: [55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
:records: [32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: [35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
:records: [35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: [21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
:records: [13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: [33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
:records: [58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
Well, those are here just for fun because there is not much value in such results except for showing something does not work as expected.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
In this simulation I managed to create heavily simplified model of database populating process in our boy scouts group.&lt;br /&gt;
&lt;br /&gt;
Therefore the resuls appears to be approximately as they should, but they lack on the reliability if they should be used as a base for a decision.&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
This is my code on github, because I could not upload .jl file and a did not wanted to make zip: [https://raw.githubusercontent.com/simik394/simulace-populatingskautdb/refs/heads/main/simulace-nobatch.jl]&lt;br /&gt;
&lt;br /&gt;
And the home repo [https://github.com/simik394/simulace-populatingskautdb]&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26546</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26546"/>
		<updated>2025-01-19T23:38:12Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Model */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
==Limitations==&lt;br /&gt;
&lt;br /&gt;
*Simplified Categories: The categories used in the model are represented by integers and lack any explicit meaning. It was intended to use a combination of string as category representation, but the complexity has no effect on the results, therefore integer representation is used to make code simpler.&lt;br /&gt;
*Agent Uniformity: Each agent has an identical recordCreationProb which is not realistic, and does not model different level of contributing to the db.&lt;br /&gt;
*Fixed Parameters: Many model parameters, such as qualityImprovementProb, recordCreationProb, NUM_AGENTS are fixed values and don't change during simulation, which makes the simulation a bit static.&lt;br /&gt;
*Single Activity Per Week: Each agent prepares only one activity per week, which may be an oversimplification of real user behavior.&lt;br /&gt;
*Limited Complexity: The simulation lacks a deeper understanding of how records relate to each other or have a more diverse properties than just an &amp;quot;quality&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
&lt;br /&gt;
Also in the github repository with code, there are plots showing how the successrate evolves in time.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately the implementation can not ends earlier then after at least small fixed timeframe.&lt;br /&gt;
Its obvious that the results are heavily influenced by the randomness in the model.&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
:weeks: [55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
:records: [32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: [35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
:records: [35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: [21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
:records: [13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: [33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
:records: [58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
Well, those are here just for fun because there is not much value in such results except for showing something does not work as expected.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
In this simulation I managed to create heavily simplified model of database populating process in our boy scouts group.&lt;br /&gt;
&lt;br /&gt;
Therefore the resuls appears to be approximately as they should, but they lack on the reliability if they should be used as a base for a decision.&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
This is my code on github, because I could not upload .jl file and a did not wanted to make zip: [https://raw.githubusercontent.com/simik394/simulace-populatingskautdb/refs/heads/main/simulace-nobatch.jl]&lt;br /&gt;
&lt;br /&gt;
And the home repo [https://github.com/simik394/simulace-populatingskautdb]&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26545</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26545"/>
		<updated>2025-01-19T23:34:37Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Discussion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
&lt;br /&gt;
Also in the github repository with code, there are plots showing how the successrate evolves in time.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately the implementation can not ends earlier then after at least small fixed timeframe.&lt;br /&gt;
Its obvious that the results are heavily influenced by the randomness in the model.&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
:weeks: [55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
:records: [32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: [35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
:records: [35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: [21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
:records: [13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: [33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
:records: [58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
Well, those are here just for fun because there is not much value in such results except for showing something does not work as expected.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
In this simulation I managed to create heavily simplified model of database populating process in our boy scouts group.&lt;br /&gt;
&lt;br /&gt;
Therefore the resuls appears to be approximately as they should, but they lack on the reliability if they should be used as a base for a decision.&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
This is my code on github, because I could not upload .jl file and a did not wanted to make zip: [https://raw.githubusercontent.com/simik394/simulace-populatingskautdb/refs/heads/main/simulace-nobatch.jl]&lt;br /&gt;
&lt;br /&gt;
And the home repo [https://github.com/simik394/simulace-populatingskautdb]&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26544</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26544"/>
		<updated>2025-01-19T23:34:26Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Discussion */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
&lt;br /&gt;
Also in the github repository with code, there are plots showing how the successrate evolves in time.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately the implementation can not ends earlier then after at least small fixed timeframe.&lt;br /&gt;
Its obvious that the results are heavily influenced by the randomness in the model.&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
:weeks: [55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
:records: [32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: [35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
:records: [35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: [21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
:records: [13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: [33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
:records: [58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
Well, those are here just for fun because there is not much value in such results except for showing something does not work as expected.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
In this simulation I managed to create heavily simplified model of database populating process in our boy scouts group.&lt;br /&gt;
Therefore the resuls appears to be approximately as they should, but they lack on the reliability if they should be used as a base for a decision.&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
This is my code on github, because I could not upload .jl file and a did not wanted to make zip: [https://raw.githubusercontent.com/simik394/simulace-populatingskautdb/refs/heads/main/simulace-nobatch.jl]&lt;br /&gt;
&lt;br /&gt;
And the home repo [https://github.com/simik394/simulace-populatingskautdb]&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26543</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26543"/>
		<updated>2025-01-19T23:27:15Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
&lt;br /&gt;
Also in the github repository with code, there are plots showing how the successrate evolves in time.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately the implementation can not ends earlier then after at least small fixed timeframe.&lt;br /&gt;
Its obvious that the results are heavily influenced by the randomness in the model.&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
:weeks: [55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
:records: [32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: [35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
:records: [35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: [21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
:records: [13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: [33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
:records: [58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
Well, those are here just for fun because there is not much value in such results except for showing something does not work as expected.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
This is my code on github, because I could not upload .jl file and a did not wanted to make zip: [https://raw.githubusercontent.com/simik394/simulace-populatingskautdb/refs/heads/main/simulace-nobatch.jl]&lt;br /&gt;
&lt;br /&gt;
And the home repo [https://github.com/simik394/simulace-populatingskautdb]&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26542</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26542"/>
		<updated>2025-01-19T23:18:27Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately the implementation can not ends earlier then after at least small fixed timeframe.&lt;br /&gt;
Its obvious that the results are heavily influenced by the randomness in the model.&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
:weeks: [55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
:records: [32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: [35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
:records: [35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: [21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
:records: [13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: [33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
:records: [58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
Well, those are here just for fun because there is not much value in such results except for showing something does not work as expected.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
This is my code on github, because I could not upload .jl file and a did not wanted to make zip: [https://raw.githubusercontent.com/simik394/simulace-populatingskautdb/refs/heads/main/simulace-nobatch.jl]&lt;br /&gt;
&lt;br /&gt;
And the home repo [https://github.com/simik394/simulace-populatingskautdb]&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26541</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26541"/>
		<updated>2025-01-19T23:09:01Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Multi run */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately the implementation can not ends earlier then after at least small fixed timeframe.&lt;br /&gt;
Its obvious that the results are heavily influenced by the randomness in the model.&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
:weeks: [55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
:records: [32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: [35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
:records: [35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: [21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
:records: [13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: [33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
:records: [58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
Well, those are here just for fun because there is not much value in such results except for showing something does not work as expected.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
This is my code on github, because I could not upload .jl file and a did not wanted to make zip: [https://raw.githubusercontent.com/simik394/simulace-populatingskautdb/refs/heads/main/simulace-nobatch.jl]&lt;br /&gt;
&lt;br /&gt;
And the home repo [https://github.com/simik394/simulace-populatingskautdb]&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26540</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26540"/>
		<updated>2025-01-19T23:08:06Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately the implementation can not ends earlier then after at least small fixed timeframe.&lt;br /&gt;
Its obvious that the results are heavily influenced by the randomness in the model.&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
:weeks: [55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
:records: [32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: [35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
:records: [35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: [21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
:records: [13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: [33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
:records: [58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
Well, those are here just for fun because there is not much value in such results except for showing something does not work as expected.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
This is my code on github, because I could not upload .jl file and a did not wanted to make zip: [https://raw.githubusercontent.com/simik394/simulace-populatingskautdb/refs/heads/main/simulace-nobatch.jl]&lt;br /&gt;
&lt;br /&gt;
And the home repo [https://github.com/simik394/simulace-populatingskautdb]&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26539</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26539"/>
		<updated>2025-01-19T22:57:47Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately the implementation can not ends earlier then after at least small fixed timeframe.&lt;br /&gt;
Its obvious that the results are heavily influenced by the randomness in the model.&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
:weeks: [55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
:records: [32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: [35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
:records: [35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: [21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
:records: [13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: [33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
:records: [58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
Well, those are here just for fun because there is not much value in such results except for showing something does not work as expected.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26538</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26538"/>
		<updated>2025-01-19T22:51:44Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Single run */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
[55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
[32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
[35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
[35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
[21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
[13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
[33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
[58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26537</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26537"/>
		<updated>2025-01-19T22:51:32Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
&lt;br /&gt;
Also the counter of created records does not count the records created via batch upload so when reading it needs to be kept in mind.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51, 69&lt;br /&gt;
:records created in db: 44, 40, 55&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
:weeks: 21, 33, 21&lt;br /&gt;
:records: 21, 26, 19 &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
:weeks: 24, 21, 22&lt;br /&gt;
:records: 26, 17, 18&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
:weeks: 21, 21, 21&lt;br /&gt;
:records: 30, 18, 27&lt;br /&gt;
&lt;br /&gt;
It appears that the batch upload in the beginning realy speeds up the time required for the database to be considered usefull, but unfortunately&lt;br /&gt;
==Multi run==&lt;br /&gt;
;batch 0&lt;br /&gt;
[55, 72, 70, 78, 94, 114, 126, 120, 135, 140, 152, 156, 180, 161, 167]&lt;br /&gt;
[32, 129, 108, 195, 262, 316, 320, 308, 366, 373, 432, 442, 496, 486, 487]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
[35, 99, 99, 189, 249, 291, 298, 413, 413, 426, 452, 433, 471, 520, 564]&lt;br /&gt;
[35, 48, 43, 90, 93, 112, 116, 148, 133, 141, 143, 155, 163, 158, 188]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
[21, 67, 79, 105, 99, 97, 115, 132, 137, 149, 160, 158, 170, 178, 181]&lt;br /&gt;
[13, 170, 200, 227, 272, 254, 336, 316, 406, 423, 442, 415, 464, 496, 521]&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
[33, 21, 82, 83, 91, 113, 123, 149, 145, 144, 152, 166, 164, 175, 192]&lt;br /&gt;
[58, 42, 187, 247, 271, 306, 331, 365, 397, 413, 468, 502, 495, 507, 540]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26536</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26536"/>
		<updated>2025-01-19T22:40:44Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82, 51,&lt;br /&gt;
:records created in db: 44, 40, &lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
weeks: 21, 33, &lt;br /&gt;
records: 21, 26,  &lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
weeks: 24, 21, &lt;br /&gt;
records: 26, 17, &lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
weeks: 21, 21, &lt;br /&gt;
records: 30, 18, &lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
===batch 0===&lt;br /&gt;
&lt;br /&gt;
===batch 10===&lt;br /&gt;
&lt;br /&gt;
===batch 30===&lt;br /&gt;
&lt;br /&gt;
===batch 50===&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26535</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26535"/>
		<updated>2025-01-19T22:36:44Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
&lt;br /&gt;
Also there is a bug/feature with my function which determines when the search process is successfull enough. Because i require certain amount of time to assess the stability of said successfullness, there is a minimal but fixed timeframe in the begining of the simulation. And because of this when the number of weeks required for the system to be recognized as usefull is measured, its value can not begin earlier than after said timeframe, so that is why the smallest number of weeks in the results are 21.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82,&lt;br /&gt;
:records created in db: 44,&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
weeks: 21&lt;br /&gt;
records: 21&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
weeks:&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
===batch 0===&lt;br /&gt;
&lt;br /&gt;
===batch 10===&lt;br /&gt;
&lt;br /&gt;
===batch 30===&lt;br /&gt;
&lt;br /&gt;
===batch 50===&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26534</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26534"/>
		<updated>2025-01-19T22:30:51Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Single run */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
&lt;br /&gt;
But it was run manually three times.&lt;br /&gt;
;batch 0 &lt;br /&gt;
:weeks until &amp;quot;usefullness&amp;quot;: 82,&lt;br /&gt;
:records created in db: 44,&lt;br /&gt;
&lt;br /&gt;
;batch 10&lt;br /&gt;
weeks: 21&lt;br /&gt;
records: 21&lt;br /&gt;
&lt;br /&gt;
;batch 30&lt;br /&gt;
weeks:&lt;br /&gt;
&lt;br /&gt;
;batch 50&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
===batch 0===&lt;br /&gt;
&lt;br /&gt;
===batch 10===&lt;br /&gt;
&lt;br /&gt;
===batch 30===&lt;br /&gt;
&lt;br /&gt;
===batch 50===&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26533</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26533"/>
		<updated>2025-01-19T22:25:06Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Entities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. &lt;br /&gt;
&lt;br /&gt;
(Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
===batch 0===&lt;br /&gt;
&lt;br /&gt;
===batch 10===&lt;br /&gt;
&lt;br /&gt;
===batch 30===&lt;br /&gt;
&lt;br /&gt;
===batch 50===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
===batch 0===&lt;br /&gt;
&lt;br /&gt;
===batch 10===&lt;br /&gt;
&lt;br /&gt;
===batch 30===&lt;br /&gt;
&lt;br /&gt;
===batch 50===&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26532</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26532"/>
		<updated>2025-01-19T22:24:50Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Entities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record. (Originally it should more closely resamble the real live improvements by being represented by only range 1-10 as the real live records also can not be improved infinitelly, but in the end there was left simplier implemantation that just has a chance to improve the record during every picked to use event by random value withou top limit.)&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
===batch 0===&lt;br /&gt;
&lt;br /&gt;
===batch 10===&lt;br /&gt;
&lt;br /&gt;
===batch 30===&lt;br /&gt;
&lt;br /&gt;
===batch 50===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
===batch 0===&lt;br /&gt;
&lt;br /&gt;
===batch 10===&lt;br /&gt;
&lt;br /&gt;
===batch 30===&lt;br /&gt;
&lt;br /&gt;
===batch 50===&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26531</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26531"/>
		<updated>2025-01-19T22:20:12Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Results */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record.&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
In the last section of appended code there was realized an attempt to calculate the results simply by adding new function which whould call the main simulation given number of times and recorded the results so the variability caused by randomness could be viewed. Specifically how the required number of weeks and number of created records varied when running the simulation repeatedly.&lt;br /&gt;
&lt;br /&gt;
Unfortunately there has been some enexpected and probably undesired patterns occuring in the obtained &amp;quot;multi run&amp;quot; results. Most likely a skillissue on my side. Further elaboration follows.&lt;br /&gt;
==Single run==&lt;br /&gt;
This means runing the multi run function for single iteration.&lt;br /&gt;
===batch 0===&lt;br /&gt;
&lt;br /&gt;
===batch 10===&lt;br /&gt;
&lt;br /&gt;
===batch 30===&lt;br /&gt;
&lt;br /&gt;
===batch 50===&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
===batch 0===&lt;br /&gt;
&lt;br /&gt;
===batch 10===&lt;br /&gt;
&lt;br /&gt;
===batch 30===&lt;br /&gt;
&lt;br /&gt;
===batch 50===&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26530</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26530"/>
		<updated>2025-01-19T22:06:35Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record.&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
*If records are found, the agents samples without replacement a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen. (Weights are calculated like this [rec.quality / sum(r.quality for r in records) for rec in records])&lt;br /&gt;
*An agent tries to pick for use randomly one record from those records. &lt;br /&gt;
*Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
*If the record the agent tries to pick is on cooldown, the agent proceeds to trying another one from the sampled ones until it finds a cooled down one or until there are no more samples (usually in the beginning of the simulation when there are yot not created record in the db).&lt;br /&gt;
*If the record is used, there is a probability of the agent improving the quality of that used record.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
*If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
*If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
*Also there is kept record of total number oc record created so far during the simulation and the order number of each record is assigned to the record during its creation as its id. This way its possible to keep track of which records were used before by the given agent.&lt;br /&gt;
&lt;br /&gt;
'''3.Evaluation'''&lt;br /&gt;
*Further the simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
*At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
*The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
*A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
==Single run==&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26529</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26529"/>
		<updated>2025-01-19T21:40:49Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record.&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Then each agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
;Search Behavior:&lt;br /&gt;
&lt;br /&gt;
If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
&lt;br /&gt;
If records are found, the agents samples a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen.&lt;br /&gt;
&lt;br /&gt;
An agent tries to use (for it's activity preparation) randomly one record from those records. The probability of each record to be selected to be used is based on its quality.&lt;br /&gt;
&lt;br /&gt;
Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
&lt;br /&gt;
If the record is used, there is a probability of the agent improving the quality of that used record. If record isn't used it also improves a record (newly recorded), to indicate some minor change in activity record during preparation.&lt;br /&gt;
&lt;br /&gt;
;Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
&lt;br /&gt;
If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
&lt;br /&gt;
The simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
&lt;br /&gt;
'''3.Success Rate Calculation:'''&lt;br /&gt;
&lt;br /&gt;
At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
&lt;br /&gt;
'''4.Simulation Termination:'''&lt;br /&gt;
&lt;br /&gt;
The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
&lt;br /&gt;
A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
==Single run==&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26528</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26528"/>
		<updated>2025-01-19T21:38:10Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record.&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3 for the sake of simplicity and simulation feasibility.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Database Search Decision: An agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
Search Behavior:&lt;br /&gt;
&lt;br /&gt;
If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
&lt;br /&gt;
If records are found, the agents samples a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen.&lt;br /&gt;
&lt;br /&gt;
An agent tries to use (for it's activity preparation) randomly one record from those records. The probability of each record to be selected to be used is based on its quality.&lt;br /&gt;
&lt;br /&gt;
Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
&lt;br /&gt;
If the record is used, there is a probability of the agent improving the quality of that used record. If record isn't used it also improves a record (newly recorded), to indicate some minor change in activity record during preparation.&lt;br /&gt;
&lt;br /&gt;
Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
&lt;br /&gt;
If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
&lt;br /&gt;
The simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
&lt;br /&gt;
#Success Rate Calculation:&lt;br /&gt;
&lt;br /&gt;
At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
&lt;br /&gt;
#Simulation Termination:&lt;br /&gt;
&lt;br /&gt;
The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
&lt;br /&gt;
A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
==Single run==&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26527</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26527"/>
		<updated>2025-01-19T21:37:03Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Flow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record.&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
'''1.Initialization:'''&lt;br /&gt;
&lt;br /&gt;
*The database is created with empty vectors of records for each defined category (integer from 1 to 20).&lt;br /&gt;
*A defined number of agents are created with default probabilityToSearch.&lt;br /&gt;
*Optionally, a number of initial Record objects will be created (based on parameter BATCH_UPLOAD_SIZE), and randomly assigned to a random category within the database.&lt;br /&gt;
&lt;br /&gt;
'''2.Weekly Cycle (One Tick):'''&lt;br /&gt;
&lt;br /&gt;
*Each week (tick), each agent attempts to prepare an activity.&lt;br /&gt;
*Each agent selects a random category.&lt;br /&gt;
*Database Search Decision: An agent decides whether to search the database based on their current probabilityToSearch (It was originally designed to be able to dynamicaly calculate probabilityToSearch of agents independently, but for the same reason the recordCreationProb is global to all agents, also this variable was left the same for all agents).&lt;br /&gt;
&lt;br /&gt;
Search Behavior:&lt;br /&gt;
&lt;br /&gt;
If the agent decides to search, it looks up all records that matches it selected category.&lt;br /&gt;
&lt;br /&gt;
If records are found, the agents samples a predefined number of records for evaluation. Each has different probability based on its quality. The more quality it has, the higher the probability to be chosen.&lt;br /&gt;
&lt;br /&gt;
An agent tries to use (for it's activity preparation) randomly one record from those records. The probability of each record to be selected to be used is based on its quality.&lt;br /&gt;
&lt;br /&gt;
Before the agent uses any of the found records, there has to be checked if they haven't been used in a defined &amp;quot;cooldown period&amp;quot;, which is set to 54 weeks. Each agent keeps track of used records and the weeks where they where used.&lt;br /&gt;
&lt;br /&gt;
If the record is used, there is a probability of the agent improving the quality of that used record. If record isn't used it also improves a record (newly recorded), to indicate some minor change in activity record during preparation.&lt;br /&gt;
&lt;br /&gt;
Record Creation Behavior:&lt;br /&gt;
&lt;br /&gt;
If the agent decides not to search or if the search is unsuccessful, it has a chance of creating a new record (based on parameter recordCreationProb).&lt;br /&gt;
&lt;br /&gt;
If a new record is created, it's assigned a randomly generated initial quality based on the lognormal distribution, and pushed to db under it's selected category.&lt;br /&gt;
&lt;br /&gt;
The simulation tracks total search attempts and successes. The success is considered only when a record is successfully used for an activity and not when a record is found or searched for.&lt;br /&gt;
&lt;br /&gt;
#Success Rate Calculation:&lt;br /&gt;
&lt;br /&gt;
At the end of each week, a weekly success rate is calculated by dividing the amount of successful record usages by the number of attempts that were performed.&lt;br /&gt;
&lt;br /&gt;
#Simulation Termination:&lt;br /&gt;
&lt;br /&gt;
The simulation continues until the database has reached &amp;quot;sufficient&amp;quot; usability.&lt;br /&gt;
&lt;br /&gt;
A database is considered as &amp;quot;sufficiently useful&amp;quot; when success rates in a defined episode length (6 weeks) are over a defined threshold (75%) for a given minimum number of successful weeks (4 out of 6). In other words, when this condition is met within a 3 month timeframe.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
==Single run==&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26526</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26526"/>
		<updated>2025-01-19T21:27:51Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record.&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
: Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
: Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
: A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
;targetSuccessfulness&lt;br /&gt;
: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
;nSuccessfullFromEpisode&lt;br /&gt;
: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
;episodeLength&lt;br /&gt;
: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
==Single run==&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26525</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26525"/>
		<updated>2025-01-19T21:27:12Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Variables */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record.&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
;NUM_AGENTS: &lt;br /&gt;
Integer representing the number of agents (users) participating in the simulation. Value is fixed at 3.&lt;br /&gt;
;BATCH_UPLOAD_SIZES:&lt;br /&gt;
Vector of integers representing different sizes of initial record batches uploaded to the database. The values used in simulation are [0, 10].&lt;br /&gt;
;initialQualityDist: &lt;br /&gt;
A lognormal distribution (LogNormal(3, 2)) used to generate the initial quality of new records. The mean is set to 3, and the standard deviation is set to 2, meaning the typical quality of created record will be around 3, but there could be some with higher or lower.&lt;br /&gt;
;qualityImprovementProb&lt;br /&gt;
: Float64 representing the probability that an agent will improve a record's quality after using it. Value is fixed at 0.7.&lt;br /&gt;
;recordCreationProb&lt;br /&gt;
: Float64 representing the probability that an agent creates a new record when they are preparing an activity and decide not to search the database. Value is fixed at 0.3.&lt;br /&gt;
;categories&lt;br /&gt;
: Vector of integer representing the category ids of the db records. The vector is generated as range from 1 to 20, [1:20;].&lt;br /&gt;
&lt;br /&gt;
targetSuccessfulness: Float64 value, which represents minimum success rate, that needs to be reached for the database to be considered &amp;quot;useful&amp;quot; in a long term. Value is 0.75.&lt;br /&gt;
&lt;br /&gt;
nSuccessfullFromEpisode: An integer number representing how many successful searches per episode of the simulation have to occur in order for it to be considered &amp;quot;useful&amp;quot;. Value is 4.&lt;br /&gt;
&lt;br /&gt;
episodeLength: Integer which represents length of a one &amp;quot;episode&amp;quot; within the simulation, which in this case is a sequence of weeks for which the success rate of the db will be tested if it met required conditions. Value is set to 6, this means 6 weeks.&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
==Single run==&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26524</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26524"/>
		<updated>2025-01-19T21:25:13Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Entities */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
*id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
*quality (Float64): Represents the perceived quality or usability of the record.&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
*probabilityToSearch (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
*used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
==Single run==&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26523</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26523"/>
		<updated>2025-01-19T21:23:47Z</updated>

		<summary type="html">&lt;p&gt;Tros01: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
;Database (db):&lt;br /&gt;
*A dictionary storing Record objects, categorized by integers representing different activity categories.&lt;br /&gt;
*The keys of the dictionary are integers representing category id.&lt;br /&gt;
*Each category is associated with a vector (array) of Record objects.&lt;br /&gt;
*Initially, each category has an empty vector, which can be populated by new records.&lt;br /&gt;
&lt;br /&gt;
;Record:&lt;br /&gt;
A struct containing:&lt;br /&gt;
id (Integer): A unique identifier for the record, auto-incrementing with each creation.&lt;br /&gt;
quality (Float64): Represents the perceived quality or usability of the record.&lt;br /&gt;
&lt;br /&gt;
;Agent:&lt;br /&gt;
A struct representing a user of the database.&lt;br /&gt;
past_success_rate (Float64): The agent's current probability of finding a useful record, it is based on past success of the agent when searching the db. This parameter influences agent's decision whether to search the db or not.&lt;br /&gt;
used (Dict{Int, Vector{Int}}): A dictionary that stores which record IDs have been used by agent and in which week the record has been used, so it won't be used by the same agent during a given cooldown period. Keys are record ids and values are vectors containing week integers in which the record has been used.&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
==Single run==&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26522</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26522"/>
		<updated>2025-01-19T21:20:16Z</updated>

		<summary type="html">&lt;p&gt;Tros01: /* Code */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
==Single run==&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
g&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26521</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26521"/>
		<updated>2025-01-19T21:19:58Z</updated>

		<summary type="html">&lt;p&gt;Tros01: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
==Single run==&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 22:19, 19 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26520</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26520"/>
		<updated>2025-01-19T21:19:21Z</updated>

		<summary type="html">&lt;p&gt;Tros01: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
The core method used for this simulation is agent-based modeling (ABM). This approach was selected because it aligns well with the nature of the problem, which involves multiple individual users (agents) interacting with a shared environment (the database). Specifically, it enabled me to simulate:&lt;br /&gt;
&lt;br /&gt;
*Individual User Behaviors: Each agent acts independently, deciding whether to search the database, create a new record, or improve existing ones, based on their local information and probabilities.&lt;br /&gt;
*Heterogeneity (Limited): While the agents initially are identical, they change during the simulation based on their interactions with the database.&lt;br /&gt;
*Emergent System Behavior: The overall growth and usability of the database is not programmed directly, but emerges from the accumulation of individual actions.&lt;br /&gt;
&lt;br /&gt;
Alternatively the system dynamics or simple math equations could be used but neither of them would be more fitting for this usecase.&lt;br /&gt;
While system dynamics could model the overall growth of the database as a system, it would not provide the same level of detail regarding individual user actions. System dynamics works well when dealing with aggregate levels and rates of change but isn't great for capturing how each agent behaviour individually impacts the system.&lt;br /&gt;
&lt;br /&gt;
Just as the equations could model a simplified database growth equation, but it would be extremely difficult to derive a model which includes agents success/fail feedback, record improvement and cooldown and thus it was not considered as applicable for this problem.&lt;br /&gt;
==Julia==&lt;br /&gt;
Because the ABM approach was chosen the NetLogo was concidered as environment for implemantation of the simulation, but also was the language Julia as it is also often used for simulations. In the end the Julia was chosen because of its more general usability and therefore more usecases when learned to use.&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
==Single run==&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26519</id>
		<title>Populating the database</title>
		<link rel="alternate" type="text/html" href="http://www.simulace.info/index.php?title=Populating_the_database&amp;diff=26519"/>
		<updated>2025-01-19T20:39:24Z</updated>

		<summary type="html">&lt;p&gt;Tros01: Created page with &amp;quot;Úvodní odstavec  =Problem definition= ==Why?== Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to...&amp;quot;&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;Úvodní odstavec&lt;br /&gt;
&lt;br /&gt;
=Problem definition=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
&lt;br /&gt;
=Method=&lt;br /&gt;
==Agent-based model==&lt;br /&gt;
&lt;br /&gt;
==Julia==&lt;br /&gt;
&lt;br /&gt;
diskuse možností řešení, výběr metody a prostředku (metod a prostředků) řešení, zdůvodnění výběru (jinými slovy, proč to chcete řešit tak, jak to chcete řešit, jaké jsou jiné alternativy a proč je ta Vámi zvolená pro tuto úlohu nejvhodnější)&lt;br /&gt;
&lt;br /&gt;
=Model=&lt;br /&gt;
&lt;br /&gt;
==Entities==&lt;br /&gt;
&lt;br /&gt;
==Variables==&lt;br /&gt;
&lt;br /&gt;
==Flow==&lt;br /&gt;
&lt;br /&gt;
Detailní popis modelu, včetně parametrů, oborů hodnot, schémat, omezení modelu, apod. Popis musí být natolik detailní, aby podle něj bylo možné experiment zopakovat (a to samozřejmě i bez toho, že by byly k dispozici příslušné soubory s modelem).&lt;br /&gt;
&lt;br /&gt;
=Results=&lt;br /&gt;
==Single run==&lt;br /&gt;
&lt;br /&gt;
==Multi run==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
výpis výsledků, jejich analýza, interpretace, zhodnocení.&lt;br /&gt;
&lt;br /&gt;
=Discussion=&lt;br /&gt;
jak se Vám podařilo definovaný problém vyřešit&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Code=&lt;br /&gt;
[[File:Příklad.jpg]]&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=WS_2024/2025&amp;diff=26518</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=26518"/>
		<updated>2025-01-19T20:18:52Z</updated>

		<summary type="html">&lt;p&gt;Tros01: &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;br /&gt;
&lt;br /&gt;
-- [[User:Rysc00|Rysc00]] ([[User talk:Rysc00|talk]]) 23:04, 10 January 2025 (CET) Supermarket checkout process simulation [[Supermarket checkout process simulation]]&lt;br /&gt;
&lt;br /&gt;
-- [[User:Lanm14|Lanm14]] ([[User talk:Lanm14|talk]]) 0:40, 11 January 2025 (CET) Snowing simulation [[Simulace zasněžování]]&lt;br /&gt;
&lt;br /&gt;
-- [[User:Spis03|Spis03]] ([[User talk:Spis03|talk]]) 22:11, 11 January 2025 (CET) Ant Colony simulation: [[Ant Colony]]&lt;br /&gt;
&lt;br /&gt;
-- [[User:Sedp11|Sedp11]] ([[User talk:Sedp11|talk]]) 16:05, 17 January 2025 (CET) Simulation of traffic flow efficiency on highway D1: [[Simulation of traffic flow efficiency on highway D1]]&lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 21:18, 19 January 2025 (CET) Populating the database: [[Populating the database]]&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
	<entry>
		<id>http://www.simulace.info/index.php?title=Assignments_WS_2024/2025&amp;diff=26503</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=26503"/>
		<updated>2025-01-11T23:33:47Z</updated>

		<summary type="html">&lt;p&gt;Tros01: added sim concept tros01&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;
==Ant Colony==&lt;br /&gt;
&lt;br /&gt;
'''What will be simulated:'''&lt;br /&gt;
*Ant colony growth&lt;br /&gt;
&lt;br /&gt;
'''Goal of the simulation:'''&lt;br /&gt;
*The simulation aims to demonstrate how the complex, organized behaviors of an ant colony emerge from simple, decentralized rules followed by individual ants.&lt;br /&gt;
&lt;br /&gt;
'''Who would use the simulation and how it helps them:'''&lt;br /&gt;
*There is a diverse list of potential users of this simulation.&lt;br /&gt;
**Biologists can use the simulation to study and analyze the behavior of individual ants, their collective actions, and the emergent behavior of the ant colony.&lt;br /&gt;
**Biology educators can use this simulation as an engaging, interactive tool to demonstrate how the complex, organized behaviors of an ant colony emerge from simple, decentralized rules followed by individual ants.&lt;br /&gt;
**Exotic cuisine chefs can use this simulation to predict and optimize ant colony growth. This allows them to manage colonies sustainably and maximize the yield of their unique ingredient.&lt;br /&gt;
&lt;br /&gt;
'''Method and simulation environment:'''&lt;br /&gt;
*Method: Multiagent simulation&lt;br /&gt;
*Simulation environment: NetLogo&lt;br /&gt;
&lt;br /&gt;
'''Variables in the model:'''&lt;br /&gt;
*Deterministic Variables:&lt;br /&gt;
**Queen's Egg-Laying Rate&lt;br /&gt;
**Egg Development Time&lt;br /&gt;
**Worker Task Allocation&lt;br /&gt;
**Environmental Constants&lt;br /&gt;
*Random Variables:&lt;br /&gt;
**Egg Survival Rate&lt;br /&gt;
**Worker Behavior&lt;br /&gt;
**Worker Lifespan&lt;br /&gt;
**Environmental Threats&lt;br /&gt;
&lt;br /&gt;
'''Data sources:'''&lt;br /&gt;
*Observational data&lt;br /&gt;
*Research articles&lt;br /&gt;
&lt;br /&gt;
[[User:Spis03|Spis03]] ([[User talk:Spis03|talk]]) 14:33, 9 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
'''APPROVED''' [[User:Tomáš|Tomáš]] ([[User talk:Tomáš|talk]]) 16:28, 17 December 2024 (CET)&lt;br /&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, I have chosen these plants:&lt;br /&gt;
&lt;br /&gt;
''' Kudzu (Pueraria montana) '''&lt;br /&gt;
&lt;br /&gt;
Growth Rate: Kudzu is renowned for its rapid growth, capable of extending up to 0.3 meters (1 foot) per day, with mature vines reaching lengths of 30 meters (98 feet). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Resource Utilization: As a nitrogen-fixing plant, kudzu thrives in nitrogen-deficient soils, enhancing its competitive advantage in such environments. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Competitive Strategy: Kudzu's aggressive growth allows it to overtop and shade native vegetation, effectively outcompeting other species for sunlight and space. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
''' Purple Coneflower (Echinacea purpurea) '''&lt;br /&gt;
&lt;br /&gt;
Growth Characteristics: This perennial herb typically grows to heights of 1 to 3 feet (approximately 0.3 to 0.9 meters) and produces a woody rhizome. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Resource Requirements: Purple coneflower prefers sunny sites with low levels of competition and soils rich in magnesium and calcium. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Competitive Ability: While it can coexist with other species, purple coneflower may require management to prevent being outcompeted by more aggressive plants. &lt;br /&gt;
&lt;br /&gt;
This description of chosen plant species will be used to set up their behaviour in NetLogo.&lt;br /&gt;
&lt;br /&gt;
''' Resources: '''&lt;br /&gt;
&lt;br /&gt;
For Kudzu (Pueraria montana):&lt;br /&gt;
&lt;br /&gt;
Forest Service, U.S. Department of Agriculture. (n.d.). Pueraria montana var. lobata: Kudzu. Retrieved from https://www.fs.usda.gov/database/feis/plants/vine/puemonl/all.html&lt;br /&gt;
&lt;br /&gt;
National Center for Biotechnology Information. (2024). PMC Article on Kudzu Growth Dynamics. Retrieved from https://pmc.ncbi.nlm.nih.gov/articles/PMC9824185/&lt;br /&gt;
&lt;br /&gt;
Wikipedia contributors. (n.d.). Kudzu in the United States. Retrieved from https://en.wikipedia.org/wiki/Kudzu_in_the_United_States&lt;br /&gt;
&lt;br /&gt;
For Purple Coneflower (Echinacea purpurea):&lt;br /&gt;
&lt;br /&gt;
USDA Natural Resources Conservation Service. (n.d.). Plant guide: Echinacea purpurea. Retrieved from https://plants.usda.gov/DocumentLibrary/plantguide/pdf/pg_ecan2.pdf&lt;br /&gt;
&lt;br /&gt;
Plant Delights Nursery. (n.d.). Purple Coneflower (Echinacea purpurea). Retrieved from https://www.plantdelights.com/blogs/articles/purple-coneflower-echinacea-purpurea-plant&lt;br /&gt;
&lt;br /&gt;
USDA Natural Resources Conservation Service. (n.d.). Echinacea purpurea Fact Sheet. Retrieved from https://plants.usda.gov/DocumentLibrary/factsheet/pdf/fs_ecpu.pdf&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&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;
It is necessary to use real-world data. For simplicity sake, I strongly recommend to pick a particular specie or a couple species where are you able obtain data. Otherwise the task wouldn't be verifiable. [[User:Tomáš|Tomáš]] ([[User talk:Tomáš|talk]]) 16:33, 17 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Updated - particular species chosen with attributes and resources, I hope it is alright, Mr. Svatoš already told me on class that if I provided some relevant resources, it should be approved without a problem (meaning even without specifically chosen plant species), thank you [[User:Cesj05|Cesj05]] ([[User talk:Cesj05|talk]]) 13:23, 20 December 2024 (CET)&lt;br /&gt;
'''APPROVED''' [[User:Tomáš|Tomáš]] ([[User talk:Tomáš|talk]]) 14:00, 20 December 2024 (CET)&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;
: '''APPROVED''' Dont forget to keep the model testable, meaning all parameters should have a reasonable justification. [[User:Tomáš|Tomáš]] ([[User talk:Tomáš|talk]]) 14:02, 20 December 2024 (CET)&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;br /&gt;
&lt;br /&gt;
: '''APPROVED''', but: under all circumstances, obtain real data and base the simulation upon them. This simulation is relatively simple to develop, the real data are what could make it valuable. [[User:Tomáš|Tomáš]] ([[User talk:Tomáš|talk]]) 14:25, 20 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
== Customers at Traditional and Self-Service Checkouts ==&lt;br /&gt;
&lt;br /&gt;
=== Topic ===&lt;br /&gt;
'''Simulation of the customer check-in process at the checkout''', including incoming customers, their checkout selection (including self-service options), queuing, and service. The model reflects different service speeds, customer behavior (e.g., transitioning between checkouts), and satisfaction levels.&lt;br /&gt;
&lt;br /&gt;
=== Problem ===&lt;br /&gt;
The supermarket lacks rules for opening and closing checkouts, resulting in either excessive staff costs or low customer satisfaction. Data-based rules for checkout operations can optimize efficiency and satisfaction.&lt;br /&gt;
&lt;br /&gt;
=== Goal ===&lt;br /&gt;
Establish optimal rules for opening and closing checkouts to maintain customer satisfaction above 70%.&lt;br /&gt;
&lt;br /&gt;
=== Simulation Stakeholders ===&lt;br /&gt;
* '''HR Managers:''' Determine employee requirements per shift.&lt;br /&gt;
* '''Shift Leaders:''' Establish rules for opening new checkouts.&lt;br /&gt;
* '''Financial Manager:''' Optimize employee costs.&lt;br /&gt;
&lt;br /&gt;
== Method ==&lt;br /&gt;
* '''Platform:''' NetLogo&lt;br /&gt;
* '''Method:''' Agent-based simulation&lt;br /&gt;
&lt;br /&gt;
== Requirements ==&lt;br /&gt;
&lt;br /&gt;
=== Reality Abstraction Plan ===&lt;br /&gt;
&lt;br /&gt;
==== Customers ====&lt;br /&gt;
* '''Number of Items in Purchase:''' Lognormal distribution (µ=3, σ=0.3).&lt;br /&gt;
* '''Checkout Type Preference:'''&lt;br /&gt;
    * Items &amp;gt; 20: Preference = 1 (regular checkouts only).&lt;br /&gt;
    * Items &amp;gt; 10: Lognormal distribution on scale 1-100 (µ=2.8, σ=0.7).&lt;br /&gt;
    * Items ≤ 10: 100 - (Lognormal distribution on scale 1-100, µ=2.8, σ=0.7).&lt;br /&gt;
* '''Willingness to Switch Checkouts:''' Lognormal distribution on scale 1-100 (µ=2.9, σ=0.4). Drops to half after switching.&lt;br /&gt;
* '''Satisfaction:''' Depends on waiting time, switching, and checkout type.&lt;br /&gt;
    * Initial value: Normal distribution (mean=95, std=5).&lt;br /&gt;
    * '''Waiting Time:'''&lt;br /&gt;
        * ≤ 3 min: No change.&lt;br /&gt;
        * &amp;gt; 3 min: Decreases logarithmically: \( S(t) = 100 - 10 \cdot \ln(1 + (t - 3)) \).&lt;br /&gt;
    * '''Switching Checkouts:'''&lt;br /&gt;
        * Willingness &amp;gt; 80: No change.&lt;br /&gt;
        * Willingness ≤ 80: Decreases by a range (e.g., 1-5 points for willingness ≤ 80 &amp;amp; &amp;gt; 60).&lt;br /&gt;
    * '''Checkout Type:''' Satisfaction changes based on preference and actual service type (e.g., increases by 5-10 points if preference &amp;gt; 60 and served at self-checkout).&lt;br /&gt;
    * Satisfaction cannot be negative.&lt;br /&gt;
* '''Goal:''' Leave the supermarket as satisfied as possible.&lt;br /&gt;
&lt;br /&gt;
==== Checkouts ====&lt;br /&gt;
* '''Regular Checkouts (Count: 5):'''&lt;br /&gt;
    * '''Service Speed:'''&lt;br /&gt;
        * Payment: Normal distribution (mean=1 min, std=0.2).&lt;br /&gt;
        * Marking Items: 80% EAN-coded items (mean=0.02 min, std=0.01); 20% non-EAN (mean=0.03 min, std=0.01).&lt;br /&gt;
    * '''Checkout Error:''' 0.1% probability; solving time = Normal distribution (mean=0.5 min, std=0.1).&lt;br /&gt;
* '''Self-Service Checkouts (Count: 8):'''&lt;br /&gt;
    * '''Service Speed:'''&lt;br /&gt;
        * Payment: Normal distribution (mean=1.2 min, std=0.3).&lt;br /&gt;
        * Marking Items: 80% EAN-coded items (mean=0.03 min, std=0.01); 20% non-EAN (mean=0.04 min, std=0.01).&lt;br /&gt;
    * '''Checkout Error:''' 1% probability; solving time = Normal distribution (mean=0.5 min, std=0.1).&lt;br /&gt;
&lt;br /&gt;
=== Simulation Rules ===&lt;br /&gt;
* '''Operating Hours:''' 7:00-20:00 (1 average day).&lt;br /&gt;
* '''Customer Arrivals:'''&lt;br /&gt;
    * Peak Hours (7:00-10:00 &amp;amp; 16:00-18:00): Normal distribution (mean=4, std=1).&lt;br /&gt;
    * Non-Peak Hours (10:00-16:00 &amp;amp; 18:00-20:00): Normal distribution (mean=2, std=1).&lt;br /&gt;
* '''Goal of Checkouts:''' Maintain customer satisfaction above 70% with minimal open regular checkouts.&lt;br /&gt;
* The simulation will not address scenarios outside the checkout area.&lt;br /&gt;
* One customer corresponds to one purchase.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[User:Rysc00|Rysc00]] ([[User talk:Rysc00|talk]]) 13:23, 08 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
: Please, elaborate it. What will be the real data you will base it on. What supermarket/store.?&lt;br /&gt;
: BTW: Don't use HTML for editing these documents, Wiki uses Markup. Using HTML makes the document messy.&lt;br /&gt;
&lt;br /&gt;
Update: The mentioned supermarket is supposed to be Tesco in Vodňany, my hometown. The supermarket will not share exact data with me - the values are based on my own experience and observation. Is that a sufficient base for the simulation? Obtaining such data from the supermarket is not realistic, and as to any other sources - research papers on this topic are not from the same socio-geographical background, which influences customer behavior a lot. The simulation would be less realistic if I based it on research papers.&lt;br /&gt;
&lt;br /&gt;
[[User:Rysc00|Rysc00]] ([[User talk:Rysc00|talk]]) 22:17, 20 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
: In general, it is better to choose a topic for which data is available. You can elaborate on the proposed topic if you are able to justify the specific parameters. Expect to focus on this in the result. '''APPROVED''' [[User:Tomáš|Tomáš]] ([[User talk:Tomáš|talk]]) 12:16, 27 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
= What you will simulate: =&lt;br /&gt;
# I will simulate the process of artificially snowing a ski slope, including the operation of snow cannons, and the influence of temperature, humidity, and wind on snow production and the maintenance of a snow cover.&lt;br /&gt;
&lt;br /&gt;
== The goal of the simulation: ==&lt;br /&gt;
# The objective is to optimize the snowmaking process to achieve the desired snow cover height at the lowest possible energy and water costs, while accounting for changing weather conditions.&lt;br /&gt;
&lt;br /&gt;
== Who would actually use such simulation and how: ==&lt;br /&gt;
# A typical user might be a ski resort manager or the operator of snowmaking equipment. The simulation would help them plan and optimize their snowmaking strategy in advance, reduce operational costs, and ensure quality snow conditions for skiers.&lt;br /&gt;
&lt;br /&gt;
== What method and simulation environment: ==&lt;br /&gt;
# Multi-agent simulation in NetLogo&lt;br /&gt;
&lt;br /&gt;
== What variables will be incorporated: ==&lt;br /&gt;
# Deterministic variables: the placement of snow cannons, the energy demands of the snow cannons, and the target snow cover height.&lt;br /&gt;
# State variables: the current snow depth on the slope, and the current water and energy consumption.&lt;br /&gt;
&lt;br /&gt;
== What variables will be random: ==&lt;br /&gt;
# Weather conditions (temperature, humidity, wind, and any natural snowfall) will be generated with random fluctuations within the range of observed real-world values.&lt;br /&gt;
&lt;br /&gt;
== What exact data you will base values of your variables on: ==&lt;br /&gt;
# The values for weather and the performance of snow cannons will be based on literature and technical specifications from manufacturers (average seasonal temperatures, typical humidity ranges, average efficiency of snow cannons).&lt;br /&gt;
&lt;br /&gt;
[[User:Lanm14|Lanm14]] ([[User talk:Lanm14|talk]]) 15:00, 08 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
: '''APPROVED''' [[User:Tomáš|Tomáš]] ([[User talk:Tomáš|talk]]) 14:32, 20 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=Lightning Network Channel Dynamics Simulation=&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;The Lightning Network represents a promising solution to Bitcoin's scalability challenges, enabling fast and low-cost transactions. In the Czech Republic, it's gaining practical adoption with merchants like Alza.cz, Rohlik.cz and payment processors like Qerko and GoPay.&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;p&amp;gt; The network consists of payment channels, direct connections between two participants. Each channel has a fixed capacity, representing the total funds locked in for transactions. This capacity is shared between the two participants, with each holding a portion of the total on his side of the channel. Payments update the balance distribution within the channel. If two participants don’t have a direct channel, the network routes payments through connected channels, relying on intermediary nodes with enough capacity to complete the transfer. &amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;h2&amp;gt;What will be simulated:&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;A NetLogo agent-based simulation of Lightning Network payment channels that models:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Nodes (merchants, customers, routing nodes) as agents with defined balances and behaviors&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Payment channels as links between nodes with specific capacities&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Transaction routing through the network&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Channel balance changes and payment success/failure dynamics&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Goal of the simulation:&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;To analyze how different network configurations affect payment success rates and channel efficiency, specifically:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Identify optimal channel capacity distribution for maximizing successful payments&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Determine relationship between node connectivity and network reliability&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Find bottlenecks in payment routing that cause transaction failures&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Who would use the simulation and how it helps them:&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;p&amp;gt;Primary users:&amp;lt;/p&amp;gt;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;New merchants considering Lightning Network adoption:&lt;br /&gt;
        &amp;lt;ul&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Understand required number of payment channels&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Plan initial channel capacity requirements&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Estimate liquidity needs&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Lightning Network node operators:&lt;br /&gt;
        &amp;lt;ul&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Optimize channel configurations&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Understand routing effectiveness&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Plan capital allocation&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Method and simulation environment:&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Method: Agent-based modeling&amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Environment: NetLogo&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Variables incorporated:&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Deterministic Variables:&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Number of nodes (N):&lt;br /&gt;
        &amp;lt;ul&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Initial setup: 100-200 nodes&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Based on small subset of real network for feasibility&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Can be adjusted via interface slider&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Initial channel capacity (C):&lt;br /&gt;
        &amp;lt;ul&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Range: 0.001 - 0.1 BTC per channel&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Based on average values from 1ML.com statistics&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Set at channel creation time&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Node types:&lt;br /&gt;
        &amp;lt;ul&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Merchant: 20% of nodes&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Customer: 70% of nodes&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Routing-node: 10% of nodes&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Proportions based on network analysis papers&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Base fee per transaction:&lt;br /&gt;
        &amp;lt;ul&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Default: 1 satoshi base + 0.001% of amount&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Based on common Lightning node configurations&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Network topology structure:&lt;br /&gt;
        &amp;lt;ul&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Average connections per node: 3-8&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Based on observed network patterns&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Follows power-law distribution&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h3&amp;gt;Random Variables:&amp;lt;/h3&amp;gt;&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Transaction amounts:&lt;br /&gt;
        &amp;lt;ul&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Distribution: Log-normal&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Mean: 50,000 satoshis&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Standard deviation: 25,000 satoshis&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Based on public Lightning Network statistics&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Transaction timing:&lt;br /&gt;
        &amp;lt;ul&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Poisson distribution&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Mean arrival rate (λ): 0.1 transactions per node per minute&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Can be adjusted via interface slider&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Channel balance fluctuations:&lt;br /&gt;
        &amp;lt;ul&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Random walk within channel capacity&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Step size: Normal distribution (μ=0, σ=0.01 × capacity)&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Updates every simulation tick&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Node connection preferences:&lt;br /&gt;
        &amp;lt;ul&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Probability of connection decreases with distance&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Weighted by node type and existing connections&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Uses preferential attachment model&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Payment success probability:&lt;br /&gt;
        &amp;lt;ul&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Base probability: 0.95&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Modified by:&lt;br /&gt;
                &amp;lt;ul&amp;gt;&lt;br /&gt;
                    &amp;lt;li&amp;gt;Channel capacity utilization&amp;lt;/li&amp;gt;&lt;br /&gt;
                    &amp;lt;li&amp;gt;Path length&amp;lt;/li&amp;gt;&lt;br /&gt;
                    &amp;lt;li&amp;gt;Node type&amp;lt;/li&amp;gt;&lt;br /&gt;
                &amp;lt;/ul&amp;gt;&lt;br /&gt;
            &amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Data sources for variable values:&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Network structure and capacities:&lt;br /&gt;
        &amp;lt;ul&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Public Lightning Network explorer (1ML.com):&lt;br /&gt;
                &amp;lt;ul&amp;gt;&lt;br /&gt;
                    &amp;lt;li&amp;gt;Current number of nodes (~17,000)&amp;lt;/li&amp;gt;&lt;br /&gt;
                    &amp;lt;li&amp;gt;Average channel capacity (~0.03 BTC)&amp;lt;/li&amp;gt;&lt;br /&gt;
                    &amp;lt;li&amp;gt;Node distribution and connectivity patterns&amp;lt;/li&amp;gt;&lt;br /&gt;
                &amp;lt;/ul&amp;gt;&lt;br /&gt;
            &amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Mempool.space statistics:&lt;br /&gt;
                &amp;lt;ul&amp;gt;&lt;br /&gt;
                    &amp;lt;li&amp;gt;Total network capacity&amp;lt;/li&amp;gt;&lt;br /&gt;
                    &amp;lt;li&amp;gt;Channel count&amp;lt;/li&amp;gt;&lt;br /&gt;
                    &amp;lt;li&amp;gt;Node count&amp;lt;/li&amp;gt;&lt;br /&gt;
                &amp;lt;/ul&amp;gt;&lt;br /&gt;
            &amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Transaction patterns:&lt;br /&gt;
        &amp;lt;ul&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Public Lightning Network statistics from Bitcoin Visuals (bitcoinvisuals.com)&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Academic research papers on Lightning Network analysis:&lt;br /&gt;
                &amp;lt;ul&amp;gt;&lt;br /&gt;
                    &amp;lt;li&amp;gt;&amp;quot;Lightning Network: a second path towards centralisation of the Bitcoin economy&amp;quot; (Lin et al., 2020)&amp;lt;/li&amp;gt;&lt;br /&gt;
                    &amp;lt;li&amp;gt;&amp;quot;A Quantitative Analysis of Security, Anonymity and Scalability for the Lightning Network&amp;quot; (Tikhomirov et al., 2020)&amp;lt;/li&amp;gt;&lt;br /&gt;
                &amp;lt;/ul&amp;gt;&lt;br /&gt;
            &amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;h2&amp;gt;Simulation behavior formulas based on:&amp;lt;/h2&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Payment routing:&lt;br /&gt;
        &amp;lt;ul&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Lightning Network specifications (BOLTs) from lightning-rfc repository&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;LND implementation documentation&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Published research on routing behavior&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
    &amp;lt;li&amp;gt;Channel balancing:&lt;br /&gt;
        &amp;lt;ul&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Lightning Network whitepaper formulas&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Public node operation best practices&amp;lt;/li&amp;gt;&lt;br /&gt;
            &amp;lt;li&amp;gt;Academic analysis of channel dynamics&amp;lt;/li&amp;gt;&lt;br /&gt;
        &amp;lt;/ul&amp;gt;&lt;br /&gt;
    &amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[User:Filip Simulátor|mikf02]] ([[User talk:Filip Simulátor|talk]]) 19:58, 8 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
: '''APPROVED''' Don't use HTML for writing WIKI!!! [[User:Tomáš|Tomáš]] ([[User talk:Tomáš|talk]]) 11:48, 27 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
= Performance of Solar Power Plant Using Monte Carlo Simulation and ERA5 Data (matj27)=&lt;br /&gt;
&lt;br /&gt;
== What will you simulate? ==&lt;br /&gt;
The simulation will model the potential energy output of a power plant. Simulation will be based upon meteorological data from the ERA5 reanalysis dataset with panel efficiency variability to determine an energy production estimates over a year in Louny (Roughly N 50°21′00″; E 013°47′00″; ERA5 resolution is cca. 31 km - 0.25° grid (bbox: [[13.75, 50.5],[14.00, 50.5],[14.00, 50.25],[13.75, 50.25],[13.75, 50.5]])).&lt;br /&gt;
&lt;br /&gt;
== Goal of the simulation ==&lt;br /&gt;
The goal is to analyze the impact of daily solar radiance variability and panel efficiency fluctuations on the power plant energy output. &lt;br /&gt;
&lt;br /&gt;
== Users ==&lt;br /&gt;
Solar power plants companies and solar power plants owners to calculate financial feasibility, ROI etc.&lt;br /&gt;
&lt;br /&gt;
== Methods, environment ==&lt;br /&gt;
'''Methods:''' Monte Carlo simulation&lt;br /&gt;
&lt;br /&gt;
'''Environment:''' Python - to process ERA5 GRIB data, Excel - to run Monte Carlo simulation&lt;br /&gt;
&lt;br /&gt;
== Variables incorporated ==&lt;br /&gt;
Solar panels power and efficiency, solar radiance from ERA5.&lt;br /&gt;
&lt;br /&gt;
Historical ERA5 data will define the mean and variance of solar radiance.&lt;br /&gt;
&lt;br /&gt;
Panel efficiency variability will be sourced from manufacturer specifications.&lt;br /&gt;
&lt;br /&gt;
== Data for simulation behavior formulas ==&lt;br /&gt;
Formula to estimate the electricity generated in output of a photovoltaic system: E = A * r * H * PR&lt;br /&gt;
&lt;br /&gt;
E = Energy (kWh)&lt;br /&gt;
&lt;br /&gt;
A = Total solar panel Area (m2)&lt;br /&gt;
&lt;br /&gt;
r = solar panel yield or efficiency (%) &lt;br /&gt;
&lt;br /&gt;
H = Annual average solar radiation on tilted panels (based on solar radiance)&lt;br /&gt;
&lt;br /&gt;
PR = Performance ratio, coefficient for losses (range between 0.5 and 0.9, default value = 0.75)&lt;br /&gt;
&lt;br /&gt;
Based on https://photovoltaic-software.com/principle-ressources/how-calculate-solar-energy-power-pv-systems[https://photovoltaic-software.com/principle-ressources/how-calculate-solar-energy-power-pv-systems]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[User:matj27|matj27]] ([[User talk:matj27|talk]]) 19:07, 9th December 2024 (CET)&lt;br /&gt;
:: '''Approved''' [[User:Oleg.Svatos|Oleg.Svatos]] ([[User talk:Oleg.Svatos|talk]]) 15:16, 12 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
= Simulation of traffic flow efficiency on highway D1 (based od traffic restrictions) =&lt;br /&gt;
&lt;br /&gt;
== What will be simulated ==&lt;br /&gt;
&lt;br /&gt;
Simulation of arrival delay based on number of traffic restrictions on highway D1. How many restrictions are &amp;quot;acceptable&amp;quot; so that there is not too much delay compared to driving without any restrictions. The user will be able to set the number of restricted kilometers and the number of restritions.&lt;br /&gt;
&lt;br /&gt;
== Goal ==&lt;br /&gt;
&lt;br /&gt;
Find out how many restrictions are too much and if it's better to have more smaller ones or less bigger ones.&lt;br /&gt;
&lt;br /&gt;
== Usefulness ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
The simulation can show us how much delay is caused by restrictions on the highway, and whether the highway is too restricted or whether restrictions can be increased without significantly reducing travel time. It can also show us whether it is better to have more restrictions in smaller chunks or fewer restrictions over a longer stretch.&lt;br /&gt;
&lt;br /&gt;
== Simulation method ==&lt;br /&gt;
&lt;br /&gt;
Simulation in application NetLogo&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
-	Number of cars&lt;br /&gt;
&lt;br /&gt;
-	Percentage of truks (slower cars)&lt;br /&gt;
&lt;br /&gt;
-	Number of restricted kilometres&lt;br /&gt;
&lt;br /&gt;
-	Number of restrictions&lt;br /&gt;
&lt;br /&gt;
-	Percentage of aggresive drivers&lt;br /&gt;
&lt;br /&gt;
== Radnom variables ==&lt;br /&gt;
&lt;br /&gt;
-	Speed of cars&lt;br /&gt;
&lt;br /&gt;
-	Lane changing&lt;br /&gt;
&lt;br /&gt;
-	Random restriction placement&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Source for data == &lt;br /&gt;
&lt;br /&gt;
https://dopravniinfo.cz/D1&lt;br /&gt;
https://d1.dd.cz/?direction=12&lt;br /&gt;
&lt;br /&gt;
[[User:Sedp11|Sedp11]] ([[User talk:Sedp11|talk]]) 16:40, 10 December 2024 (CET) - I had this topis last year but never made it. If its not OK I will make a new one.&lt;br /&gt;
&lt;br /&gt;
: '''APPROVED''' [[User:Tomáš|Tomáš]] ([[User talk:Tomáš|talk]]) 14:38, 20 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
= System Dynamics Simulation of Hybrid Work Models =&lt;br /&gt;
&lt;br /&gt;
== What will be simulated ==&lt;br /&gt;
The simulation will model workplace dynamics under three work modes—remote, hybrid, and in-office—focusing on the interplay between key factors: productivity, collaboration, employee satisfaction, and cost. The model will explore how these variables interact over time in different work environments.&lt;br /&gt;
&lt;br /&gt;
== The goal of the simulation ==&lt;br /&gt;
To analyze the relationships and feedback loops between productivity, collaboration, satisfaction, and cost under various work modes, and provide actionable insights into:&lt;br /&gt;
* How collaboration affects productivity over time.&lt;br /&gt;
* How employee satisfaction changes in response to work mode, workload, and collaboration.&lt;br /&gt;
* The trade-offs between cost-efficiency and employee performance.&lt;br /&gt;
&lt;br /&gt;
== Example User and How would it help ==&lt;br /&gt;
* Example User: HR managers, workplace strategists, or organizational leaders in medium to large enterprises&lt;br /&gt;
* How it helps: The simulation provides data-driven insights into the long-term effects of different work modes, helping organizations create work policies that optimize employee performance and satisfaction while maintaining cost efficiency.&lt;br /&gt;
&lt;br /&gt;
== Method and Simulation Environment ==&lt;br /&gt;
* Method: System dynamics simulation to model causal relationships and feedback loops.&lt;br /&gt;
* Simulation Environment: Vensim PLE&lt;br /&gt;
&lt;br /&gt;
== Variables ==&lt;br /&gt;
* Productivity: Represents the task completion rate over time. Influenced by collaboration, workload, and satisfaction&lt;br /&gt;
* Collaboration: Measures teamwork effectiveness. Remote work has the lowest collaboration, hybrid has moderate, and in-office has the highest levels.&lt;br /&gt;
* Satisfaction: Reflects employee morale and well-being. Satisfaction increases with productivity and effective collaboration but decreases with excessive workload.&lt;br /&gt;
* Cost: Represents daily operational expenses per employee. Fixed based on the work mode.&lt;br /&gt;
&lt;br /&gt;
== Data ==&lt;br /&gt;
Based on studies and reports from Statista, workplace surveys and industry averages for operational costs in each work mode.&lt;br /&gt;
&lt;br /&gt;
== What exact data you will base your formulas in the simulation (simulation behavior) on ==&lt;br /&gt;
* Productivity Formula: Productivity = Baseline Productivity × Collaboration Index × Satisfaction Level&lt;br /&gt;
* Collaboration Formula: Collaboration = Baseline Collaboration × (1 − Remote_Work_Proportion)&lt;br /&gt;
* Satisfaction Formula: Satisfaction = Baseline Satisfaction + (0.2 × Productivity) − (0.1 × Workload Index)&lt;br /&gt;
* Cost Formula: Fixed cost values for each work mode.&lt;br /&gt;
* Feedback Loops:&lt;br /&gt;
** Positive Loop: High collaboration → Higher productivity → Higher satisfaction → Improved collaboration.&lt;br /&gt;
** Negative Loop: Excessive workload → Lower satisfaction → Reduced productivity.&lt;br /&gt;
&lt;br /&gt;
[[User:Tara04|Tara04]] ([[User talk:Tara04|talk]]) 20:15, 11 December 2024 (CET)&lt;br /&gt;
:: '''Approved''' [[User:Oleg.Svatos|Oleg.Svatos]] ([[User talk:Oleg.Svatos|talk]]) 15:23, 12 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
= Robotic Vacuum Algorithms Simulation by kulv05 =&lt;br /&gt;
&lt;br /&gt;
== What will be simulated: ==&lt;br /&gt;
&lt;br /&gt;
In this task I want to simulate a robotic vacuum cleaner that cleans a room, navigate around obstacles and collecting dust and trash.&lt;br /&gt;
&lt;br /&gt;
== The goal of the simulation ==&lt;br /&gt;
The goal of the simulation is to compare the effectiveness of different movement algorithms for a robot vacuum, find the one that is the most efficient. I aim to determine which algorithm completes the cleaning task in the least time, consumes the least power, overall efficiency as well.&lt;br /&gt;
The formulas for comparison:&lt;br /&gt;
Efficiency_time= Ticks needed to finish cleaning/Dust Collected;&lt;br /&gt;
Efficiency_power=Power usage/Trash Collected;&lt;br /&gt;
Efficiency_overall=Trash Collected/(Ticks needed to finish cleaning×Power usage);&lt;br /&gt;
&lt;br /&gt;
== Who would actually use such simulation ==&lt;br /&gt;
&lt;br /&gt;
The results can be theoretically valuable for developers working on autonomous home devices and manufacturers of robotic vacuum cleaners such as iRobot, Xiaomi etc. Customers can also find it useful when choosing a new vacuum.&lt;br /&gt;
&lt;br /&gt;
== What method and simulation environment you plan to use ==&lt;br /&gt;
&lt;br /&gt;
The simulation will be developed using the NetLogo agent-based model&lt;br /&gt;
&lt;br /&gt;
== What variables will be incorporated ==&lt;br /&gt;
&lt;br /&gt;
''Agents'':&lt;br /&gt;
&lt;br /&gt;
•	Vacuum&lt;br /&gt;
•	Trash&lt;br /&gt;
•	Room(The space within which the robot operates, including obstacles like furniture)&lt;br /&gt;
&lt;br /&gt;
''Parameters'':&lt;br /&gt;
&lt;br /&gt;
•	Type of algorithm&lt;br /&gt;
•	Ticks needed to finish cleaning&lt;br /&gt;
•	Power usage&lt;br /&gt;
•	Trash Collected&lt;br /&gt;
&lt;br /&gt;
==What variables will be random==&lt;br /&gt;
&lt;br /&gt;
Trash placement&lt;br /&gt;
&lt;br /&gt;
Start position&lt;br /&gt;
&lt;br /&gt;
== What exact data you will base your formulas in the simulation (simulation behavior) on ==&lt;br /&gt;
&lt;br /&gt;
The algorithms used for comparison:&lt;br /&gt;
Random walk(reactive), Zigzag, Spiral, Wall to wall, SLAM(if possible to implement in netlogo), A* (if possible to implement in netlogo)&lt;br /&gt;
&lt;br /&gt;
https://www.diva-portal.org/smash/get/diva2:1213349/FULLTEXT02.pdf [https://www.diva-portal.org/smash/get/diva2:1213349/FULLTEXT02.pdf]&lt;br /&gt;
&lt;br /&gt;
https://ouster.com/insights/blog/introduction-to-slam-simultaneous-localization-and-mapping [https://ouster.com/insights/blog/introduction-to-slam-simultaneous-localization-and-mapping]&lt;br /&gt;
&lt;br /&gt;
https://www.geeksforgeeks.org/a-search-algorithm/ [https://www.geeksforgeeks.org/a-search-algorithm/]&lt;br /&gt;
&lt;br /&gt;
Evaluation: &lt;br /&gt;
&lt;br /&gt;
Efficiency_time= Ticks needed to finish cleaning/Dust Collected&lt;br /&gt;
&lt;br /&gt;
Efficiency_power=Power usage/Trash Collected&lt;br /&gt;
&lt;br /&gt;
Efficiency_overall=Trash Collected/(Ticks needed to finish cleaning×Power usage)&lt;br /&gt;
&lt;br /&gt;
 [[User:Kulv05|Kulv05]] ([[User talk:Kulv05|talk]]) 01:44, 13 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
: '''APPROVED''' [[User:Tomáš|Tomáš]] ([[User talk:Tomáš|talk]]) 17:30, 20 December 2024 (CET)&lt;br /&gt;
~&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
= Simulation Concept – Bee Foraging Behavior =&lt;br /&gt;
&lt;br /&gt;
=== Objectives ===&lt;br /&gt;
* Understand the dynamics of bee foraging behavior and its efficiency in collecting nectar.&lt;br /&gt;
* Explore the influence of environmental factors like nectar replenishment rates and bee memory retention on foraging success.&lt;br /&gt;
* Simulate how communication methods like the waggle dance influence the collective behavior of bees.&lt;br /&gt;
&lt;br /&gt;
=== Environment ===&lt;br /&gt;
* '''Patches''': Represent flowers scattered across a 2D grid, each containing a limited amount of nectar that replenishes over time.&lt;br /&gt;
* '''Hive''': A central location on the grid where bees return after collecting nectar.&lt;br /&gt;
&lt;br /&gt;
=== Agents ===&lt;br /&gt;
# '''Bees (Turtles):'''&lt;br /&gt;
## Search for flowers with nectar and collect it.&lt;br /&gt;
## Return to the hive to deposit nectar and signal flower locations using the waggle dance.&lt;br /&gt;
# '''Flowers (Patches):'''&lt;br /&gt;
## Have a specific amount of nectar that can be collected.&lt;br /&gt;
## Nectar levels decrease as bees forage and replenish over time.&lt;br /&gt;
&lt;br /&gt;
=== Methods ===&lt;br /&gt;
==== Initialization ====&lt;br /&gt;
* Randomly distribute flowers across the grid with initial nectar levels.&lt;br /&gt;
* Initialize a fixed number of bees at the hive.&lt;br /&gt;
&lt;br /&gt;
==== Simulation Steps (Turtles/Agents) ====&lt;br /&gt;
# '''Foraging:'''&lt;br /&gt;
## Bees search randomly or follow waggle dance signals to locate flowers with nectar.&lt;br /&gt;
## Once nectar is collected, they return to the hive to deposit it.&lt;br /&gt;
# '''Waggle Dance Communication:'''&lt;br /&gt;
## Bees that successfully find nectar signal its location to other bees in the hive.&lt;br /&gt;
## Other bees decide whether to follow these signals or continue searching independently.&lt;br /&gt;
# '''Nectar Replenishment:'''&lt;br /&gt;
## Flowers regenerate nectar at a rate defined by the user.&lt;br /&gt;
# '''Memory Retention:'''&lt;br /&gt;
## Bees remember flower locations for a limited time, after which they must search anew or rely on waggle dance signals.&lt;br /&gt;
&lt;br /&gt;
==== Interaction Dynamics ====&lt;br /&gt;
* '''User Inputs:'''&lt;br /&gt;
** Number of bees.&lt;br /&gt;
** Nectar replenishment rate.&lt;br /&gt;
** Bee memory retention (time).&lt;br /&gt;
* '''Scenarios to Explore:'''&lt;br /&gt;
** High vs. low nectar replenishment rates.&lt;br /&gt;
** Effect of longer or shorter memory retention.&lt;br /&gt;
** Impact of increased hive communication (more bees following waggle dances).&lt;br /&gt;
&lt;br /&gt;
=== Simulation Details ===&lt;br /&gt;
* '''Platform''': NetLogo.&lt;br /&gt;
* '''Data Source''': Synthetic data to simulate nectar levels and bee behavior, designed to mimic real-world phenomena based on biological studies.&lt;br /&gt;
* '''Behavior Setup''': Inspired by findings in bee foraging and communication studies:&lt;br /&gt;
** [https://link.springer.com/article/10.1556/ABiol.63.2012.Suppl.2.8?utm_source=chatgpt.com Effects of Flower Patches on Bee Foraging].&lt;br /&gt;
** [https://academic.oup.com/beheco/article/19/2/255/212470 The Role of the Waggle Dance in Foraging Success].&lt;br /&gt;
&lt;br /&gt;
[[User:Lozd00|Lozd00]] ([[User talk:Lozd00|talk]]) 10:11, 13 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
: '''APPROVED''' [[User:Tomáš|Tomáš]] ([[User talk:Tomáš|talk]]) 17:32, 20 December 2024 (CET)&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
= Simulation of Urban Bicycle-Sharing System =&lt;br /&gt;
&lt;br /&gt;
== Problem ==&lt;br /&gt;
Bike-sharing systems often struggle with uneven bicycle distribution across stations, leading to user frustration, inefficient system usage, and increased operational costs for redistribution.&lt;br /&gt;
&lt;br /&gt;
== Goal ==&lt;br /&gt;
Develop and analyze optimal strategies for bicycle redistribution that maximize user accessibility and system efficiency while minimizing operational costs.&lt;br /&gt;
&lt;br /&gt;
== Simulation Stakeholders ==&lt;br /&gt;
* City Transportation Planners: Optimize bicycle-sharing system infrastructure&lt;br /&gt;
* Bike-Sharing System Operators: Improve operational efficiency&lt;br /&gt;
* Municipal Mobility Departments: Understand urban mobility patterns&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;
== Agents ==&lt;br /&gt;
=== Bicycles ===&lt;br /&gt;
Total fleet size based on real data from successful bike-sharing systems (Barcelona bike sharing)&lt;br /&gt;
&lt;br /&gt;
'''Individual bicycle characteristics:'''&lt;br /&gt;
* Battery level&lt;br /&gt;
* Maintenance status&lt;br /&gt;
* Current station location&lt;br /&gt;
&lt;br /&gt;
=== Stations ===&lt;br /&gt;
* Geographically distributed across area&lt;br /&gt;
* Capacity limits based on real urban infrastructure&lt;br /&gt;
* Dock availability&lt;br /&gt;
* Location attractiveness (proximity to popular destinations)&lt;br /&gt;
&lt;br /&gt;
=== Users ===&lt;br /&gt;
'''Trip Characteristics:'''&lt;br /&gt;
* Origin and destination points&lt;br /&gt;
* Time of day&lt;br /&gt;
&lt;br /&gt;
'''User Behavior:'''&lt;br /&gt;
* Willingness to walk to alternative stations&lt;br /&gt;
* Tolerance for bicycle unavailability&lt;br /&gt;
&lt;br /&gt;
=== Random Variables ===&lt;br /&gt;
&lt;br /&gt;
'''User Arrival Rates'''&lt;br /&gt;
* Varying by time of day (peak/off-peak hours)&lt;br /&gt;
** Probability distribution: Poisson distribution with parameters from actual bike-sharing system data&lt;br /&gt;
&lt;br /&gt;
== Simulation rules ==&lt;br /&gt;
* system operates 24/7&lt;br /&gt;
* '''Station emptiness:'''&lt;br /&gt;
** &amp;lt; 10% empty&lt;br /&gt;
** &amp;gt; 80% full&lt;br /&gt;
&lt;br /&gt;
== Data Limitations ==&lt;br /&gt;
* aggregated data will be used&lt;br /&gt;
* no real city will be used for simulation, it will be set in made up part of city with points of interest and bike sharing stations&lt;br /&gt;
&lt;br /&gt;
== Data sources ==&lt;br /&gt;
* '''Research papers:'''&lt;br /&gt;
** https://www.sciencedirect.com/science/article/abs/pii/S2210670719319286&lt;br /&gt;
&lt;br /&gt;
* '''Bike sharing data'''&lt;br /&gt;
** https://www.kaggle.com/datasets/edomingo/bicing-stations-dataset-bcn-bike-sharing/data&lt;br /&gt;
&lt;br /&gt;
[[User:Capj05|Capj05]] ([[User talk:Capj05|talk]]) 16:47, 16 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
: '''APPROVED''', but you deal with some very soft variables like: Willingness to walk to alternative stations, Tolerance for bicycle unavailability. It is very important to have all parameters very well justified. [[User:Tomáš|Tomáš]] ([[User talk:Tomáš|talk]]) 17:38, 20 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
= Urban Traffic Flow Optimization Simulation by stej34 =&lt;br /&gt;
&lt;br /&gt;
== What will be simulated: ==&lt;br /&gt;
The simulation will model traffic flow in an urban area, focusing on the effects of traffic light timing, pedestrian crossings, and road capacity on congestion and travel time.&lt;br /&gt;
&lt;br /&gt;
== Goal of the simulation: ==&lt;br /&gt;
The simulation aims to demonstrate how optimizing traffic light patterns and pedestrian crossing behavior can improve traffic flow, reduce congestion, and minimize travel delays in urban environments.&lt;br /&gt;
&lt;br /&gt;
== Who would use the simulation and how it helps them: ==&lt;br /&gt;
This simulation can benefit:&lt;br /&gt;
&lt;br /&gt;
'''City Planners:''' To experiment with different traffic light timings and road layouts to optimize urban traffic.&lt;br /&gt;
'''Traffic Engineers:''' To analyze the effects of pedestrian crossings and road capacity on congestion.&lt;br /&gt;
'''Environmental Researchers:''' To study the impact of traffic optimization on vehicle emissions and air quality.&lt;br /&gt;
&lt;br /&gt;
== Method and simulation environment: ==&lt;br /&gt;
'''Method:''' Multiagent simulation of vehicles and pedestrians navigating an urban grid.&lt;br /&gt;
'''Simulation environment:''' NetLogo&lt;br /&gt;
&lt;br /&gt;
== Variables in the model: ==&lt;br /&gt;
&lt;br /&gt;
'''Deterministic Variables:'''&lt;br /&gt;
  * Traffic Light Timing: Interval and duration of green, yellow, and red lights.&lt;br /&gt;
  * Road Capacity: Maximum number of vehicles that can occupy a road segment.&lt;br /&gt;
  * Pedestrian Crossing Behavior: Frequency of pedestrian crossings and their effect on traffic flow.&lt;br /&gt;
&lt;br /&gt;
'''Random Variables:'''&lt;br /&gt;
  * Vehicle Entry Rate: Randomized rate of vehicles entering the simulation from different entry points.&lt;br /&gt;
  * Driver Behavior: Variability in speed and decision-making among drivers.&lt;br /&gt;
  * Pedestrian Arrival Rate: Randomized arrival of pedestrians at crossings.&lt;br /&gt;
&lt;br /&gt;
== Narrowed Focus: ==&lt;br /&gt;
&lt;br /&gt;
1. '''Traffic Light Optimization:'''&lt;br /&gt;
* The simulation will model the effects of varying traffic light timings (fixed vs. adaptive) on overall traffic flow.&lt;br /&gt;
* Users can adjust light timings to observe changes in congestion and average travel time.&lt;br /&gt;
&lt;br /&gt;
2. '''Impact of Pedestrian Crossings:'''&lt;br /&gt;
* The simulation will include pedestrian crossings that stop vehicle movement. Users can vary crossing frequency and pedestrian density to explore their impact on traffic flow.&lt;br /&gt;
&lt;br /&gt;
3. '''Road Capacity Constraints:'''&lt;br /&gt;
* The simulation will explore how different road capacities (e.g., single-lane vs. multi-lane roads) affect congestion and flow under various traffic loads.&lt;br /&gt;
&lt;br /&gt;
== Data sources: ==&lt;br /&gt;
&lt;br /&gt;
'''Research Articles:'''&lt;br /&gt;
  * [https://doi.org/10.1016/j.cities.2019.03.001 Traffic Congestion and Urban Planning]&lt;br /&gt;
  * [https://doi.org/10.1080/00423114.2019.1571387 Effects of Traffic Signal Timing on Urban Traffic Flow]&lt;br /&gt;
  * [https://doi.org/10.1016/j.trpro.2016.05.003 Pedestrian Impact on Traffic Flow Dynamics]&lt;br /&gt;
[[User:Stej34|Stej34]] ([[User talk:Stej34|talk]]) 19:02, 23 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
: To make the simulation useful and allow verifying its validity, choose a real particular place and simulate the traffic situation there. '''APPROVED''' [[User:Tomáš|Tomáš]] ([[User talk:Tomáš|talk]]) 11:42, 27 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
= Simulation of birds behavior by misd01 =&lt;br /&gt;
&lt;br /&gt;
== What will be simulated: ==&lt;br /&gt;
This model is an attempt to mimic the flocking behavior of birds. The flocks emerge without any leader birds; instead, each bird follows the same set of deterministic rules: alignment, separation, and cohesion. &lt;br /&gt;
# Alignment: A bird turns to fly in the same direction as nearby birds.&lt;br /&gt;
# Separation: A bird moves away from other birds that get too close.&lt;br /&gt;
# Cohesion: A bird moves closer to nearby birds to stay with the group (unless they are too close).&lt;br /&gt;
&lt;br /&gt;
These rules collectively result in the formation, dynamics, and interactions of flocks.&lt;br /&gt;
&lt;br /&gt;
== Goal of the simulation: ==&lt;br /&gt;
To explore and demonstrate how simple, local interactions among individual agents (birds) lead to complex, emergent flocking behaviors without central control. The model aims to study these behaviors for insights into collective animal movement, self-organization, and to inspire applications such as swarm robotics and optimization algorithms.&lt;br /&gt;
&lt;br /&gt;
== Who would use the simulation and how it helps them: ==&lt;br /&gt;
This simulation can benefit:&lt;br /&gt;
&lt;br /&gt;
* Researchers in Biology and Ecology: To understand how flocks form, break apart, and maintain cohesion without leaders.&lt;br /&gt;
* Educators and Students: To illustrate principles of self-organization and emergent behavior in a hands-on, visual way.&lt;br /&gt;
* Robotics Engineers: To design autonomous swarming systems for drones or robots, inspired by natural flocking principles.&lt;br /&gt;
* Animators and Game Designers: To create realistic group behaviors for simulations, movies, or games.&lt;br /&gt;
&lt;br /&gt;
== Method and simulation environment: ==&lt;br /&gt;
'''Method:''' Multiagent simulation&lt;br /&gt;
'''Simulation environment:''' NetLogo&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Variables in the model: ==&lt;br /&gt;
&lt;br /&gt;
'''Deterministic Variables:'''&lt;br /&gt;
* Bird speed: The fixed speed at which birds move.&lt;br /&gt;
* Perception radius: The distance within which birds can detect neighbors.&lt;br /&gt;
* Minimum Separation Distance: The minimum allowable distance between birds before the separation rule is triggered.&lt;br /&gt;
&lt;br /&gt;
'''Random Variables:'''&lt;br /&gt;
* Initial positions: Random starting locations for birds in the environment.&lt;br /&gt;
* Initial headings: Random initial movement directions.&lt;br /&gt;
&lt;br /&gt;
== Agents: ==&lt;br /&gt;
'''Turtles'''&lt;br /&gt;
Represent individual birds.&lt;br /&gt;
Behaviors are governed by three rules. Each of the rules contributes to adjusting the bird's heading. The final heading is a weighted combination of the three rules:&lt;br /&gt;
* Alignment: Each bird (agent) calculates the average heading of nearby birds and adjusts its direction toward that average.&lt;br /&gt;
* Separation: If another bird is too close (distance below a threshold), the bird moves away by calculating a vector opposite to the direction of the neighbor(s).&lt;br /&gt;
* Cohesion: A bird moves toward the center of nearby birds unless another bird is too close (handled by separation).&lt;br /&gt;
If another bird is too close, the separation rule temporarily overrides alignment and cohesion until the minimum separation is achieved.&lt;br /&gt;
&lt;br /&gt;
== Data sources: ==&lt;br /&gt;
&lt;br /&gt;
'''Research Articles:'''&lt;br /&gt;
* [https://cs.stanford.edu/people/eroberts/courses/soco/projects/2008-09/modeling-natural-systems/boids.html Boids: An Artificial Life Program]&lt;br /&gt;
* [https://www.sciencedirect.com/science/article/abs/pii/S0003347224000277 Relationship between flock size and flight initiation distance in birds]&lt;br /&gt;
* [https://medium.com/@adityaananthram/algorithms-in-nature-part-1-e80e80b29719 Algorithms In Nature]&lt;br /&gt;
* [https://www.pnas.org/doi/10.1073/pnas.1118633109 Statistical mechanics for natural flocks of birds]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[User:Misd01|Misd01]] ([[User talk:Misd01|talk]]) 20:41, 27 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
: '''APPROVED''' [[User:Tomáš|Tomáš]] ([[User talk:Tomáš|talk]]) 20:38, 29 December 2024 (CET)&lt;br /&gt;
&lt;br /&gt;
=Simulation concept: Populating the database - tros01=&lt;br /&gt;
==Why?==&lt;br /&gt;
Lets say that I have a database containing prepared activities and educational content for boy scouts group. Its purpose is to serve as a source of inspiration and eventually of collection of high quality content appropriate for kids during our weekly meetings or other occasions. From which source should be easy to get precisely only the desired results based on defined properties on each activity (eg. time needed for preparation, minimal number of players, etc.)&lt;br /&gt;
&lt;br /&gt;
BUT actually its currently more like a proof of concept and not a really operational tool. So accordingly there aren't yet any real records to speak about.&lt;br /&gt;
This very early stage of development is exactly the reason why I think it is reasonable to think about how will the database be populated with data. As this will be crucial for its future usability and success. Therefore, the simulation should focus on modeling this data population process.&lt;br /&gt;
==What?==&lt;br /&gt;
To be precise, the simulation will be concerned with user behavior and related volume of stored records.&lt;br /&gt;
&lt;br /&gt;
It is important to say that user interface for reading is only the default web gui of the database itself (Neo4j), so the users will have to use the Cypher query language. So after they go through such a way to access the records, there better be some decent amount of useful ones in the database. This is because otherwise their whole effort would be pointless and the user would be discouraged from using the database again.&lt;br /&gt;
&lt;br /&gt;
Creating the records on the other hand will be easy and accessible as much as possible (user writes to google document in specified folder and with specified structure which enables then loading it programmaticaly into the database). This ease of creation is key to encouraging consistent contributions.&lt;br /&gt;
&lt;br /&gt;
And here comes the question whether this &amp;quot;natural&amp;quot; way of data population is enough, or rather how long will it take for the database to be able to provide satisfactory results for the user in majority of the cases and as such could be called a useful tool. If the time required would be too long, the users could lose interest of even contributing new content .&lt;br /&gt;
Therefore, the simulation will model the rate of content creation and the subsequent impact on database searchability and usability.&lt;br /&gt;
&lt;br /&gt;
Additionally will be also evaluated the &amp;quot;batch population approach&amp;quot; to see weather it is worth considering to implement. This will involve creating a model of user behavior and content creation, simulating different scenarios, and analyzing the results.&lt;br /&gt;
==Objectives==&lt;br /&gt;
This simulation aims to predict the growth of the database, determine the feasibility of the current data population strategy and evaluate the alternative.&lt;br /&gt;
&lt;br /&gt;
#Predict the time needed to reach a critical mass of data sufficient for effective use.&lt;br /&gt;
#Evaluate the effectiveness of the current data population method relatively to alternative.&lt;br /&gt;
==Users==&lt;br /&gt;
'''Example User:''' me the database developer and admin.&lt;br /&gt;
&lt;br /&gt;
'''How it would help:'''&lt;br /&gt;
*Optimizing Data Population: By simulating different scenarios, I can determine the most efficient way to populate the database with valuable content.&lt;br /&gt;
*Resource Allocation: The results will inform decisions on whether to prioritize developing a batch upload feature or focus on encouraging individual contributions.&lt;br /&gt;
*Setting Expectations: The simulation will provide a realistic timeline for when the database will be sufficiently populated for effective use.&lt;br /&gt;
==Method and environment==&lt;br /&gt;
'''Method:''' Agent-based modeling&lt;br /&gt;
&lt;br /&gt;
'''Env:''' NetLogo because of the class requirements. I would rather like to try (learn to do simulations with) Julia because of its broader usability, but I guess it is what it is.&lt;br /&gt;
==Variables==&lt;br /&gt;
===Deterministic===&lt;br /&gt;
;amount of records in db for each category&lt;br /&gt;
:without the batch upload the initial value is 0&lt;br /&gt;
;number of contributors/agents&lt;br /&gt;
:this will be based on real number of leaders in our group&lt;br /&gt;
;batch upload size&lt;br /&gt;
:values 0, 10, 20, 30, 50, 100 will be tried&lt;br /&gt;
;expected probability of finding useful record by individual agents&lt;br /&gt;
:based on previous experiences of agent with searching the db&lt;br /&gt;
;probability that an agent will try to look up a record&lt;br /&gt;
:will be calculated from a combination of the agent’s past success rate and the current amount of records in db.&lt;br /&gt;
;quality of record&lt;br /&gt;
:number from &amp;lt;1-10&amp;gt;&lt;br /&gt;
;probability of using any of the found records in the upcoming meeting&lt;br /&gt;
:will be calculated from an amount of returned records and their quality&lt;br /&gt;
;probability of creating new record&lt;br /&gt;
:for the sake of simplicity and simulation feasibility the probability will be set to a constant value same for all agents&lt;br /&gt;
;probability of improving a records quality&lt;br /&gt;
:for the sake of simplicity and simulation feasibility the probability will be set to a constant value same for all agents&lt;br /&gt;
===Random===&lt;br /&gt;
;category of recorded/seeked activity&lt;br /&gt;
:category means a certain combination of activity properties ( type{running, creative, thinking, discusion, history}, place{room, forest, city, playground}) &lt;br /&gt;
:the category can combine max 2 types and 1 place&lt;br /&gt;
;initial quality of created records &lt;br /&gt;
:will be drawn from lognormal distribution with mean 3 and std 2&lt;br /&gt;
==Simulation behavior==&lt;br /&gt;
Each tick will represent a single week in real time, because the meeting for which are the activities prepared are realized every week once. Each agent has to prepare some activity for every meeting, so they has a choice to come up with something new or to look for usable activity or at least inspiration in the db. The agents can not use the same activity twice in a year or two.&lt;br /&gt;
&lt;br /&gt;
So in the beginning of each week an agent will pick a random category of an activity which they will prepare for the meeting. &lt;br /&gt;
&lt;br /&gt;
When the agent decides to search the db, they will be given all records currently present in db that match the category they picked. From those will be calculated the probability of using any of the records in the upcoming meeting and then evaluated. If successful, the agent will pick a random one from them (the higher the quality, the higher probability of picking it). After that, there is a chance that the agent will improve the quality of the picked record (in reality it means for example adding a feedback from the kids).&lt;br /&gt;
&lt;br /&gt;
If they are unsuccessful trying to find a suitable activity in the database, or they decide to not search the db at all, they has a chance of recording (with rnd initial quality) the activity that they created or found elsewhere.&lt;br /&gt;
&lt;br /&gt;
The simulation will then run until the majority of searches in the db are successful.&lt;br /&gt;
&lt;br /&gt;
And also the scenario with the initial batch upload will be simulated as well. &lt;br /&gt;
&lt;br /&gt;
[[User:Tros01|Tros01]] ([[User talk:Tros01|talk]]) 00:32, 12 January 2025 (CET)&lt;/div&gt;</summary>
		<author><name>Tros01</name></author>
		
	</entry>
</feed>