{"id":19832055,"url":"https://github.com/kendrickorg/jkendrick","last_synced_at":"2026-05-11T01:16:35.364Z","repository":{"id":44826873,"uuid":"462476740","full_name":"KendrickOrg/JKendrick","owner":"KendrickOrg","description":null,"archived":false,"fork":false,"pushed_at":"2023-10-28T17:06:30.000Z","size":254,"stargazers_count":0,"open_issues_count":8,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-11T10:19:40.564Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KendrickOrg.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2022-02-22T21:14:28.000Z","updated_at":"2023-10-05T14:46:07.000Z","dependencies_parsed_at":"2023-01-20T00:32:14.542Z","dependency_job_id":"7be13588-7bbd-41c7-9cb8-702c80acdaef","html_url":"https://github.com/KendrickOrg/JKendrick","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KendrickOrg%2FJKendrick","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KendrickOrg%2FJKendrick/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KendrickOrg%2FJKendrick/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KendrickOrg%2FJKendrick/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KendrickOrg","download_url":"https://codeload.github.com/KendrickOrg/JKendrick/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241191626,"owners_count":19925302,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-12T11:36:13.375Z","updated_at":"2026-05-11T01:16:35.329Z","avatar_url":"https://github.com/KendrickOrg.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JKendrick\n\n## How to install\n\n### Importing in Eclipse works well using \n\nImport\\Git\\Project from git (using smart import)\n\nObviously dependencies need to be installed and since this is not a Maven or Ant project it must be checked what Eclipse installs.\n\n### Dependencies \n\n#### Apache Commons RungeKuttaIntegrator\n\nApache's implementation of RK4 is used: org.apache.commons.math3.ode.nonstiff.RungeKuttaIntegrator\n\nTo add Apache commons to an Eclipse project: \n\u003ehttps://docs.blackberry.com/en/development-tools/blackberry-web-services-for-blackberry-uem/12_10/java-development-guide/bma1439578367525/bma1439578368853\n\nTo use RungeKuttaIntegrator and other solvers from Apache Commons: \n\u003e[https://commons.apache.org/proper/commons-math/userguide/ode.html](https://commons.apache.org/proper/commons-math/userguide/ode.html)\n\n\u003e\"The user should describe his problem in his own classes which should implement the FirstOrderDifferentialEquations interface.\n Then they should pass it to the integrator they prefer among all the classes that implement the FirstOrderIntegrator interface.\"\n \nSo in the very first example SIR_ODE implements FirstOrderDifferentialEquations.\n\nThe SIR_ODE.getDimension method return the size of the array holding the cardinality of each compartment.\nSo for this simple SIR example it is 3 because the compartments are  S, I and R with as many differential equations for dS/dt dI/dt and dR/dt.\n\n#### XChart\n\u003e [https://github.com/knowm/XChart](https://github.com/knowm/XChart#getting-started)\n\nIt is not mandatory to create a Maven project to use XChart\n\n### Importing JKendrick in Eclipse\nCheck that you have correctly configured Git by following this procedure \n\u003e [https://eclipsesource.com/blogs/tutorials/egit-tutorial/](https://eclipsesource.com/blogs/tutorials/egit-tutorial/)\n\nThen, follow this step\n\n\u003e Import\\Git\\Project from git (using smart import)\n\n## Writing models\n### Mass-action vs standard incidence\nBoth kinds of incidence are only equivalent if N is fixed. Their assumptions are different which matter when the population gets large.\n\n#### Mass-Action incidence \nMass action  assumes transmission is unbounded when the number of infected people grows.\n\ndS/dt = - beta IS \n\nCaveat: beta typically has to be changed when N is changed.\n\n#### Standard incidence\nStandard incidence assumes transmisson depends on the number of contacts with infected individuals and is bounded when N grows.\n\ndS/dt = - beta/N IS\n\nNote that bata/N is automatically adapted when N changes.\n### Porportions vs Cardinalities\nSome modes rely on propotions instead of cardinalities. For the sake of condistency it is assumed, in JKendrick, that they are reformulated in terms of quotients of cardinalities\n\nFor instance the SIR example below has these values \n\nInitial_Susceptibles\n\t\t\t0.999999\n   \nInitial_Infecteds\n\t\t\t0.000001\n\nThis is reformulated as\n\nN = 1 000 000\n\nS = 999 999\n\nI = 1\n\nand implicitly\n\nR = 0\n\nSTATUS : not yet enforced ^^\n\n\n## Simulating models\n\nWe use RK4 for deterministic simulations and Gillespie's Direct Method and Tau leap dor stochastic ones.\n\nFor stochastic models, following the Keeling book Section 4.1.1 we assume that \"in small time period the number of events that occur is Poisson distributed\". \n\n### Transition rates matrix\nThe transition rates matrix is composed of the functional transitions rates between compartments.\nA transition is set by giving the compartment from which the transition starts, the compartment toward which it ends, and the rate at which the transition occurs.\nEach concern has it’s own transition rates matrix. \n\nWhen concerns are merged into a scenario, a new transition rates matrix is created using the tensor sum of the concern’s matrices. (Not yet implemented)\n\nEach not null transition of the matrix is considered as a possible event for stochastic simulations.\nFor deterministic simulations, the equations are generated using the transition rates matrix.\n\n### Naming compartments\nEach concern has a name and compartments names.\nWhen concerns are merged in a scenario, new compartment names are created this way : concern1Name:compartemntName_concern2Name:compartmentName_(...)concernNName:compartmentName_\nIt's composed of attributes, themselves composed of the first concern name, then \":\", then the first compartment name of the first concern, and then \"_\". There are as many attributes by names than there are concerns by scenario.\n\nHere is an example with 2 concerns : a first one with the name \"status\" and the compartments \"S\",\"I\",\"R\", and a second one with the name \"species\" and the compartments \"human\",\"bird\".\nThe names used in the scenario would be :\n\n\tstatus:S_species:human_\n\t\n\tstatus:S_species:bird_\n\t\n\tstatus:I_species:human_\n\t\n\tstatus:I_species:bird_\n\t\n\tstatus:R_species:human_\n\t\n\tstatus:R_species:bird_\n\t\nThe attributes of a concern name are stored in a map, so the order of attributes doesn't matter. \nstatus:S_species:human_ is equivalent to species:human_status:S_\n\n### Solvers\n#### Deterministics solvers\n##### RK4 solver\nThis solver uses ordinary differential equations generated via the scenario transition rate matrix. It uses the Runge-Katta method.\n\n#### Stochastics solvers\nThese solvers run multiple times and then return the median path.\n##### Gillespie solver\nThis solver has a randomized time step, depending on the rate at which any event may occur. Then, an event is randomly selected in the list of possible events, using a roulette wheel taking in consideration the rate of each event.\n##### Tau-leap solver\nFor each time step, this solver generate a random number of occurrences of each event, following a Poisson distribution around (the step size*the rate of the event).\n\n### Simulation procedure\nHere are the steps needed for a simulation :\n\n\t- Define concerns, with a concern name, compartments and parameters that would be useful to get transition rates.\n\t\n\t- For each concern, define every transition possible between compartments, with origin compartment, destination compartment and rate.\n\t\n\t- Define a scenario with the list of your concerns.\n\t\n\t- In this scenario, define value for every parameter (including population of every compartment).\n\t\n\t- Define a model with the scenario, the size of a time step, the time of the last step and the number of iterations if you want a stochastic simulation.\n\t\n\t- Define a solver with this model.\n\t\n\t- Define a simulation with the solver, a visualization tool and a title.\n\t\n\t- Run the simulation.\n\n## Visualizing results\n\n### Using XChart\nAs mentionned above, the results are currently displayed using **XChart**.\nMore precisely, the jKendrick.IHM package currently holds 2 kinds of classes : Main classes with a proper main method running a full example and the Visualization class with two methods : **getChart** *which should probably be static* and *xchartExample* is a simple one to play with XChart.\nBoth methods rely on XYChart.\n\nVisialization displays the results of a simulation using this method of the ISolver interface\ndouble[][][] getResult()\nin which the leftmost dimension is the **number of cycles**, the middle one is the **number of steps** and the rightmost one is the **number of compartments**.\n\n## Examples from Keeling and Rohani\n\n### SIR\nThe example is adapted from  [https://homepages.warwick.ac.uk/~masfz/ModelingInfectiousDiseases/Chapter2/Program_2.1/index.html](https://homepages.warwick.ac.uk/~masfz/ModelingInfectiousDiseases/Chapter2/Program_2.1/index.html).\n\n#### The (Pharo) Kendrick version\nhttps://github.com/KendrickOrg/kendrick/wiki/Basic-SIR-(Benchmark-Model-1)\nhttps://github.com/KendrickOrg/kendrick/blob/ba11051d2c8976bb27a12da0e3e51650cee99e51/src/Kendrick-Examples/KEDeterministicExamples.class.st#L1183\n![SIR Model with Pharo code](https://github.com/YvanGuifo/PhdThesisYvanGuifo_2019-2022/blob/master/notes-lectures/Images%20de%20document%20de%20note%20de%20lecture/Images/SIRModelPharoCode.png)\n\n#### Visualization \n![SIR Model with Java code](https://github.com/YvanGuifo/PhdThesisYvanGuifo_2019-2022/blob/master/notes-lectures/Images%20de%20document%20de%20note%20de%20lecture/Images/SIRModelJavaCode.png)\n\n### SIS\n\nWe use mass action for this model and simulate it using RK4 and Gillespie's Direct Method.\n\n#### SEIR\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkendrickorg%2Fjkendrick","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkendrickorg%2Fjkendrick","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkendrickorg%2Fjkendrick/lists"}