Extensibility

Morgan Grant edited this page Sep 19, 2017 · 2 revisions

Table of Contents

Extensibility - Arbitrary Payoff Functions and Display Environments

This page outlines how ConG may be extended for use in experiments not possible via the configuration file alone. If you are interested in using ConG for your own experiment, we suggest reading below, and start with one of the extensibility examples we've prepared below.

Code from Example Experiments:

If you are interested in using ConG to implement your own experiment, but don't have the programming skills needed to extend ConG, we suggest hiring a programmer with the following skills and/or experience.

Java Programming Experience Required to Extend ConG


Although many important games in experimental economics can be easily configured and tweaked via ConG's configuration files – allowing an experimenter to implement many games without any programming experience – the software may also be extended to new payoff functions and novel visual environments. ConG's source code is modular and open-ended, so experimenters with some java programming experience can create features that we have never imagined. Allowing researchers can design and run new visually-intensive and/or continuous games without having to bear heavy development costs.

Advantages of Extensibility

- Just to note, before ConG's extensibility feature, if an experimenter wanted to use ConG to create a novel experiment not implementable via existing configuration file options, then they'd have to download the ConG source code, become familiar with the scores of java files that comprise the source code and how they work with one another, and edit/create the payoff functions and display files required to create the desired game. Not to mention being tedious and prone to bugs, this process would, in effect, create a new version of ConG with each extension (one that has the new payoff function and/or drawing instructions). Now, experimenters simply create the single .java that defines the payoff function and display, without needing to edit ConG's source code.

Java Interface

ConG uses an interface named the PayoffScriptInterface. We use an interface to ensure consistency in the extensibility on ConG. Every experiment that implements the PayoffScriptInterface must contain the methods getPayoff, getMin, getMax, and draw. Additional methods may be added, but those four methods are the base essentials to constructing an experiment.

 
 public static interface PayoffScriptInterface {
        public float getPayoff(int id, float percent, Map<Integer, float[]> popStrategies, Map<Integer, float[]> matchPopStrategies, Config config);
        public float getMin();
        public float getMax();
        public void draw(Client a);
 }

Diagram

If you think of a ConG experiment as a pipeline of updates - as subjects select actions, as these actions are organized into the current game state, as the current game state is: (1) mapped into a floating point number by the payoff function, and (2) as converted into a display environment seen by subjects by the draw function, and all this is sent to the ConG server for logging - then the ConG extensibility feature can be thought of as making modular the payoff and draw functions. Subject to specific syntax set by PayoffScriptInterface, experimenters may insert a new payoff function and/or display of their design.

Group Strategies

Group strategies are essentially a hash map which contains all of the subjects in the experiment. The number of strategies that each subject has may be defined in the config file. An example of the usage of strategies is, for example, in Hotelling. A single strategy would be useful for an experiment done on a single axis. Two strategies would be better for a Hotelling experiment done on two axes as that would give each subject an x and y location.

Payoff Function

The payoff function maps the current game state into a single floating point number for each player, reflecting that player's current flow payoff.

Draw Function

Group strategies get piped into the draw function, creating what subjects see during the experiment. Each frame (ConG can refresh up to sixty times a seconds) the draw function takes the current game state, (current & previous actions, payoffs, time, etc.) and converts it into the display environment.

Configuration File

All ConG experiments require a configuration file to be loaded at initiation of the experiment session. This .csv file consists of various parameters for use by the program, fully characterizing the session to be run period by period (and when desired, subject by subject).

If an experimenter wants to plug-in a payoff function and display that they designed, the configuration file will need to have a reference to it via the "payoffFunction" and "source" columns. The figure below is a configuration file that uses a plug-in called "ArbPayFunc.java". This java file will need to be placed in the same folder as the Control.jar and Client.jar files. For all periods that use this payoff function and script file, ConG will refer to the ArbPayFunc.java file.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.