KAPSARC's Toolkit for building collective decision making models
Branch: testing
Clone or download
Latest commit b8018b4 Feb 20, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
easyloggingpp Update compiling_elpp.md Aug 8, 2017
examples fixed default chart's size Feb 20, 2019
minicsv Csv streams (#92) Oct 18, 2016
qcustomplot Merging All Features Developed in Testing into Master (#67) Sep 7, 2016
web fixed conflict Feb 20, 2019
.DS_Store Added .zip file for SMP apps on OS X built in the El-Capitan environment May 20, 2018
.gitignore Testing (#25) Jul 17, 2016
.travis.yml Include latest travis edits Oct 11, 2018
KTAB_SMP.zip Add KTAB_SMP v1.3 release archive as .zip file. Jun 12, 2018
KTAB_SMP_Tables.md Update SMP Tables Listing Jul 12, 2017
KTAB_Test_Apps.sh Update KTAB apps test script Jul 12, 2017
KTAB_Test_Apps_Travis.sh Updated Scripts Jun 17, 2017
LICENSE Initial commit Sep 8, 2015
README.md Remove appveyor status badge Jan 15, 2019
_config.yml Update _config.yml Oct 16, 2017
build.sh tweak clean/build scripts Dec 16, 2015
clean.sh Update clean.sh Feb 21, 2016
index.html added a new feature to change actors' colors,and set up google analytics Sep 25, 2018
install-linux-deps.sh Update install-linux-deps.sh Oct 3, 2018
install-osx-deps.sh Include OSX deps Oct 11, 2018
install.sh added stochastic state transitions May 3, 2016
reconfig.sh Build scripts should fail if any of the components fail to build! (#66) Oct 19, 2016
whatsnew.md Update whatsnew.md May 29, 2018


Build Status


KTAB is an open-source toolkit for assembling agent-based models of negotiation and bargaining. The main development site for KTAB is the King Abdullah Center for Petroleum Studies and Research, KAPSARC. Research is distributed at OpenKAPSARC and the main page for KTAB information is here.

All KTAB models represent stochastic decision-making among comparatively small numbers of stakeholder groups (roughly 5 to 50), within the paradigm of "Probabilistic Condorcet Elections". PCEs are used to estimate the likelihood of different outcomes from a collective decision making process, depending on what kinds of options each agent has or can generate, how they value those options, and what kinds of coalitions they can form to support or oppose each option. Details can be found in the online documentation as well as the main KTAB page.


Examples are provided to illustrate the range of modeling which can be done in the framework and to provide templates for further work. Examples in the kmodel directory include the following:

  • Using an input/output economic model to bargain over tax/subsidy rates,

  • Simple discrete matching

  • Negotiating the priority order to tasks to undertake (and which to drop)

  • A simple but highly parameterizable version of the spatial model of politics. The command line version is smpc; the GUI version is KTAB_SMP. Dummy data is provided to illustrate the format for both CSV and XML input files.

  • A simple model of bargaining over the order in which projects should be addressed, taking into account budget limits. Dummy data is provided.

  • A simple example of using KTAB to fit parameters. Similar to econometric models, the parameters of a PCE are adjusted until the result closely matches the expected results. The fitted parameters could then be used to analyze possible changes.

These are merely illustrative examples. For rigorous work, one could make whatever local modifications were needed to produce a model which met one's own standards for validation.

Building KTAB

KTAB is written in portable, cross-platform C++11.

KTAB uses CMake for configuration; downloads and instructions can be obtained from www.cmake.org. The basic procedure is to configure kutils with CMake, then build the library and examples with your favorite IDE. Then configure kmodel with CMake and build it. Detailed build instructions can be found in the subdirectories, starting with kutils' README. After building kutils, you can follow kmodel's README. Following these instructions, under both Windows and Linux, it is not necessary to modify your PATH at any point of the installation.

Example of how to build models outside the main library structure, as one would do for a custom model, are in the examples directories; see the overall README and the README files for each.

The code is compiled, linked, and tested with absolutely no modification, simultaneously on both Windows and Linux: there is one single body of cross-platform code, not separate versions for each OS. All platform- or system-specific configuration is done by CMake. Because no platform-specific code is allowed, porting to Mac or other platforms should be feasible. It was developed and tested on 64-bit Windows and Linux platforms, including the following:

  • Windows
    • Windows 7 Professional with Visual Studio 2010 Express,
    • Windows 7 Professional with Visual Studio 2013, Update 5,
    • Windows 8 & 10 Professional with Visual Studio 2015 Community,
    • Windows Server 2012 with Visual Studio 2015 Community,
  • Linux
    • Fedora 22 with gcc/g++ 5.1,
    • openSUSE 13.2 with clang/clang++ 3.5,
    • Debian 8.1 with gcc/g++ 4.9,
    • Ubuntu 14.04 & 16.04 with gcc/g++ 5.4.

Language Versions

The C++11 standard is supported by the following versions of these common compilers:

  • GCC 4.9.0, or higher
  • Clang 3.5.0, or higher
  • Visual Studio 2013, or higher

We expect to upgrade to C++17 when it becomes well-supported by gcc, clang, and VS, especially structured bindings, aka parallel assignment with pattern matching.

User Interfaces

A graphical front-end is under continual development. The current GUI version of the SMP, KTAB_SMP, has been developed in Qt. Qt is dual-licensed under both commercial and open-source terms; details can be found here. The Qt licensing page states that dynamically linking an application to the open-source Qt libraries does not make the application open-source.

Previous work toward a graphical front-end was based on the FLTK project (http://www.fltk.org) FLTK. FLTK is a cross-platform, C++ tookit provided under the terms of the GNU Library Public License, Version 2 with exceptions that allow for static linking; details can be found here. The source code and build instructions for the most recent stable version can be obtained here. FLTK also uses CMake for configuration, then your favorite IDE to build.

Because the libraries that analyze negotiation are completely separate from the applications that use them, developers are perfectly free to write command line applications or use other GUI toolkits. Along these lines, the GUI work is expected to diversify into other toolkits, such as WxWidgets, or even a web interface such as Wt.

We have also included a python script to demonstrate how to use the python to execute the SMP model using a shared library. We anticipate adding a similar sample script for Java at a later date.

For authoritative ruling on licensing issues, consult appropriate counsel.

Data Input Formats

To read and write XML data files, KTAB uses the TinyXML2 library, which is available on GitHub. When configuring TinyXML2 with cmake, be sure to use the DBUILD_SHARED_LIBS:BOOL=OFF -DBUILD_STATIC_LIBS:BOOL=ON -DCMAKE_CXX_FLAGS=-fPIC flags.

Contributing and License Information

If you are interested in contributing code, ideas, or data to KTAB, please contact ktab@kapsarc.org

KTAB is released under The MIT License (Expat). For details, see the following URLs:

Copyright KAPSARC. Open source MIT License.

<script> (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-51793176-2', 'auto'); ga('send', 'pageview'); </script>