Wiki

Clone wiki

ExperimentTool / C1 Payoff Calculation

  • Please refer to edu.kit.exp.server.gui.mainframe.PayoffDialog class.

  • In your experiments, you can set the subject’s payoff using

             Subject subject = new Subject();
             subject.setPayoff(new Double (5.0));
  • Update the Payoff variable for each iteration of your experiment:
           subject.setPayoff(new Double(subject.getPayoff() + 5.0 );
  • From the UI, the following method is invoked for each client when "Calculate Payoff" is clicked, and the conversion factor is entered:
            public void calc() {
                   List<Subject> list = null;
             try {
                    list = guiController.getSubjects();
             } catch (DataInputException e) {
                    JOptionPane.showMessageDialog(MainFrame.getInstance(), e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
             } catch (StructureManagementException e) {
                    JOptionPane.showMessageDialog(MainFrame.getInstance(), e.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
             }

             for (Subject subject : list) {
                    String line = "";
                    Double fac = Double.valueOf(textFieldFactor.getText());
                    Double payOff = subject.getPayoff();
                    Double product = payOff * fac;
                    line += subject.getIdClient() + ", (" + payOff + ") : " + product.toString() + " Euro" + System.lineSeparator();
                    textArea.append(line);

             }

       }
  • Hence each individual's payoff can be obtained from the Institution, possibly in the endPeriod() method. Iterate through the subject list to obtain the Payoff.
  • Please alter the above method, in case you would like to have more detailed logic for the Payoff calculation.

Updated