Package: kep-solver
kep_solverThis Python package is devoted to various algorithms, procedures and mechanisms
that are useful when studying kidney exchange programmes in general.  It is
written and maintained byWilliam Pettersson.Full documentationPypi linkRequirementskep_solver runs on Python 3.9 or higher. As long as you install via pip, all
other requirements will be handled by pipQuick start with notebooksThis package provides two sample notebooks in thenotebooksfolder. You can
access either of these usingMyBinder.Please note that MyBinder, as a free service, does have limits on its use. For
more intensive use, or where the privacy of the data you use is important, you
can self-install using the following instructions.Quick start self-installCreate a virtual environment for kep_solvermkvirtualenv kep_solverInstall kep_solverpip install kep_solverDownload a sample JSON file fromhttps://kep-web.optimalmatching.com/static/jsons/sample-1.jsonRun the following Python commands# Import the required functionsfromkep_solver.fileioimportread_jsonfromkep_solver.poolimportPoolfromkep_solver.modelimportTransplantCount# Read some inputinstance=read_json("sample-1.json")# Create a transplant pool with one objective.# We will allow cycles to have at most 3 donor/recipient pairs and allow chains# to have have at most 2 donors (i.e., one non-directed donor and one# donor/recipient pair).pool=Pool([TransplantCount()],description="My first KEP Pool",maxCycleLength=3,maxChainLength=2)# Solve our instancesolution,model=pool.solve_single(instance)# Print the solutionforselectedinsolution.selected:print(f"Selected{selected}")Current featuresReading instance files (json and XML formats)Creation of compatibility graphsSolving for the following objectives (single, or hierarchical)Maximise the number of transplantsMaximise the number of backarcsMaximise the number of effective 2-way exchangesMinimise the number of three-cyclesMaximise the score using the UK scoring mechanismsWhile the above objectives are exactly those in use by NHSBT when running the UKLKSS (the UK national KEP), I do intend to add further objectivesExpected usersI see two classes of users of this software:Researchers - Depending on what questions you want answered, you can either test policy changes to determine how they affect the running of a KEP, or you can implement new models or objectives to see how they performHealth care institutes - I have tried to make this software as robust as possible, but for now I cannot guarantee any particular level of performance or any exact optimality of a solution. If you do want to use this software for real-world impact, feel free to get in touch and I may be able to help.DocumentationFull documentation for kep_solver can be found athttps://kep-solver.readthedocs.io/en/latest/.InterfaceThis is just a Python module for now, a web-interface that demonstrates a basic
use case is viewable athttps://kep-web.optimalmatching.com, and
the source code for said website is online athttps://gitlab.com/wpettersson/kep_webFuture plansMore objective functionsRandom instance generationSimulating the development of a KEP over timeSupporting transnational poolsImplementation of faster models and modelling techniquesContributingI welcome input from others, whether you have ideas for improvements or want to
submit code. Details on contributing can be found inCONTRIBUTING.md. You can also get in touch directly, or
raise anissueAcknowledgementsThis software has been supported by the Engineering and Physical Sciences
Research Council (EPSRC) grantEP/T004878/1(Multilayer Algorithmics to Leverage Graph Structure).