virtualcommons-svn Mailing List for Virtual Commons Experiment Software (Page 50)
Status: Beta
Brought to you by:
alllee
You can subscribe to this list here.
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
(21) |
Aug
(31) |
Sep
(6) |
Oct
(15) |
Nov
(2) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2009 |
Jan
(4) |
Feb
(6) |
Mar
(12) |
Apr
(52) |
May
(14) |
Jun
(19) |
Jul
(81) |
Aug
(115) |
Sep
(36) |
Oct
(88) |
Nov
(46) |
Dec
(58) |
2010 |
Jan
(52) |
Feb
(55) |
Mar
(48) |
Apr
(15) |
May
(5) |
Jun
(38) |
Jul
(27) |
Aug
(24) |
Sep
(28) |
Oct
(1) |
Nov
(2) |
Dec
(29) |
2011 |
Jan
(87) |
Feb
(39) |
Mar
(63) |
Apr
(42) |
May
(26) |
Jun
(53) |
Jul
(23) |
Aug
(43) |
Sep
(37) |
Oct
(25) |
Nov
(4) |
Dec
(7) |
2012 |
Jan
(73) |
Feb
(79) |
Mar
(62) |
Apr
(28) |
May
(12) |
Jun
(2) |
Jul
(9) |
Aug
(1) |
Sep
(8) |
Oct
|
Nov
(3) |
Dec
(3) |
2013 |
Jan
(8) |
Feb
(16) |
Mar
(38) |
Apr
(74) |
May
(62) |
Jun
(15) |
Jul
(49) |
Aug
(19) |
Sep
(9) |
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
(2) |
May
(25) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <al...@us...> - 2010-03-29 20:10:55
|
Revision: 497 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=497&view=rev Author: alllee Date: 2010-03-29 20:10:49 +0000 (Mon, 29 Mar 2010) Log Message: ----------- - adding persistable quiz response event (slight duplication with irrigation experiments, should consider moving it up into the csidex framework) - added logic to persist enforcement ranking requests. round initialization now occurs before we block on a quiz signal or the round signal, which should allow us to persist any quiz response events, chat events, etc - added round started and ended marker events to the persistable event stream - TODO: fix EnforcementRanking and SanctionRanking logic duplication Modified Paths: -------------- foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ChatPanel.java foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java foraging/trunk/src/main/java/edu/asu/commons/foraging/event/RoundStartedEvent.java foraging/trunk/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java foraging/trunk/src/main/java/edu/asu/commons/foraging/util/ForagingSaveFileConverter.java Added Paths: ----------- foraging/trunk/src/main/java/edu/asu/commons/foraging/event/QuizResponseEvent.java Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ChatPanel.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ChatPanel.java 2010-03-29 19:20:08 UTC (rev 496) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ChatPanel.java 2010-03-29 20:10:49 UTC (rev 497) @@ -59,9 +59,10 @@ this.clientId = client.getId(); client.getEventChannel().add(this, new EventTypeProcessor<ChatEvent>(ChatEvent.class) { public void handle(final ChatEvent chatEvent) { - displayMessage(getChatHandle(chatEvent.getSource()) + " -> " - // FIXME: either "all" or "you". - + getChatHandle(chatEvent.getTarget()), chatEvent.toString()); + displayMessage(getChatHandle(chatEvent.getSource()) +// FIXME: either "all" or "you". +// + " -> " + getChatHandle(chatEvent.getTarget()) + ,chatEvent.toString()); } }); } @@ -117,8 +118,9 @@ return; } client.transmit(new ChatRequest(clientId, message, targetIdentifier)); - displayMessage(getChatHandle(clientId) + " -> " - + getChatHandle(targetIdentifier), message); + displayMessage(getChatHandle(clientId) +// + " -> " + getChatHandle(targetIdentifier) + , message); chatField.requestFocusInWindow(); chatField.setText(""); } Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java 2010-03-29 19:20:08 UTC (rev 496) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java 2010-03-29 20:10:49 UTC (rev 497) @@ -18,9 +18,9 @@ import java.awt.event.MouseEvent; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Iterator; -import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Properties; @@ -52,6 +52,7 @@ import edu.asu.commons.foraging.event.EnforcementRankingRequest; import edu.asu.commons.foraging.event.PostRoundSanctionUpdateEvent; import edu.asu.commons.foraging.event.QuizCompletedEvent; +import edu.asu.commons.foraging.event.QuizResponseEvent; import edu.asu.commons.foraging.event.RealTimeSanctionRequest; import edu.asu.commons.foraging.event.ResetTokenDistributionRequest; import edu.asu.commons.foraging.event.SubmitRegulationRequest; @@ -196,8 +197,6 @@ List<String> incorrectAnswers = new ArrayList<String>(); List<String> correctAnswers = new ArrayList<String>(); - // FIXME: always send a quiz response event. - // iterate through expected answers for (Map.Entry<String, String> entry : configuration.getQuizAnswers().entrySet()) { String questionNumber = entry.getKey(); @@ -211,6 +210,9 @@ correctAnswers.add(questionNumber); } } + + client.transmit(new QuizResponseEvent(client.getId(), actualAnswers, incorrectAnswers)); + if (incorrectAnswers.isEmpty()) { // notify the server and also notify the participant. StringBuilder builder = new StringBuilder(configuration.getInstructions()); Added: foraging/trunk/src/main/java/edu/asu/commons/foraging/event/QuizResponseEvent.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/event/QuizResponseEvent.java (rev 0) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/event/QuizResponseEvent.java 2010-03-29 20:10:49 UTC (rev 497) @@ -0,0 +1,44 @@ +package edu.asu.commons.foraging.event; + +import java.util.List; +import java.util.Properties; + +import edu.asu.commons.event.AbstractPersistableEvent; +import edu.asu.commons.event.ClientRequest; +import edu.asu.commons.net.Identifier; + +/** + * $Id: QuizResponseEvent.java 461 2010-02-05 00:28:28Z alllee $ + * + * A client's quiz responses for a given quiz page. + * + * + * @author <a href='mailto:All...@as...'>Allen Lee</a> + * @version $Rev: 461 $ + */ +public class QuizResponseEvent extends AbstractPersistableEvent implements ClientRequest { + + private static final long serialVersionUID = -7081410122722056083L; + + private Properties responses; + + private List<String> incorrectAnswers; + + public QuizResponseEvent(Identifier id, Properties responses, List<String> incorrectAnswers) { + super(id); + this.responses = responses; + this.incorrectAnswers = incorrectAnswers; + } + + public Properties getResponses() { + return responses; + } + + public List<String> getIncorrectAnswers() { + return incorrectAnswers; + } + + public String toString() { + return id + " quiz page response: " + responses + "\n\t incorrect: " + incorrectAnswers; + } +} Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/event/RoundStartedEvent.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/event/RoundStartedEvent.java 2010-03-29 19:20:08 UTC (rev 496) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/event/RoundStartedEvent.java 2010-03-29 20:10:49 UTC (rev 497) @@ -17,7 +17,7 @@ * accordingly. * * - * @author <a href='al...@cs...'>Allen Lee</a> + * @author <a href='mailto:all...@as...'>Allen Lee</a> * @version $Revision$ */ public class RoundStartedEvent extends AbstractEvent implements ExperimentUpdateEvent { Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java 2010-03-29 19:20:08 UTC (rev 496) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java 2010-03-29 20:10:49 UTC (rev 497) @@ -79,11 +79,7 @@ public GroupDataModel(ServerDataModel serverDataModel) { this(serverDataModel, nextGroupId++); } - - public GroupDataModel(ServerDataModel serverDataModel, int groupId) { - this(serverDataModel, (long) groupId); - } - + public GroupDataModel(ServerDataModel serverDataModel, long groupId) { this.serverDataModel = serverDataModel; this.groupId = groupId; @@ -703,6 +699,10 @@ return addedResources; } + public long getGroupId() { + return groupId; + } + public String toString() { return "Group #" + groupId; } Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java 2010-03-29 19:20:08 UTC (rev 496) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ServerDataModel.java 2010-03-29 20:10:49 UTC (rev 497) @@ -4,7 +4,9 @@ import java.awt.Point; import java.io.IOException; import java.io.ObjectInputStream; +import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.Iterator; import java.util.LinkedHashSet; @@ -238,6 +240,12 @@ groups.addAll(clientsToGroups.values()); return groups; } + + public List<GroupDataModel> getOrderedGroups() { + ArrayList<GroupDataModel> groups = new ArrayList<GroupDataModel>(clientsToGroups.values()); + Collections.sort(groups); + return groups; + } protected ClientData getClientData(Identifier id) { return getGroup(id).getClientData(id); Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java 2010-03-29 19:20:08 UTC (rev 496) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java 2010-03-29 20:10:49 UTC (rev 497) @@ -3,6 +3,7 @@ import java.io.BufferedReader; import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; @@ -20,6 +21,8 @@ import edu.asu.commons.event.EndRoundRequest; import edu.asu.commons.event.EventTypeProcessor; import edu.asu.commons.event.FacilitatorRegistrationRequest; +import edu.asu.commons.event.RoundEndedMarkerEvent; +import edu.asu.commons.event.RoundStartedMarkerEvent; import edu.asu.commons.event.SetConfigurationEvent; import edu.asu.commons.experiment.AbstractExperiment; import edu.asu.commons.experiment.StateMachine; @@ -45,6 +48,7 @@ import edu.asu.commons.foraging.event.PostRoundSanctionRequest; import edu.asu.commons.foraging.event.PostRoundSanctionUpdateEvent; import edu.asu.commons.foraging.event.QuizCompletedEvent; +import edu.asu.commons.foraging.event.QuizResponseEvent; import edu.asu.commons.foraging.event.RealTimeSanctionRequest; import edu.asu.commons.foraging.event.RegulationRankingRequest; import edu.asu.commons.foraging.event.RegulationSubmissionUpdateEvent; @@ -270,18 +274,29 @@ } }); - // FIXME: start new implementation here. addEventProcessor(new EventTypeProcessor<EnforcementRankingRequest>(EnforcementRankingRequest.class) { public void handle(final EnforcementRankingRequest request) { - logger.info("received enforcement ranking request: " + request.getRankings()); + logger.info("received enforcement ranking request: " + Arrays.asList(request.getRankings())); GroupDataModel group = serverDataModel.getGroup(request.getId()); group.submitEnforcementRanking(request); if (group.hasReceivedAllEnforcementRankings()) { sendEnforcementUpdate(group); } + // FIXME: this is duplicated. + group.submitSanctionRanking(request); + if (group.hasReceivedAllSanctionRankings()) { + sendSanctionRankingUpdate(group); + } } }); + addEventProcessor(new EventTypeProcessor<QuizResponseEvent>(QuizResponseEvent.class) { + public void handle(final QuizResponseEvent event) { + // XXX: can get rid of this event processor once we verify that the persister is storing it properly + logger.info("Received quiz response: " + event); + } + }); + addEventProcessor(new EventTypeProcessor<RegulationRankingRequest>(RegulationRankingRequest.class) { public void handle(final RegulationRankingRequest request) { GroupDataModel group = serverDataModel.getGroup(request.getId()); @@ -292,16 +307,6 @@ } }); - addEventProcessor(new EventTypeProcessor<EnforcementRankingRequest>(EnforcementRankingRequest.class) { - public void handle(final EnforcementRankingRequest request) { - GroupDataModel group = serverDataModel.getGroup(request.getId()); - group.submitSanctionRanking(request); - if (group.hasReceivedAllSanctionRankings()) { - sendSanctionRankingUpdate(group); - } - } - }); - addEventProcessor(new EventTypeProcessor<SubmitRegulationRequest>(SubmitRegulationRequest.class) { public void handle(final SubmitRegulationRequest request) { GroupDataModel group = serverDataModel.getGroup(request.getId()); @@ -656,6 +661,7 @@ } } }); + // FIXME: what is the point of this? addEventProcessor(new EventTypeProcessor<TreatmentTypeRequest>(TreatmentTypeRequest.class) { public void handle(TreatmentTypeRequest event) { // FIXME: assign groups? @@ -771,16 +777,17 @@ Utils.sleep(SERVER_SLEEP_INTERVAL); break; case WAITING: - getLogger().info("Waiting for facilitator signal to start next round."); + // initialize the round so that + // the persister is set up for this next round. + initializeRound(); + getLogger().info("Round is initialized: now waiting for facilitator signal to start next round."); if (getCurrentRoundConfiguration().isQuizEnabled()) { getLogger().info("Waiting for all quizzes to be submitted."); Utils.waitOn(quizSignal); } - // new code - System.out.println("Going to send the RoundStarted Event"); + // then wait for the signal from the facilitator to actually start the round (a chat session might occur or a voting session). Utils.waitOn(roundSignal); - // initialize the start of a new round. - initializeRound(); + // actually start the round once we receive the facilitator signal. startRound(); break; default: @@ -866,6 +873,7 @@ private void stopRound() { serverState = ServerState.WAITING; + persister.store(new RoundEndedMarkerEvent()); sendEndRoundEvents(); if (getCurrentRoundConfiguration().isPostRoundSanctioningEnabled()) { // stop most of the round but don't persist/cleanup yet. @@ -978,7 +986,6 @@ // set up the resource dispenser, generates the initial resource distributions for the // groups, must be done after creating the client group relationships. resourceDispenser.initialize(); - } private void startRound() { @@ -990,7 +997,7 @@ System.out.println("Sending the round started event"); transmit(new RoundStartedEvent(id, data.getGroupDataModel())); } - + persister.store(new RoundStartedMarkerEvent()); // start timers currentRoundDuration = roundConfiguration.getRoundDuration(); if (roundConfiguration.isVotingAndRegulationEnabled()) { Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/util/ForagingSaveFileConverter.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/util/ForagingSaveFileConverter.java 2010-03-29 19:20:08 UTC (rev 496) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/util/ForagingSaveFileConverter.java 2010-03-29 20:10:49 UTC (rev 497) @@ -254,7 +254,8 @@ Map<Identifier, ClientSpatialDistribution> clientSpatialDistributionMap) { ArrayList<GroupDataModel> groups = new ArrayList<GroupDataModel>(serverDataModel.getGroups()); for (GroupDataModel group: groups) { - String groupLabel = "Group #" + groups.indexOf(group); +// String groupLabel = "Group #" + groups.indexOf(group); + String groupLabel = group.toString(); writer.println("Identifier, Group, # tokens, row stdev, column stdev"); double groupWeightedSpatialMetric = 0.0d; int totalTokens = 0; @@ -314,7 +315,8 @@ Map<Identifier, ClientSpatialDistribution> clientSpatialDistributionMap) { ArrayList<GroupDataModel> groups = new ArrayList<GroupDataModel>(serverDataModel.getGroups()); for (GroupDataModel group: groups) { - String groupLabel = "Group # " + groups.indexOf(group); +// String groupLabel = "Group # " + groups.indexOf(group); + String groupLabel = group.toString(); writer.println("Time, Identifier, Group, # tokens, row stdev, column stdev"); double groupWeightedSpatialMetric = 0.0d; int totalTokens = 0; @@ -409,7 +411,7 @@ } writer.println( String.format("%s, %s, %s, %s", - "Group #" + groups.indexOf(group), + group, Utils.join(',', clientTokens), group.getResourceDistributionSize(), totalConsumedGroupTokens, @@ -447,7 +449,7 @@ for (GroupDataModel group: groups) { SortedSet<ChatRequest> chatRequests = chatRequestMap.get(group); if (chatRequests != null) { - writer.println("Group #" + groups.indexOf(group)); + writer.println(group.toString()); for (ChatRequest request: chatRequests) { writer.println(String.format("%s: %s (%s)", request.getSource(), request.toString(), (request.getCreationTime() - first.getCreationTime())/1000L)); } @@ -498,7 +500,7 @@ String line = String.format("%s, %s, %d, %d, %s, %s", savedRoundData.toSecondString(event), clientData.getId(), - groups.indexOf(group), + group.getGroupId(), client.moves, movementEvent.getDirection(), "movement event" @@ -517,7 +519,7 @@ clientData.getId(), location.x, location.y, - groups.indexOf(group), + group.getGroupId(), client.tokens, "token collected event"); writer.println(line); @@ -734,6 +736,7 @@ String groupNumber = "Group-" + groupIndex; // tokenProbabilityGroupNumberHeader.add(groupNumber + " avg token P"); // tokensLeftGroupNumberHeader.add(groupNumber + " tokens left"); + List<Identifier> ids = new ArrayList<Identifier>(groups.get(groupIndex).getOrderedClientIdentifiers()); for (int i = 0; i < ids.size(); i++) { Identifier id = ids.get(i); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2010-03-29 19:20:14
|
Revision: 496 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=496&view=rev Author: alllee Date: 2010-03-29 19:20:08 +0000 (Mon, 29 Mar 2010) Log Message: ----------- renaming voting-fov to voting-limitedvision Added Paths: ----------- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-limitedvision/ Removed Paths: ------------- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/ foraging/trunk/src/main/resources/configuration/round0.xml foraging/trunk/src/main/resources/configuration/round1.xml foraging/trunk/src/main/resources/configuration/round2.xml foraging/trunk/src/main/resources/configuration/round3.xml foraging/trunk/src/main/resources/configuration/round4.xml foraging/trunk/src/main/resources/configuration/round5.xml foraging/trunk/src/main/resources/configuration/round6.xml foraging/trunk/src/main/resources/configuration/server.xml Deleted: foraging/trunk/src/main/resources/configuration/round0.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round0.xml 2010-03-26 23:42:28 UTC (rev 495) +++ foraging/trunk/src/main/resources/configuration/round0.xml 2010-03-29 19:20:08 UTC (rev 496) @@ -1,70 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Foraging XML-ized experiment round configuration</comment> -<entry key="resource-width">13</entry> -<entry key="resource-depth">13</entry> -<entry key="practice-round">true</entry> -<entry key="private-property">true</entry> -<entry key="duration">240</entry> - -<entry key='tokens-field-of-vision'>true</entry> -<entry key='subjects-field-of-vision'>true</entry> - -<entry key="quiz">true</entry> -<entry key="q1">C</entry> -<entry key="q2">B</entry> - -<entry key='instructions'> -<![CDATA[ -<h3>Practice Round Instructions</h3> -<hr> -<p> -You will now have four minutes to practice with the experimental environment. -The decisions you make in this round will NOT influence your earnings. At the -At the beginning of the practice round half of the cells are occupied -with green tokens. The environment is a 13 x 13 grid of cells. -</p> -<p> -During this practice round, and <b>only during</b> this practice round, you are able -to reset the tokens displayed on the screen by pressing the <b>R</b> key. When you -press the <b>R</b> key you will reset the resource to its initial distribution, -randomly filling half of the cells. -</p> -<p><b> Please do not communicate with any other participant.</b></p> -<p>If you have any questions please raise your hand. <b>Do you have any -questions so far?</b></p> -]]> -</entry> - -<entry key="quiz-instructions"> -<![CDATA[ -<p> -Before we begin the practice round you need to answer the following questions -correctly. You can only continue when you have answered all questions -correctly. If an error is made you will need to answer the questions again. -</p> -<br> -<form> -(Q1)Which of the statements is <b><u>incorrect</u></b>? <br> -<input type="radio" name="q1" value="A">Your decisions of where to collect tokens affects the regeneration of tokens.<br> -<input type="radio" name="q1" value="B">When you have collected all tokens on -the screen, no new tokens will appear.<br> -<input type="radio" name="q1" value="C">Tokens grow from the middle of the -screen.<br> -<input type="radio" name="q1" value="D">In order to collect a token you need -to press the space bar while your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> is on a cell with a token.<br> -<br><br> - -(Q2)Which sequence of situations is <b><u>not possible</u></b>? <br> -<img src="@CODEBASE_URL@/images/question2.jpg"><br> -<input type="radio" name="q2" value="A">A<br> -<input type="radio" name="q2" value="B">B<br> -<input type="radio" name="q2" value="C">C<br> -<br> -<input type="submit" name="submit" value="Submit"> -</form> -]]> -</entry> - -</properties> Deleted: foraging/trunk/src/main/resources/configuration/round1.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round1.xml 2010-03-26 23:42:28 UTC (rev 495) +++ foraging/trunk/src/main/resources/configuration/round1.xml 2010-03-29 19:20:08 UTC (rev 496) @@ -1,52 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Foraging XML experiment round configuration</comment> -<entry key="display-group-tokens">true</entry> -<entry key="clients-per-group">5</entry> -<entry key="duration">240</entry> -<entry key="resource-depth">29</entry> -<entry key="resource-width">29</entry> - -<entry key='tokens-field-of-vision'>true</entry> -<entry key='subjects-field-of-vision'>true</entry> - -<entry key='always-explicit'>true</entry> -<entry key='max-cell-occupancy'>1</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 1 Instructions</h3> -<hr> -<p> -This is the first round of the experiment. The length of the round is 4 -minutes. Like in the practice round you can collect green tokens. This time -you earn <b>two cents</b> for each token collected. This time you -<b>cannot</b> reset the distribution of green tokens. -</p> -<p> -In this round the renewable resource will become five times bigger. You will share this -larger environment with four other players in this room that have been randomly -selected. One group's resource environment is distinct from the other groups. -</p> -<p> -Each of you has been assigned a number from 1 to 5. These numbers will remain the -same throughout the experiment but you will <b>not</b> be able to identify which -person in the room has been assigned which number, so your anonymity is guaranteed. - -The other four players will appear on the screen as blue dots -<img src="@CODEBASE_URL@/images/gem-other.gif"> with a white -number embedded in the dot. On the top right corner of the screen you can see -how many tokens each player has collected. On the top left corner of the screen you can see -a clock that displays the remaining time in the round.</p> -<p>Since you can only see the resource within your vision you may neither see all -the other participants nor all the resource units. The figure below indicates the -vision range compared to the whole environment</p> -<img src="@CODEBASE_URL@/images/vision-range.jpg"> -<p> -If you have any questions please raise your hand. <b>Do you have any -questions so far?</b> -</p> -]]> -</entry> -</properties> Deleted: foraging/trunk/src/main/resources/configuration/round2.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round2.xml 2010-03-26 23:42:28 UTC (rev 495) +++ foraging/trunk/src/main/resources/configuration/round2.xml 2010-03-29 19:20:08 UTC (rev 496) @@ -1,37 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Foraging XML-ized experiment round configuration</comment> -<entry key="display-group-tokens">true</entry> -<entry key="clients-per-group">5</entry> -<entry key="duration">240</entry> -<entry key="resource-depth">29</entry> -<entry key="resource-width">29</entry> - - -<!-- enable field of vision for tokens and subjects --> -<entry key='tokens-field-of-vision'>true</entry> -<entry key='subjects-field-of-vision'>true</entry> - -<entry key='initial-distribution'>.25</entry> - -<entry key='tokens-field-of-vision'>true</entry> -<entry key='subjects-field-of-vision'>true</entry> - -<entry key='always-explicit'>true</entry> -<entry key='max-cell-occupancy'>1</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 2 Instructions</h3> -<hr> -<p> -Round 2 is the same as round 1. -</p> -<p> -If you have any questions please raise your hand. <b>Do you have any -questions so far?</b> -</p> -]]> -</entry> -</properties> Deleted: foraging/trunk/src/main/resources/configuration/round3.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round3.xml 2010-03-26 23:42:28 UTC (rev 495) +++ foraging/trunk/src/main/resources/configuration/round3.xml 2010-03-29 19:20:08 UTC (rev 496) @@ -1,34 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Foraging XML-ized experiment round configuration</comment> -<entry key="display-group-tokens">true</entry> -<entry key="clients-per-group">5</entry> -<entry key="duration">240</entry> -<entry key="resource-depth">29</entry> -<entry key="resource-width">29</entry> - -<!-- enable field of vision for tokens and subjects --> -<entry key='tokens-field-of-vision'>true</entry> -<entry key='subjects-field-of-vision'>true</entry> - -<entry key='always-explicit'>true</entry> -<entry key='max-cell-occupancy'>1</entry> - -<!-- resource regrowth parameters --> -<entry key="initial-distribution">.25</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 3 Instructions</h3> -<hr> -<p> -Round 3 is the same as round 2. -</p> -<p> -If you have any questions please raise your hand. <b>Do you have any -questions so far?</b> -</p> -]]> -</entry> -</properties> Deleted: foraging/trunk/src/main/resources/configuration/round4.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round4.xml 2010-03-26 23:42:28 UTC (rev 495) +++ foraging/trunk/src/main/resources/configuration/round4.xml 2010-03-29 19:20:08 UTC (rev 496) @@ -1,155 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Foraging XML-ized experiment round configuration</comment> -<entry key="display-group-tokens">true</entry> -<entry key="clients-per-group">5</entry> -<entry key="resource-depth">29</entry> -<entry key="resource-width">29</entry> -<entry key="duration">240</entry> - -<!-- enable field of vision for tokens and subjects --> -<entry key='tokens-field-of-vision'>true</entry> -<entry key='subjects-field-of-vision'>true</entry> - -<entry key='always-explicit'>true</entry> -<entry key='max-cell-occupancy'>1</entry> - -<!-- before this round begins, we have a chat session --> -<entry key="chat-enabled">true</entry> -<entry key="chat-duration">240</entry> - -<!-- enable sanctioning --> -<entry key="sanction-type">real-time</entry> -<entry key="sanction-cost">1</entry> -<entry key="sanction-multiplier">2</entry> - - -<entry key="initial-distribution">.25</entry> - -<!-- enable quiz --> -<entry key='quiz'>true</entry> -<entry key='q1'>1</entry> -<entry key='q2'>2</entry> -<entry key='q3'>1</entry> -<entry key='q4'>1</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 4 Instructions</h3> -<hr> -<p> -Round 4 is the same as the previous two rounds with two exceptions. -</p> -<p> -Before the next round starts you can anonymously communicate by text messages -for four minutes with the other participants in your group. You can use this -opportunity to discuss the experiment and coordinate your actions to improve -your earnings. You may not promise side-payments after the experiment is -completed or make any threats. You are also not allowed to reveal your real -identity. We are monitoring the chat traffic while you chat. -</p> -<p> -During the next round you will have the option to reduce the earnings of another -participant at a cost to your own earnings. -</p> -<ul> -<li>If you press the numeric key 1-5 corresponding to another participant, you -will reduce the number of tokens they have collected in this round by two -tokens. This will also reduce your own token amount by one token. The decision -whether or when to use this option is up to you. -<li>When you reduce the number of tokens of another participant, they will -receive a message stating that you have reduced their tokens. Likewise, if -another participant reduces your number of tokens, you will also receive a -message. These messages will be displayed on the bottom of your screen. -<li>If your tokens are being reduced or you are reducing another participant's -tokens, you will receive some visual cues. When your tokens are being reduced -your yellow dot will turn red briefly with a blue background. The participant -currently reducing your tokens will turn purple with a white background. -<li>You may reduce the earnings of other participants as long as there are -tokens remaining on the screen and while both you and the other participant -have a positive number of tokens collected during the round. <b>Each time</b> -you press the numeric key corresponding to another participant your token -amount is reduced by <b>one</b>, and their token amount is reduced by -<b>two</b>. <b>Note:</b> You can only remove tokens from a participant that is -visible to you. -</ul> -<p> - -<p> -The length of this round is four minutes. -</p> -<p> -If you have any questions please raise your hand. <b>Do you have any -questions so far?</b> -</p> -]]> -</entry> - -<entry key="chat-instructions"> -<![CDATA[ -<p> -You can now chat with the other participants in your group for 4 minutes -total. During the chat round, you may communicate about any aspect of the -experiment that you would like to discuss with other participants with whom -you have been matched. You may not promise them side-payments after the -experiment is completed or threaten them with any consequence after the -experiment is finished. We are monitoring the chat traffic while you chat. If -we see that somebody reveals his or her identity, we have to stop the -experiment and remove the whole group from which this person is a member out -of this room. -</p> -<p> -You will see other participants labeled as "1", "2","3", "4", or "5" in the -chat box. You can send a chat message by typing into the textfield at the -bottom of the screen and pressing the "enter" key on your keyboard. -</p> -]]> -</entry> -<entry key="quiz-instructions"> -<![CDATA[ -<p>Before the next round begins you must complete the quiz below. You can -only continue when you have answered all questions correctly. If an error is -made you will need to answer the questions again. -</p> - -<form> -(Q1)Each time I press the numeric keys between 1-5 my tokens will be reduced -by:<br> -<input type="radio" name="q1" value="0">0 tokens<br> -<input type="radio" name="q1" value="1">1 token<br> -<input type="radio" name="q1" value="2">2 tokens<br> -<input type="radio" name="q1" value="4">4 tokens<br> -<br><br> - -(Q2)Each time I press the numeric keys between 1-5 the number of tokens of the -corresponding participant is reduced by:<br> -<input type="radio" name="q2" value="0">0 tokens<br> -<input type="radio" name="q2" value="1">1 token<br> -<input type="radio" name="q2" value="2">2 tokens<br> -<input type="radio" name="q2" value="4">4 tokens<br> -<br><br> - -(Q3)The background of your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> turns blue. What does this represent?<br> -<input type="radio" name="q3" value="0">You collected a token<br> -<input type="radio" name="q3" value="1">Another participant is subtracting two -tokens from you<br> -<input type="radio" name="q3" value="2">You are subtracting two tokens from another -participant<br> -<input type="radio" name="q3" value="3">You are moving too fast<br> -<br><br> - -(Q4)Every time I press the numeric keys between 1-5:<br> -<input type="radio" name="q4" value="0">Two tokens are subtracted from my tokens -collected this round<br> -<input type="radio" name="q4" value="1">One token is subtracted from my tokens -collected this round<br> -<input type="radio" name="q4" value="2">The background of my yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> turns blue -momentarily<br> -<input type="radio" name="q4" value="3">My yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> is paused for two seconds<br> - -<input type="submit" name="submit" value="Submit"> -</form> -]]> -</entry> -</properties> Deleted: foraging/trunk/src/main/resources/configuration/round5.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round5.xml 2010-03-26 23:42:28 UTC (rev 495) +++ foraging/trunk/src/main/resources/configuration/round5.xml 2010-03-29 19:20:08 UTC (rev 496) @@ -1,75 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Foraging XML-ized experiment round configuration</comment> -<entry key="display-group-tokens">true</entry> -<entry key="clients-per-group">5</entry> -<entry key="resource-depth">29</entry> -<entry key="resource-width">29</entry> -<entry key="duration">240</entry> - -<!-- enable field of vision for tokens and subjects --> -<entry key='tokens-field-of-vision'>true</entry> -<entry key='subjects-field-of-vision'>true</entry> - -<!-- enable sanctioning --> -<entry key="sanction-type">real-time</entry> -<entry key="sanction-cost">1</entry> -<entry key="sanction-multiplier">2</entry> - -<entry key="initial-distribution">.25</entry> - -<entry key='always-explicit'>true</entry> -<entry key='max-cell-occupancy'>1</entry> - -<!-- before this round begins, we have a chat session --> -<entry key="chat-enabled">true</entry> -<entry key="chat-duration">240</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 5 Instructions</h3> -<hr> -<p> -Round 5 is the same as round 4.</p> -<p> -The length of this round is again four minutes. -</p> -<p> -If you have any questions please raise your hand. <b>Do you have any -questions so far?</b> -</p> -]]> -</entry> - -<entry key="chat-instructions"> -<![CDATA[ -<p> -You can now chat with the other participants in your group for 4 minutes -total. During the chat round, you may communicate about any aspect of the -experiment that you would like to discuss with other participants with whom -you have been matched. You may not promise them side-payments after the -experiment is completed or threaten them with any consequence after the -experiment is finished. We are monitoring the chat traffic while you chat. If -we see that somebody reveals his or her identity, we have to stop the -experiment and remove the whole group from which this person is a member out -of this room. -</p> -<p> -You will see other participants labeled as "1", "2","3", "4", or "5" in the -chat box. You can send a chat message by typing into the textfield at the -bottom of the screen and pressing the "enter" key on your keyboard. -</p> -]]> -</entry> - -<entry key='private-chat-instructions'> -<![CDATA[ -You may send private messages to a specific participant by clicking on the -appropriately labeled button (1, 2, 3, 4, or 5) before typing your message in -the chat box and sending it. By default you are communicating with all -members of your group. -]]> -</entry> - -</properties> Deleted: foraging/trunk/src/main/resources/configuration/round6.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round6.xml 2010-03-26 23:42:28 UTC (rev 495) +++ foraging/trunk/src/main/resources/configuration/round6.xml 2010-03-29 19:20:08 UTC (rev 496) @@ -1,80 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Foraging XML-ized experiment round configuration</comment> -<entry key="display-group-tokens">true</entry> -<entry key="clients-per-group">5</entry> -<entry key="resource-depth">29</entry> -<entry key="resource-width">29</entry> -<entry key="duration">240</entry> - -<entry key='tokens-field-of-vision'>true</entry> -<entry key='subjects-field-of-vision'>true</entry> -<!-- enable sanctioning --> -<entry key="sanction-type">real-time</entry> -<entry key="sanction-cost">1</entry> -<entry key="sanction-multiplier">2</entry> - -<entry key="initial-distribution">.25</entry> - -<entry key='always-explicit'>true</entry> -<entry key='max-cell-occupancy'>1</entry> - -<!-- before this round begins, we have a chat session --> -<entry key="chat-enabled">true</entry> -<entry key="chat-duration">240</entry> - -<entry key="instructions"> -<![CDATA[ -<h3>Round 6 Instructions</h3> -<hr> -<p> -Round 6 is the same as round 5.</p> -<p> -The length of this round is again four minutes. -</p> -<p> -If you have any questions please raise your hand. <b>Do you have any -questions so far?</b> -</p> -]]> -</entry> - -<entry key="last-round-debriefing"> -<![CDATA[ -<p> -This was the last round, but not the end of the experiment. We will now -determine your payments. While we are doing this, we request that you -carefully fill out a brief survey. -</p> -<p> -When we are ready we will call you one by one to the room next door. We will -pay you there in private. Please wait until your computer number is called, -and then proceed to the room next door to turn in your computer number and -your survey. -</p> -<p> -Please answer the survey carefully and thank you for participating. -</p> -]]> -</entry> - -<entry key="chat-instructions"> -<![CDATA[ -<p> -You can now chat with the other participants in your group for 4 minutes -total. During the chat round, you may communicate about any aspect of the -experiment that you would like to discuss with other participants with whom -you have been matched. You may not promise them side-payments after the -experiment is completed or threaten them with any consequence after the -experiment is finished. We are monitoring the chat traffic while you chat. If -we detect that somebody has revealed their identity, we will have to stop the -experiment and remove that person's entire group from the experiment. -</p> -<p> -You will see other participants labeled as "1", "2","3", "4", or "5" in the -chat box. You can send a chat message by typing into the textfield at the -bottom of the screen and pressing the "enter" key. </p> -]]> -</entry> -</properties> Deleted: foraging/trunk/src/main/resources/configuration/server.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/server.xml 2010-03-26 23:42:28 UTC (rev 495) +++ foraging/trunk/src/main/resources/configuration/server.xml 2010-03-29 19:20:08 UTC (rev 496) @@ -1,98 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> -<properties> -<comment>Costly Sanctioning XML-ized experiment round configuration</comment> -<entry key="hostname">@SERVER_ADDRESS@</entry> -<entry key="port">@PORT_NUMBER@</entry> -<entry key="round0">round0.xml</entry> -<entry key="round1">round1.xml</entry> -<entry key="round2">round2.xml</entry> -<entry key="round3">round3.xml</entry> -<entry key="round4">round4.xml</entry> -<entry key="round5">round5.xml</entry> -<entry key="round6">round6.xml</entry> -<entry key="wait-for-participants">true</entry> -<entry key="number-of-rounds">7</entry> -<entry key="facilitator-instructions"> -<![CDATA[ -<h3>Facilitator Instructions</h3> -<p> -Welcome to the facilitator interface. This interface allows you to control -the experiment. You may only modify configuration parameters <b>before</b> -you start the experiment by selecting the Configuration menu. When all the -participants are ready to begin the experiment, you can start the experiment -by selecting Experiment -> Start. After a round has been completed you -will be able to view the statistics for all of the participants. You can -begin the next round by selecting Round -> Start. -</p> -]]> -</entry> - -<entry key='field-of-vision-instructions'> -<![CDATA[ -Your vision is limited in this experiment. The area that is visible to you will be -shaded. -]]> -</entry> - -<entry key="welcome-instructions"> -<![CDATA[ -<h3>Welcome to the experiment. The experiment will begin shortly after everyone has been -assigned a station.</h3> -<p> -Please <b>wait quietly</b> and <b>do not close this window or open any other applications</b>. -</p> -]]> -</entry> - -<entry key="general-instructions"> -<![CDATA[ -<h3>General Instructions</h3> -<p> -Welcome. You have already earned 5 dollars by showing up at this experiment. You can -earn more, up to a maximum of 40 dollars, by participating in this experiment, which -will take about an hour to an hour and a half. The amount of money you earn depends -on your decisions as well as the decisions of other people in this room during the -six rounds of the experiment. -</p> -<p> -You appear on the screen as a yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif">. -You move by pressing the four arrow keys on your keyboard. You can move up, down, -left, or right. You have to press a key for each and every move of your yellow dot. -In this experiment you can collect green diamond shaped tokens -<img src="@CODEBASE_URL@/images/gem-token.gif"> and earn two cents for each collected token. -To collect a token, move your yellow dot over a green token and press the <b>space -bar</b>. If you move over a token without pressing the <b>space bar</> you do NOT -collect that token. -</p> - -<p> -The tokens that you collect have the potential to regenerate. After you have -collected a green token, a new token can re-appear on that empty cell. -However, the rate at which new tokens will appear depends on the number of -adjacent cells with tokens. The more tokens in the eight cells around -an empty cell, the faster a new token will appear on that empty cell. In other -words, <b>existing tokens can generate new tokens</b>. To illustrate this, please -refer to Image 1 and Image 2. The middle cell in Image 1 denoted with an X has -a greater chance of regeneration than the middle cell in Image 2. When all -neighboring cells are empty, there is <b>no chance for regeneration</b>. - -<table width="100%"> -<tr> -<td align="center"><b>Image 1</b></td> -<td align="center"><b>Image 2</b></td> -</tr> -<tr> -<td align="center"> -<img src="@CODEBASE_URL@/images/8neighbors.jpg" alt="image 1"> -</td> -<td align="center"> -<img src="@CODEBASE_URL@/images/5neighbors.jpg" alt="image 2"> -</td> -</tr> -</table> -]]> -</entry> - - -</properties> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <db...@us...> - 2010-03-26 23:42:35
|
Revision: 495 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=495&view=rev Author: dbarge Date: 2010-03-26 23:42:28 +0000 (Fri, 26 Mar 2010) Log Message: ----------- This code version has following improvement Earlier the token statistics and artifacts were displayed at the top right corner of the screen for all the players. The present changes consider the field of vision and display the token statistics of only those players seen within the field of vision while the statistics of other players is not displayed Modified Paths: -------------- foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java foraging/trunk/src/main/java/edu/asu/commons/foraging/model/TreatmentType.java Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java 2010-03-25 21:22:19 UTC (rev 494) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java 2010-03-26 23:42:28 UTC (rev 495) @@ -400,16 +400,37 @@ StringBuilder builder = new StringBuilder("Tokens collected:"); // XXX: use this method so that we get the proper ordering of client ids/assigned numbers.. Map<Identifier, ClientData> clientDataMap = dataModel.getClientDataMap(); + + // To display the token artifacts only if the player lies in the + // field of vision + + Point clientPosition = dataModel.getCurrentPosition(); + for (Identifier id: dataModel.getAllClientIdentifiers()) { ClientData clientData = clientDataMap.get(id); String formatString = ""; if (id.equals(dataModel.getId())) { formatString = " [%d (you) : %d] "; + builder.append(String.format(formatString, clientData.getAssignedNumber(), clientData.getCurrentTokens())); } - else { - formatString = " [%d : %d] "; + else { + if(!dataModel.getRoundConfiguration().isFieldOfVisionEnabled()){ + formatString = " [%d : %d] "; + builder.append(String.format(formatString, clientData.getAssignedNumber(), clientData.getCurrentTokens())); + } + else { + double radius = dataModel.getRoundConfiguration().getViewSubjectsRadius(); + Circle fieldOfVision = new Circle(clientPosition, radius); + if(fieldOfVision.contains(clientData.getPosition())) { + formatString = " [%d : %d] "; + builder.append(String.format(formatString, clientData.getAssignedNumber(), clientData.getCurrentTokens())); + } + else { + formatString = " [%d : XX] "; + builder.append(String.format(formatString, clientData.getAssignedNumber())); + } + } } - builder.append(String.format(formatString, clientData.getAssignedNumber(), clientData.getCurrentTokens())); } return builder.toString(); } Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/model/TreatmentType.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/model/TreatmentType.java 2010-03-25 21:22:19 UTC (rev 494) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/model/TreatmentType.java 2010-03-26 23:42:28 UTC (rev 495) @@ -22,8 +22,8 @@ if (index < values().length && index >= 0) { return values()[index]; } - System.err.println("Returning LIMITEDVISION."); - return LIMITEDVISION; + System.err.println("Returning FULLVISION as default."); + return FULLVISION; // throw new IllegalArgumentException("No enforcement mechanism for index: " + index); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <db...@us...> - 2010-03-25 21:22:25
|
Revision: 494 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=494&view=rev Author: dbarge Date: 2010-03-25 21:22:19 +0000 (Thu, 25 Mar 2010) Log Message: ----------- This code version has following improvements 1) Quiz responses are more informative. After submitting the responses the players are notified about the correct and incorrect answers. 2) Added an option to the GUI to select the type of treatment from the facilitator end. This is a workaround for selecting either full-vision treatment or limited-vision treatment. Modified Paths: -------------- foraging/trunk/src/main/resources/configuration/round0.xml foraging/trunk/src/main/resources/configuration/round4.xml Added Paths: ----------- foraging/trunk/src/main/webapp/ foraging/trunk/src/main/webapp/WEB-INF/ foraging/trunk/src/main/webapp/WEB-INF/web.xml foraging/trunk/src/main/webapp/client.jar foraging/trunk/src/main/webapp/client.jnlp foraging/trunk/src/main/webapp/csidex.jar foraging/trunk/src/main/webapp/facilitator.jar foraging/trunk/src/main/webapp/facilitator.jnlp foraging/trunk/src/main/webapp/images/ foraging/trunk/src/main/webapp/images/5neighbors.jpg foraging/trunk/src/main/webapp/images/8neighbors.jpg foraging/trunk/src/main/webapp/images/abstract.jpg foraging/trunk/src/main/webapp/images/age-token-graph.jpg foraging/trunk/src/main/webapp/images/bg-grass.jpg foraging/trunk/src/main/webapp/images/blank.gif foraging/trunk/src/main/webapp/images/freeze-self.gif foraging/trunk/src/main/webapp/images/gem-gray.gif foraging/trunk/src/main/webapp/images/gem-other.gif foraging/trunk/src/main/webapp/images/gem-purple.gif foraging/trunk/src/main/webapp/images/gem-red.gif foraging/trunk/src/main/webapp/images/gem-self-explicit.gif foraging/trunk/src/main/webapp/images/gem-self.gif foraging/trunk/src/main/webapp/images/gem-token.gif foraging/trunk/src/main/webapp/images/icon.gif foraging/trunk/src/main/webapp/images/image1.gif foraging/trunk/src/main/webapp/images/image2.gif foraging/trunk/src/main/webapp/images/matte.gif foraging/trunk/src/main/webapp/images/neighborhood.jpg foraging/trunk/src/main/webapp/images/possible-neighboring-tokens.jpg foraging/trunk/src/main/webapp/images/question2.jpg foraging/trunk/src/main/webapp/images/question2_orig.jpg foraging/trunk/src/main/webapp/images/sanction-blue.jpg foraging/trunk/src/main/webapp/images/sanction-yellow.jpg foraging/trunk/src/main/webapp/images/trees.jpg foraging/trunk/src/main/webapp/images/vision-range.jpg foraging/trunk/src/main/webapp/index.html Modified: foraging/trunk/src/main/resources/configuration/round0.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round0.xml 2010-03-25 21:20:57 UTC (rev 493) +++ foraging/trunk/src/main/resources/configuration/round0.xml 2010-03-25 21:22:19 UTC (rev 494) @@ -46,7 +46,7 @@ </p> <br> <form> -Which of the statements is <b><u>incorrect</u></b>? <br> +(Q1)Which of the statements is <b><u>incorrect</u></b>? <br> <input type="radio" name="q1" value="A">Your decisions of where to collect tokens affects the regeneration of tokens.<br> <input type="radio" name="q1" value="B">When you have collected all tokens on the screen, no new tokens will appear.<br> @@ -56,7 +56,7 @@ to press the space bar while your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> is on a cell with a token.<br> <br><br> -Which sequence of situations is not possible? <br> +(Q2)Which sequence of situations is <b><u>not possible</u></b>? <br> <img src="@CODEBASE_URL@/images/question2.jpg"><br> <input type="radio" name="q2" value="A">A<br> <input type="radio" name="q2" value="B">B<br> Modified: foraging/trunk/src/main/resources/configuration/round4.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round4.xml 2010-03-25 21:20:57 UTC (rev 493) +++ foraging/trunk/src/main/resources/configuration/round4.xml 2010-03-25 21:22:19 UTC (rev 494) @@ -114,7 +114,7 @@ </p> <form> -Each time I press the numeric keys between 1-5 my tokens will be reduced +(Q1)Each time I press the numeric keys between 1-5 my tokens will be reduced by:<br> <input type="radio" name="q1" value="0">0 tokens<br> <input type="radio" name="q1" value="1">1 token<br> @@ -122,7 +122,7 @@ <input type="radio" name="q1" value="4">4 tokens<br> <br><br> -Each time I press the numeric keys between 1-5 the number of tokens of the +(Q2)Each time I press the numeric keys between 1-5 the number of tokens of the corresponding participant is reduced by:<br> <input type="radio" name="q2" value="0">0 tokens<br> <input type="radio" name="q2" value="1">1 token<br> @@ -130,7 +130,7 @@ <input type="radio" name="q2" value="4">4 tokens<br> <br><br> -The background of your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> turns blue. What does this represent?<br> +(Q3)The background of your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> turns blue. What does this represent?<br> <input type="radio" name="q3" value="0">You collected a token<br> <input type="radio" name="q3" value="1">Another participant is subtracting two tokens from you<br> @@ -139,7 +139,7 @@ <input type="radio" name="q3" value="3">You are moving too fast<br> <br><br> -Every time I press the numeric keys between 1-5:<br> +(Q4)Every time I press the numeric keys between 1-5:<br> <input type="radio" name="q4" value="0">Two tokens are subtracted from my tokens collected this round<br> <input type="radio" name="q4" value="1">One token is subtracted from my tokens Added: foraging/trunk/src/main/webapp/WEB-INF/web.xml =================================================================== --- foraging/trunk/src/main/webapp/WEB-INF/web.xml (rev 0) +++ foraging/trunk/src/main/webapp/WEB-INF/web.xml 2010-03-25 21:22:19 UTC (rev 494) @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +vim:sts=2:sw=2 +--> +<web-app> + + <display-name>The Virtual Commons Foraging Experiment</display-name> + + <welcome-file-list> + <welcome-file>index.html</welcome-file> + </welcome-file-list> + +</web-app> Added: foraging/trunk/src/main/webapp/client.jar =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/client.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/client.jnlp =================================================================== --- foraging/trunk/src/main/webapp/client.jnlp (rev 0) +++ foraging/trunk/src/main/webapp/client.jnlp 2010-03-25 21:22:19 UTC (rev 494) @@ -0,0 +1,20 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- JNLP file for foraging client --> +<jnlp spec="1.6+" codebase="http://localhost:8080/" href="client.jnlp"> + <information> + <title>Virtual Commons Experiment</title> + <vendor>The Virtual Commons, Center for the Study of Institutional Diversity, School of Human Evolution and Social Change, Dr. Marco Janssen, Allen Lee, Deepali Bhagvat</vendor> + <homepage href="http://commons.asu.edu"/> + <description>An experiment brought to you courtesy of The Virtual Commons - http://commons.asu.edu</description> + </information> + <offline-allowed /> + <resources> + <j2se version="1.6+"/> + <jar href="client.jar"/> + <jar href='csidex.jar'/> + <property name="sun.java2d.noddraw" value="true"/> + <extension name="jogl" href="http://download.java.net/media/jogl/builds/archive/jsr-231-webstart-current/jogl.jnlp"/> + </resources> + <application-desc main-class="edu.asu.commons.foraging.client.ForagingClient"/> +</jnlp> + Added: foraging/trunk/src/main/webapp/csidex.jar =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/csidex.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/facilitator.jar =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/facilitator.jar ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/facilitator.jnlp =================================================================== --- foraging/trunk/src/main/webapp/facilitator.jnlp (rev 0) +++ foraging/trunk/src/main/webapp/facilitator.jnlp 2010-03-25 21:22:19 UTC (rev 494) @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<!-- JNLP File for CSAN 2D Facilitator --> +<jnlp spec="1.6+" codebase="http://localhost:8080/" href="facilitator.jnlp"> + <information> + <title>Virtual Commons Experiment</title> + <vendor>The Virtual Commons, Center for the Study of Institutional Diversity, School of Human Evolution and Social Change, Dr. Marco Janssen, Allen Lee, Deepali Bhagvat</vendor> + <homepage href="http://commons.asu.edu"/> + <description>Foraging 2D facilitator interface to control the Foraging 2D experiment.</description> + <icon href="commons.gif"/> + </information> + <offline-allowed /> + <resources> + <j2se version="1.6+"/> + <jar href="facilitator.jar"/> + <jar href='csidex.jar'/> + </resources> + <application-desc main-class="edu.asu.commons.foraging.facilitator.Facilitator"/> +</jnlp> + Added: foraging/trunk/src/main/webapp/images/5neighbors.jpg =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/5neighbors.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/8neighbors.jpg =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/8neighbors.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/abstract.jpg =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/abstract.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/age-token-graph.jpg =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/age-token-graph.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/bg-grass.jpg =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/bg-grass.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/blank.gif =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/blank.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/freeze-self.gif =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/freeze-self.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/gem-gray.gif =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/gem-gray.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/gem-other.gif =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/gem-other.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/gem-purple.gif =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/gem-purple.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/gem-red.gif =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/gem-red.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/gem-self-explicit.gif =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/gem-self-explicit.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/gem-self.gif =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/gem-self.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/gem-token.gif =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/gem-token.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/icon.gif =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/icon.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/image1.gif =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/image1.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/image2.gif =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/image2.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/matte.gif =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/matte.gif ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/neighborhood.jpg =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/neighborhood.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/possible-neighboring-tokens.jpg =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/possible-neighboring-tokens.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/question2.jpg =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/question2.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/question2_orig.jpg =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/question2_orig.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/sanction-blue.jpg =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/sanction-blue.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/sanction-yellow.jpg =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/sanction-yellow.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/trees.jpg =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/trees.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/images/vision-range.jpg =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/webapp/images/vision-range.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: foraging/trunk/src/main/webapp/index.html =================================================================== --- foraging/trunk/src/main/webapp/index.html (rev 0) +++ foraging/trunk/src/main/webapp/index.html 2010-03-25 21:22:19 UTC (rev 494) @@ -0,0 +1,13 @@ +<html> +<head> +<META HTTP-EQUIV="Refresh" CONTENT="5;URL=client.jnlp"> +<title>Virtual Commons Experiment Client</title> +</head> +<body> +<p> +Automatically starting the client. Please <a href='javascript:void()' +onclick='window.close()'>close</a> this window after the client +loads. NOTE: <b>Do not reload or refresh</b> this window. +</p> +</body> +</html> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <db...@us...> - 2010-03-25 21:21:04
|
Revision: 493 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=493&view=rev Author: dbarge Date: 2010-03-25 21:20:57 +0000 (Thu, 25 Mar 2010) Log Message: ----------- This code version has following improvements 1) Quiz responses are more informative. After submitting the responses the players are notified about the correct and incorrect answers. 2) Added an option to the GUI to select the type of treatment from the facilitator end. This is a workaround for selecting either full-vision treatment or limited-vision treatment. Modified Paths: -------------- foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java foraging/trunk/src/main/java/edu/asu/commons/foraging/facilitator/ConfigurationDialog.java foraging/trunk/src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java foraging/trunk/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java Added Paths: ----------- foraging/trunk/src/main/java/edu/asu/commons/foraging/event/TreatmentTypeRequest.java foraging/trunk/src/main/java/edu/asu/commons/foraging/model/TreatmentType.java Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java 2010-03-23 23:08:38 UTC (rev 492) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java 2010-03-25 21:20:57 UTC (rev 493) @@ -35,7 +35,9 @@ import edu.asu.commons.foraging.event.RoundStartedEvent; import edu.asu.commons.foraging.event.SanctionUpdateEvent; import edu.asu.commons.foraging.event.ShowInstructionsRequest; +import edu.asu.commons.foraging.event.TreatmentTypeRequest; import edu.asu.commons.foraging.event.SynchronizeClientEvent; +import edu.asu.commons.foraging.model.TreatmentType; import edu.asu.commons.util.Duration; import edu.asu.commons.util.Utils; @@ -69,6 +71,8 @@ private ClientDataModel dataModel; + private TreatmentType treatmentType = TreatmentType.FULLVISION; + private MessageQueue messageQueue; private JPanel clientPanel = new JPanel(); @@ -123,6 +127,14 @@ transmit(new AgentInfoRequest(getId(), color)); gameWindow3D.removeAgentDesigner(); } + + private void setTreatmentType(TreatmentType treatmentType) { + this.treatmentType = treatmentType; + } + + private TreatmentType getTreatmentType() { + return treatmentType; + } @Override @SuppressWarnings("unchecked") @@ -131,6 +143,7 @@ public void handle(SetConfigurationEvent event) { RoundConfiguration configuration = (RoundConfiguration) event.getParameters(); dataModel.setRoundConfiguration(configuration); + dataModel.getRoundConfiguration().setTreatmentType(getTreatmentType()); SwingUtilities.invokeLater(new Runnable() { public void run() { clientPanel.removeAll(); @@ -152,11 +165,20 @@ } }); + addEventProcessor(new EventTypeProcessor<ShowInstructionsRequest>(ShowInstructionsRequest.class) { public void handle(ShowInstructionsRequest request) { getGameWindow().showInstructions(); } }); + + addEventProcessor(new EventTypeProcessor<TreatmentTypeRequest>(TreatmentTypeRequest.class) { + public void handle(TreatmentTypeRequest request) { + setTreatmentType(request.getTreatmentType()); + dataModel.getRoundConfiguration().setTreatmentType(getTreatmentType()); + } + }); + addEventProcessor(new EventTypeProcessor<RoundStartedEvent>(RoundStartedEvent.class) { public void handle(RoundStartedEvent event) { System.err.println("client starting round: " + dataModel.is2dExperiment()); Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java 2010-03-23 23:08:38 UTC (rev 492) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java 2010-03-25 21:20:57 UTC (rev 493) @@ -18,6 +18,8 @@ import java.awt.event.MouseEvent; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; import java.util.Arrays; import java.util.List; import java.util.Map; @@ -192,16 +194,22 @@ Properties actualAnswers = formEvent.getData(); // actualAnswers.list(System.err); List<String> incorrectAnswers = new ArrayList<String>(); + List<String> correctAnswers = new ArrayList<String>(); + // FIXME: always send a quiz response event. // iterate through expected answers for (Map.Entry<String, String> entry : configuration.getQuizAnswers().entrySet()) { String questionNumber = entry.getKey(); String expectedAnswer = entry.getValue(); + System.out.println(expectedAnswer); if (! expectedAnswer.equals(actualAnswers.getProperty(questionNumber)) ) { // flag the incorrect response incorrectAnswers.add(questionNumber); } + else { + correctAnswers.add(questionNumber); + } } if (incorrectAnswers.isEmpty()) { // notify the server and also notify the participant. @@ -212,8 +220,30 @@ } else { // FIXME: highlight the incorrect answers? + Collections.sort(incorrectAnswers); + Collections.sort(correctAnswers); StringBuilder builder = new StringBuilder().append(instructionsBuilder); - builder.append("<br><b><font color='red'>You have answered some questions incorrectly. Please try again and resubmit.</font></b>"); + + StringBuilder correctString = new StringBuilder(); + if (!correctAnswers.isEmpty()) { + correctString.append("<br>Correctly answered questions"); + for (Iterator<String> itr = correctAnswers.iterator(); itr.hasNext();) { + String correctSelected = itr.next(); + String correctValue = configuration.getQuizAnswers().get(correctSelected); + correctString.append("<br>"+correctSelected+": Option "+correctValue); + } + correctString.append("<br>"); + } + + StringBuilder incorrectString = new StringBuilder(); + incorrectString.append("<br>Incorrectly answered questions"); + for (Iterator<String> itr = incorrectAnswers.iterator(); itr.hasNext();) { + String incorrectSelected = itr.next(); + incorrectString.append("<br>"+incorrectSelected); + } + incorrectString.append("<br>"); + + builder.append("<br><b><font color='red'>"+correctString.toString()+incorrectString.toString()+".<br> Please select again and resubmit.</font></b>"); setInstructions(builder.toString()); } } Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java 2010-03-23 23:08:38 UTC (rev 492) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java 2010-03-25 21:20:57 UTC (rev 493) @@ -10,6 +10,7 @@ import edu.asu.commons.foraging.graphics.Point3D; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.EnforcementMechanism; +import edu.asu.commons.foraging.model.TreatmentType; public class RoundConfiguration extends ExperimentRoundParameters.Base<ServerConfiguration> { @@ -26,6 +27,8 @@ private static final double DEFAULT_TOKEN_MOVEMENT_PROBABILITY = 0.2d; private static final double DEFAULT_TOKEN_BIRTH_PROBABILITY = 0.01d; + + private TreatmentType treatmentType; private final static Map<String, SanctionType> sanctionTypeMap = new HashMap<String, SanctionType>(3); public enum SanctionType { @@ -115,6 +118,15 @@ || getBooleanProperty("randomize-group", false); } + public void setTreatmentType (TreatmentType treatmentType) { + this.treatmentType = treatmentType; + } + + public TreatmentType getTreatmentType () { + return treatmentType; + } + + /** * Returns the number of seconds that the flashing visualization of * sanctioning should occur. @@ -134,11 +146,24 @@ } public boolean isTokensFieldOfVisionEnabled() { - return getBooleanProperty("tokens-field-of-vision", false); + if (getTreatmentType()== TreatmentType.FULLVISION){ + return false; + } + + else { + return true; + } + //return getBooleanProperty("tokens-field-of-vision", false); } public boolean isSubjectsFieldOfVisionEnabled() { - return getBooleanProperty("subjects-field-of-vision", false); + if (getTreatmentType()== TreatmentType.FULLVISION){ + return false; + } + else { + return true; + } + //return getBooleanProperty("subjects-field-of-vision", false); } public double getViewSubjectsRadius() { Added: foraging/trunk/src/main/java/edu/asu/commons/foraging/event/TreatmentTypeRequest.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/event/TreatmentTypeRequest.java (rev 0) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/event/TreatmentTypeRequest.java 2010-03-25 21:20:57 UTC (rev 493) @@ -0,0 +1,22 @@ +package edu.asu.commons.foraging.event; + +import edu.asu.commons.event.AbstractEvent; +import edu.asu.commons.foraging.model.TreatmentType; +import edu.asu.commons.net.Identifier; + +public class TreatmentTypeRequest extends AbstractEvent { + + private static final long serialVersionUID = 3543634624796618926L; + + private TreatmentType treatmentType; + + public TreatmentTypeRequest(Identifier id, TreatmentType treatmentType) { + super(id); + this.treatmentType = treatmentType; + } + + public TreatmentType getTreatmentType() { + return treatmentType; + } + +} Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/facilitator/ConfigurationDialog.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/facilitator/ConfigurationDialog.java 2010-03-23 23:08:38 UTC (rev 492) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/facilitator/ConfigurationDialog.java 2010-03-25 21:20:57 UTC (rev 493) @@ -9,13 +9,22 @@ import java.util.ArrayList; import java.util.List; +import javax.swing.BorderFactory; +import javax.swing.Box; +import javax.swing.BoxLayout; +import javax.swing.ButtonGroup; import javax.swing.JButton; import javax.swing.JFrame; +import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; import javax.swing.JTabbedPane; +import javax.swing.JTextArea; import edu.asu.commons.foraging.conf.RoundConfiguration; import edu.asu.commons.foraging.conf.ServerConfiguration; +import edu.asu.commons.foraging.model.TreatmentType; @@ -27,6 +36,8 @@ private List<RoundConfigurationDialog> roundConfigurationDialogs = new ArrayList<RoundConfigurationDialog>(); private Facilitator facilitator; private boolean readOnly = false; + private TreatmentType currentTreatment; + private ButtonGroup group; /* * Constructor @@ -35,7 +46,7 @@ // this.parentFrame = parentFrame; this.facilitator = facilitator; this.readOnly = readOnly; - + group = new ButtonGroup(); tabbedPaneFrame = new JFrame("Configuration Parameters"); Container content = tabbedPaneFrame.getContentPane(); content.setLayout(new BorderLayout(7, 7)); @@ -69,11 +80,76 @@ RoundConfigurationDialog roundConfigDlg = new RoundConfigurationDialog(roundConfiguration, readOnly); roundConfigurationDialogs.add(roundConfigDlg); configurationTabPane.addTab("Round " + roundIndex, roundConfigDlg.getPanel()); - } - + } + JPanel panel = new JPanel(); + panel.setLayout(new BoxLayout(panel, BoxLayout.Y_AXIS)); + JLabel label = new JLabel("Select one of the treatments"); + panel.add(label); + panel.add(Box.createVerticalGlue()); + panel.add(createFullVisionPanel(),null); + panel.add(Box.createVerticalGlue()); + panel.add(createLimitedVisionPanel(),null); + panel.add(Box.createVerticalGlue()); + panel.add(getInstructionPanel(), null); + panel.add(Box.createVerticalGlue()); + configurationTabPane.addTab("Type of treatment", panel); return configurationTabPane; } + private JPanel createFullVisionPanel() { + JRadioButton fullVision; + fullVision = new JRadioButton("Complete field of vision"); + fullVision.setActionCommand("1"); + group.add(fullVision); + fullVision.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + updateTreatment(event.getActionCommand()); + System.out.println(" "+event.getActionCommand()); + } + }); + JPanel fullVisionPanel = new JPanel(new GridLayout(2, 2)); + fullVisionPanel.setBorder(BorderFactory.createEtchedBorder() ); + fullVisionPanel.add(new JLabel("Full"), null); + fullVisionPanel.add(new JLabel(""), null); + fullVisionPanel.add(new JLabel("Vision"), null); + fullVisionPanel.add(fullVision, null); + return fullVisionPanel; + } + + private JPanel createLimitedVisionPanel() { + JRadioButton limitedVision; + limitedVision = new JRadioButton("Limited field of vision"); + limitedVision.setActionCommand("0"); + group.add(limitedVision); + limitedVision.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + updateTreatment(event.getActionCommand()); + System.out.println(" "+event.getActionCommand()); + } + }); + JPanel limitedVisionPanel = new JPanel(new GridLayout(2, 2)); + limitedVisionPanel.setBorder(BorderFactory.createEtchedBorder() ); + limitedVisionPanel.add(new JLabel("Limited"), null); + limitedVisionPanel.add(new JLabel(""), null); + limitedVisionPanel.add(new JLabel("Vision"), null); + limitedVisionPanel.add(limitedVision, null); + return limitedVisionPanel; + } + + + private JScrollPane getInstructionPanel() { + ServerConfiguration configuration = facilitator.getServerConfiguration(); + + JPanel panel = new JPanel(); + BoxLayout boxLayout = new BoxLayout(panel, BoxLayout.Y_AXIS); + panel.setLayout(boxLayout); + + panel.add(new JLabel("Instructions"), null); + panel.add(new JTextArea(configuration.getGeneralInstructions()), null); + + return new JScrollPane(panel); + } + private JButton createStartExperimentButton() { JButton startExperimentButton = new JButton("Start Exp"); startExperimentButton.setEnabled(!readOnly); @@ -114,7 +190,7 @@ return cancelButton; } - private void updateConfiguration() { + private void updateConfiguration() {/* List<RoundConfiguration> rounds = new ArrayList<RoundConfiguration>(); ServerConfiguration configuration = facilitator.getServerConfiguration(); @@ -143,9 +219,30 @@ } ConfigurationDialog.this.facilitator.setRoundParameters(rounds); - ConfigurationDialog.this.facilitator.sendSetConfigRequest(); + ConfigurationDialog.this.facilitator.sendSetConfigRequest();*/ + ConfigurationDialog.this.facilitator.sendTreatmentTypeRequest(currentTreatment); + } + private void updateTreatment(String treatmentType) { + //List<RoundConfiguration> rounds = new ArrayList<RoundConfiguration>(); + //RoundConfiguration roundConfiguration = new RoundConfiguration(); + currentTreatment = TreatmentType.FULLVISION; + if(treatmentType.equals("0")) { + currentTreatment = TreatmentType.LIMITEDVISION; + } + else { + currentTreatment = TreatmentType.FULLVISION; + } + //roundConfiguration.setProperty("tokens-field-of-vision", Boolean.valueOf(flag).toString()); + //roundConfiguration.setProperty("subjects-field-of-vision", Boolean.valueOf(flag).toString()); + //rounds.add(roundConfiguration); + //ConfigurationDialog.this.facilitator.setRoundParameters(rounds); + //ConfigurationDialog.this.facilitator.sendSetConfigRequest(); + ConfigurationDialog.this.facilitator.sendTreatmentTypeRequest(currentTreatment); + + } + // private void centerOnParentFrame() { // Dimension parentFrameDimension = parentFrame.getSize(); // Dimension windowDimension = tabbedPaneFrame.getSize(); Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java 2010-03-23 23:08:38 UTC (rev 492) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/facilitator/Facilitator.java 2010-03-25 21:20:57 UTC (rev 493) @@ -21,7 +21,9 @@ import edu.asu.commons.foraging.event.FacilitatorUpdateEvent; import edu.asu.commons.foraging.event.QuizCompletedEvent; import edu.asu.commons.foraging.event.ShowInstructionsRequest; +import edu.asu.commons.foraging.event.TreatmentTypeRequest; import edu.asu.commons.foraging.model.ServerDataModel; +import edu.asu.commons.foraging.model.TreatmentType; @@ -159,6 +161,10 @@ public void sendBeginChatRoundRequest() { transmit(new BeginChatRoundRequest(getId())); } + + public void sendTreatmentTypeRequest(TreatmentType treatmentType) { + transmit(new TreatmentTypeRequest(getId(), treatmentType)); + } public void endExperiment() { Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java 2010-03-23 23:08:38 UTC (rev 492) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/facilitator/FacilitatorWindow.java 2010-03-25 21:20:57 UTC (rev 493) @@ -201,6 +201,13 @@ } }); menu.add(menuItem); + + /* JMenuItem treatment = new JMenuItem("Treatment"); + treatmnet.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + new + } + })*/ menuBar.add(menu); Added: foraging/trunk/src/main/java/edu/asu/commons/foraging/model/TreatmentType.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/model/TreatmentType.java (rev 0) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/model/TreatmentType.java 2010-03-25 21:20:57 UTC (rev 493) @@ -0,0 +1,29 @@ +package edu.asu.commons.foraging.model; + +public enum TreatmentType { + + LIMITEDVISION("Limited Vision"), + FULLVISION("Full Vision"); + + //We may want to add new types of treatments going ahead like + //with sanctioning and voting etc + + private final String treatmentText; + + TreatmentType(String treatmentText) { + this.treatmentText = treatmentText; + } + + public String getTreatmentText() { + return treatmentText; + } + + public static TreatmentType get(int index) { + if (index < values().length && index >= 0) { + return values()[index]; + } + System.err.println("Returning LIMITEDVISION."); + return LIMITEDVISION; +// throw new IllegalArgumentException("No enforcement mechanism for index: " + index); + } +} Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java 2010-03-23 23:08:38 UTC (rev 492) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java 2010-03-25 21:20:57 UTC (rev 493) @@ -56,6 +56,7 @@ import edu.asu.commons.foraging.event.ShowInstructionsRequest; import edu.asu.commons.foraging.event.SubmitRegulationRequest; import edu.asu.commons.foraging.event.SynchronizeClientEvent; +import edu.asu.commons.foraging.event.TreatmentTypeRequest; import edu.asu.commons.foraging.event.UnlockResourceRequest; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.Direction; @@ -65,6 +66,7 @@ import edu.asu.commons.foraging.model.ResourceDispenser; import edu.asu.commons.foraging.model.SanctionMechanism; import edu.asu.commons.foraging.model.ServerDataModel; +import edu.asu.commons.foraging.model.TreatmentType; import edu.asu.commons.foraging.util.ForagingSaveFileConverter; import edu.asu.commons.net.Dispatcher; import edu.asu.commons.net.Identifier; @@ -109,6 +111,7 @@ private volatile int numberOfCompletedAgentDesigns; private int monitorRotationInterval; + private TreatmentType treatmentType; private Duration currentRoundDuration; // private Duration chatDuration; @@ -653,6 +656,20 @@ } } }); + addEventProcessor(new EventTypeProcessor<TreatmentTypeRequest>(TreatmentTypeRequest.class) { + public void handle(TreatmentTypeRequest event) { + // FIXME: assign groups? + if (event.getId().equals(facilitatorId)) { + logger.info("New treatment selected :"+event.getTreatmentType().getTreatmentText()); + for (Identifier id: clients.keySet()) { + transmit(new TreatmentTypeRequest(id, event.getTreatmentType())); + } + } + else { + logger.warning("Ignoring new treatment request from id: " + event.getId()); + } + } + }); addEventProcessor(new EventTypeProcessor<BeginRoundRequest>(BeginRoundRequest.class) { public void handle(BeginRoundRequest event) { if (event.getId().equals(facilitatorId)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2010-03-23 23:08:46
|
Revision: 492 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=492&view=rev Author: alllee Date: 2010-03-23 23:08:38 +0000 (Tue, 23 Mar 2010) Log Message: ----------- adding SanctionAppliedEvent to keep track of sanction events that were actually applied to the source and target including the amount of tokens that were actually subtracted. Replacing SanctionRankingRequest in favor of existing EnforcementRankingRequest which carries the same data. Should continue the refactoring and replace the sanction ranking logic in ClientData with the existing enforcement ranking logic. Modified Paths: -------------- foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java foraging/trunk/src/main/java/edu/asu/commons/foraging/event/EnforcementRankingRequest.java foraging/trunk/src/main/java/edu/asu/commons/foraging/event/RealTimeSanctionRequest.java foraging/trunk/src/main/java/edu/asu/commons/foraging/event/RegulationRankingRequest.java foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ClientData.java foraging/trunk/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java foraging/trunk/src/main/java/edu/asu/commons/foraging/model/SanctionMechanism.java foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java foraging/trunk/src/main/java/edu/asu/commons/foraging/util/ForagingSaveFileConverter.java Added Paths: ----------- foraging/trunk/src/main/java/edu/asu/commons/foraging/event/SanctionAppliedEvent.java Removed Paths: ------------- foraging/trunk/src/main/java/edu/asu/commons/foraging/event/SanctionRankingRequest.java Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java 2010-03-10 22:23:56 UTC (rev 491) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java 2010-03-23 23:08:38 UTC (rev 492) @@ -18,6 +18,7 @@ import java.awt.event.MouseEvent; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; +import java.util.Arrays; import java.util.List; import java.util.Map; import java.util.Properties; @@ -46,11 +47,11 @@ import edu.asu.commons.foraging.event.ClientMovementRequest; import edu.asu.commons.foraging.event.CollectTokenRequest; import edu.asu.commons.foraging.event.EndRoundEvent; +import edu.asu.commons.foraging.event.EnforcementRankingRequest; import edu.asu.commons.foraging.event.PostRoundSanctionUpdateEvent; import edu.asu.commons.foraging.event.QuizCompletedEvent; import edu.asu.commons.foraging.event.RealTimeSanctionRequest; import edu.asu.commons.foraging.event.ResetTokenDistributionRequest; -import edu.asu.commons.foraging.event.SanctionRankingRequest; import edu.asu.commons.foraging.event.SubmitRegulationRequest; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.Direction; @@ -155,12 +156,11 @@ } public void resetSanctionRanks() { - this.currentRankingInformation[0] = this.currentRankingInformation[1] = -1; + Arrays.fill(currentRankingInformation, -1); } public void sendSanctionDecisionVotes() { - System.out.println("Sanction votes ready to be sent."); - client.transmit(new SanctionRankingRequest(client.getId(), currentRankingInformation)); + client.transmit(new EnforcementRankingRequest(client.getId(), currentRankingInformation)); resetSanctionRanks(); } Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java 2010-03-10 22:23:56 UTC (rev 491) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java 2010-03-23 23:08:38 UTC (rev 492) @@ -8,6 +8,7 @@ import edu.asu.commons.conf.ExperimentRoundParameters; import edu.asu.commons.foraging.graphics.Point3D; +import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.EnforcementMechanism; public class RoundConfiguration extends ExperimentRoundParameters.Base<ServerConfiguration> { @@ -68,7 +69,37 @@ } public enum SanctionAction { - FINE, FREEZE; + FINE() { + public void applySanctionCost(ClientData clientData) { + // perform sanction cost logic here for fines + } + + public void applySanctionPenalty(ClientData clientData) { + // perform sanction penalty logic here for fines + } + }, + FREEZE() { + public void applySanctionCost(ClientData clientData) { + // perform sanction cost logic here for freezing + } + + public void applySanctionPenalty(ClientData clientData) { + // perform sanction penalty logic here for freezing + } + }; + + // FIXME: do these need to be here to be able to invoke these methods on SanctionAction? + public void applySanctionCost(ClientData clientData) { } + + public void applySanctionPenalty(ClientData clientData) { } + + public boolean isFine() { + return this == FINE; + } + + public boolean isFreeze() { + return this == FREEZE; + } } public RoundConfiguration() { @@ -275,8 +306,8 @@ * Possible values, freeze, fine? * @return */ - public String getSanctionAction() { - return getProperty("sanction-action", "fine"); + public SanctionAction getSanctionAction() { + return SanctionAction.valueOf(getProperty("sanction-action", "FINE")); } public int getNumberOfSanctionOpportunities() { Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/event/EnforcementRankingRequest.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/event/EnforcementRankingRequest.java 2010-03-10 22:23:56 UTC (rev 491) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/event/EnforcementRankingRequest.java 2010-03-23 23:08:38 UTC (rev 492) @@ -20,9 +20,9 @@ private int[] rankings; - public EnforcementRankingRequest(Identifier id, int[] ranking) { + public EnforcementRankingRequest(Identifier id, int[] rankings) { super(id); - this.rankings = ranking; + this.rankings = rankings; } public int[] getRankings() { Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/event/RealTimeSanctionRequest.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/event/RealTimeSanctionRequest.java 2010-03-10 22:23:56 UTC (rev 491) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/event/RealTimeSanctionRequest.java 2010-03-23 23:08:38 UTC (rev 492) @@ -10,7 +10,7 @@ * * A request made by a client to sanction another client. * - * @author <a href='ano...@gm...'>Allen Lee</a>, Deepali Bhagvat + * @author <a href='mailto:all...@as...'>Allen Lee</a>, Deepali Bhagvat * @version $Revision$ */ public class RealTimeSanctionRequest extends AbstractPersistableEvent { @@ -33,7 +33,7 @@ } public String toString() { - return String.format("Sanctioner: %s -> Sanctionee: %s\n\t%s", getId(), target, super.toString()); + return String.format("Sanction request from %s -> %s", getId(), target); } } Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/event/RegulationRankingRequest.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/event/RegulationRankingRequest.java 2010-03-10 22:23:56 UTC (rev 491) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/event/RegulationRankingRequest.java 2010-03-23 23:08:38 UTC (rev 492) @@ -3,7 +3,7 @@ import java.util.SortedSet; -import edu.asu.commons.event.AbstractEvent; +import edu.asu.commons.event.AbstractPersistableEvent; import edu.asu.commons.foraging.model.RegulationData; import edu.asu.commons.net.Identifier; @@ -16,7 +16,7 @@ * @version $Revision: 1 $ */ -public class RegulationRankingRequest extends AbstractEvent { +public class RegulationRankingRequest extends AbstractPersistableEvent { private static final long serialVersionUID = 475300882222383637L; @@ -27,12 +27,11 @@ /** * Constructs a ranking request with the appropriate ranking. * @param id - * @param ranking + * @param rankings */ - public RegulationRankingRequest(Identifier id, int[] ranking) { + public RegulationRankingRequest(Identifier id, int[] rankings) { super(id); - this.rankings = ranking; -// this.rankedRegulationData = rankedRegulationData; + this.rankings = rankings; } public RegulationRankingRequest(Identifier id, SortedSet<RegulationData> rankedRegulationData) { Added: foraging/trunk/src/main/java/edu/asu/commons/foraging/event/SanctionAppliedEvent.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/event/SanctionAppliedEvent.java (rev 0) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/event/SanctionAppliedEvent.java 2010-03-23 23:08:38 UTC (rev 492) @@ -0,0 +1,52 @@ +package edu.asu.commons.foraging.event; + +import edu.asu.commons.event.AbstractPersistableEvent; +import edu.asu.commons.net.Identifier; + +/** + * $Id$ + * + * Persistable event marking an applied sanction. + * + * @author <a href='mailto:All...@as...'>Allen Lee</a> + * @version $Rev$ + */ + +public class SanctionAppliedEvent extends AbstractPersistableEvent { + + private static final long serialVersionUID = 8025713540660478354L; + + private Identifier target; + private int sanctionCost; + private int sanctionPenalty; + + public SanctionAppliedEvent(Identifier source) { + super(source); + } + + public Identifier getTarget() { + return target; + } + + public void setTarget(Identifier target) { + this.target = target; + } + + public int getSanctionCost() { + return sanctionCost; + } + + public void setSanctionCost(int sanctionCost) { + this.sanctionCost = sanctionCost; + } + + public int getSanctionPenalty() { + return sanctionPenalty; + } + + public void setSanctionPenalty(int sanctionPenalty) { + this.sanctionPenalty = sanctionPenalty; + } + + +} Deleted: foraging/trunk/src/main/java/edu/asu/commons/foraging/event/SanctionRankingRequest.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/event/SanctionRankingRequest.java 2010-03-10 22:23:56 UTC (rev 491) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/event/SanctionRankingRequest.java 2010-03-23 23:08:38 UTC (rev 492) @@ -1,21 +0,0 @@ -package edu.asu.commons.foraging.event; - -import edu.asu.commons.event.AbstractEvent; -import edu.asu.commons.net.Identifier; - -public class SanctionRankingRequest extends AbstractEvent{ - - private static final long serialVersionUID = 6453457534654365745L; - - private int[] rankings; - - public SanctionRankingRequest(Identifier id, int[] ranking) { - super(id); - this.rankings = ranking; - } - - public int[] getRankings() { - return rankings; - } - -} Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ClientData.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ClientData.java 2010-03-10 22:23:56 UTC (rev 491) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ClientData.java 2010-03-23 23:08:38 UTC (rev 492) @@ -9,6 +9,7 @@ import edu.asu.commons.foraging.client.Circle; import edu.asu.commons.foraging.conf.RoundConfiguration; +import edu.asu.commons.foraging.conf.RoundConfiguration.SanctionAction; import edu.asu.commons.foraging.event.RealTimeSanctionRequest; import edu.asu.commons.foraging.graphics.Point3D; import edu.asu.commons.net.Identifier; @@ -33,7 +34,6 @@ private int[] regulationRankings; private int[] enforcementRankings; - private int[] sanctionRankings; private ForagingRole foragingRole = ForagingRole.HARVEST; @@ -43,6 +43,7 @@ private int tokensCollectedLastRound; private int sanctionBonuses; private int sanctionPenalties; + // stores the accumulated cost of sanctioning that this user has paid this round. private int sanctionCosts; private int assignedNumber; private Point3D position; @@ -164,33 +165,41 @@ // used for real time sanctioning public void sanctionCost() { RoundConfiguration roundConfiguration = getGroupDataModel().getRoundConfiguration(); - String sanctionAction = roundConfiguration.getSanctionAction(); - if (sanctionAction.equals("fine")) { + SanctionAction sanctionAction = roundConfiguration.getSanctionAction(); + if (sanctionAction.isFine()) { final int sanctionCost = roundConfiguration.getSanctionCost(); sanctionCosts += sanctionCost; subtractTokens(sanctionCost); } - else if (sanctionAction.equals("freeze")) { + else if (sanctionAction.isFreeze()) { freeze( roundConfiguration.getSanctionCost() ); } } - private void subtractTokens(int amount) { - currentTokens = Math.max(currentTokens - amount, 0); - totalTokens = Math.max(totalTokens - amount, 0); + private int subtractTokens(int amount) { + int tokensToSubtract = Math.min(currentTokens, amount); + currentTokens = currentTokens - tokensToSubtract; + totalTokens = totalTokens - tokensToSubtract; + return tokensToSubtract; } - public void sanctionPenalty() { + public int sanctionPenalty() { RoundConfiguration roundConfiguration = getGroupDataModel().getRoundConfiguration(); - String sanctionAction = roundConfiguration.getSanctionAction(); - if (sanctionAction.equals("fine")) { + SanctionAction sanctionAction = roundConfiguration.getSanctionAction(); + // FIXME: add logic to SanctionAction instead, i.e., + // sanctionAction.apply(clientData); + // that performs this conditional logic based on the actual action in place. + if (sanctionAction.isFine()) { final int sanctionPenalty = roundConfiguration.getSanctionPenalty(); sanctionPenalties += sanctionPenalty; - subtractTokens(sanctionPenalty); + return subtractTokens(sanctionPenalty); } - else if (sanctionAction.equals("freeze")) { + else if (sanctionAction.isFreeze()) { freeze( roundConfiguration.getSanctionPenalty() ); } + // in the case of freeze, the return value is meaningless. + return -1; + } /** @@ -530,14 +539,6 @@ public void setRegulationRankings(int[] regulationRankings) { this.regulationRankings = regulationRankings; } - - public void setSanctionRankings(int[] sanctionRankings) { - this.sanctionRankings = sanctionRankings; - } - - public int[] getSanctionRankings() { - return sanctionRankings; - } public int[] getEnforcementRankings() { return enforcementRankings; Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java 2010-03-10 22:23:56 UTC (rev 491) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java 2010-03-23 23:08:38 UTC (rev 492) @@ -22,7 +22,6 @@ import edu.asu.commons.foraging.event.MonitorTaxEvent; import edu.asu.commons.foraging.event.PostRoundSanctionRequest; import edu.asu.commons.foraging.event.RegulationRankingRequest; -import edu.asu.commons.foraging.event.SanctionRankingRequest; import edu.asu.commons.foraging.event.SubmitRegulationRequest; import edu.asu.commons.foraging.event.SynchronizeClientEvent; import edu.asu.commons.foraging.event.TokenCollectedEvent; @@ -66,7 +65,7 @@ private volatile int receivedRegulationRankings = 0; private volatile int receivedSanctionRankings = 0; private EnforcementMechanism activeEnforcementMechanism = EnforcementMechanism.NONE; - private SanctionMechanism activeSanctionMechanism = SanctionMechanism.NOSANCTION; + private SanctionMechanism activeSanctionMechanism = SanctionMechanism.NONE; private RegulationData activeRegulation; private List<ClientData> waitingMonitors; @@ -261,9 +260,9 @@ int maxRankingIndex = 0; double maxRankingValue = 0.0d; for (ClientData clientData: clients.values()) { - int[] sanctionRankings = clientData.getSanctionRankings(); + int[] sanctionRankings = clientData.getEnforcementRankings(); System.out.println("Server ranks: "+sanctionRankings[0]+" "+sanctionRankings[1]); - logger.info("XXX: sanction rankings: " + sanctionRankings); + logger.info("XXX: sanction rankings: " + Arrays.asList(sanctionRankings)); for (int rank = 0; rank < sanctionRankings.length; rank++) { // 0 is top choice int actualSanctionIndex = sanctionRankings[rank]; @@ -340,7 +339,7 @@ clearResourceDistribution(); tokensCollectedDuringInterval = 0; activeEnforcementMechanism = EnforcementMechanism.NONE; - activeSanctionMechanism = SanctionMechanism.NOSANCTION; + activeSanctionMechanism = SanctionMechanism.NONE; submittedRegulations.clear(); activeMonitor = null; } @@ -736,8 +735,8 @@ receivedRegulationRankings++; } - public void submitSanctionRanking(SanctionRankingRequest request) { - clients.get(request.getId()).setSanctionRankings(request.getRankings()); + public void submitSanctionRanking(EnforcementRankingRequest request) { + clients.get(request.getId()).setEnforcementRankings(request.getRankings()); receivedSanctionRankings++; } Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/model/SanctionMechanism.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/model/SanctionMechanism.java 2010-03-10 22:23:56 UTC (rev 491) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/model/SanctionMechanism.java 2010-03-23 23:08:38 UTC (rev 492) @@ -2,8 +2,8 @@ public enum SanctionMechanism { - NOSANCTION("No Sanctioning","Everybody can harvest. Nobody can subtract tokens from others"), - ALLOWSANCTION("Everybody can sanction","Every participant can reduce the tokens of other participants by pressing the number key associated with that participant."); + NONE("No Sanctioning","Everybody can harvest. Nobody can subtract tokens from others"), + EVERYBODY_CAN_SANCTION("Everybody can sanction","Every participant can reduce the tokens of other participants by pressing the number key associated with that participant."); private final String title; @@ -28,7 +28,7 @@ return values()[index]; } System.err.println("Returning NONE. No sanction mechanism for out-of-bounds index: " + index); - return NOSANCTION; + return NONE; // throw new IllegalArgumentException("No enforcement mechanism for index: " + index); } Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java 2010-03-10 22:23:56 UTC (rev 491) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java 2010-03-23 23:08:38 UTC (rev 492) @@ -51,7 +51,7 @@ import edu.asu.commons.foraging.event.RegulationUpdateEvent; import edu.asu.commons.foraging.event.ResetTokenDistributionRequest; import edu.asu.commons.foraging.event.RoundStartedEvent; -import edu.asu.commons.foraging.event.SanctionRankingRequest; +import edu.asu.commons.foraging.event.SanctionAppliedEvent; import edu.asu.commons.foraging.event.SanctionUpdateEvent; import edu.asu.commons.foraging.event.ShowInstructionsRequest; import edu.asu.commons.foraging.event.SubmitRegulationRequest; @@ -87,21 +87,8 @@ private final Map<Identifier, ClientData> clients = new HashMap<Identifier, ClientData>(); - //private enum clientRoles {MONITER, HARVEST, SANCTION, HARVESTANDSANCTION}; - public static final int MONITER = 0; - public static final int HARVEST = 1; - public static final int SANCTION = 2; - public static final int HARVESTANDSANCTION = 3; - - public static final int NO_SANCTIONS = 0; - public static final int HARVEST_WITH_SANCTION = 1; - public static final int RANDOM_SANCTIONER = 2; - public static final int CIRCULAR_MONITERING = 3; - - public final static int SYNCHRONIZATION_FREQUENCY = 60; public final static int SERVER_SLEEP_INTERVAL = 100; - public final static int MAX_CLIENTS_PER_GROUP = 5; private Identifier facilitatorId; @@ -302,8 +289,8 @@ } }); - addEventProcessor(new EventTypeProcessor<SanctionRankingRequest>(SanctionRankingRequest.class) { - public void handle(final SanctionRankingRequest request) { + addEventProcessor(new EventTypeProcessor<EnforcementRankingRequest>(EnforcementRankingRequest.class) { + public void handle(final EnforcementRankingRequest request) { GroupDataModel group = serverDataModel.getGroup(request.getId()); group.submitSanctionRanking(request); if (group.hasReceivedAllSanctionRankings()) { @@ -485,8 +472,6 @@ } private void handleEnforcementSanctionRequest(RealTimeSanctionRequest request) { - System.out.println("**************Inside the handleEnforcementSanction"); - ClientData sourceClient = clients.get(request.getSource()); ClientData targetClient = clients.get(request.getTarget()); @@ -601,26 +586,37 @@ } private void handleRealTimeSanctionRequest(RealTimeSanctionRequest request) { - System.out.println("**************Inside the handleRealTimeSanction"); - - ClientData targetClient = clients.get(request.getTarget()); ClientData sourceClient = clients.get(request.getSource()); + ClientData targetClient = clients.get(request.getTarget()); // validate request //FIXME:Added a new test condition to check for the simplified version of sanctioning - boolean invalidSanctionRequest = sourceClient.getCurrentTokens() == 0 || targetClient.getCurrentTokens() == 0 || sourceClient.getGroupDataModel().isResourceDistributionEmpty() || (sourceClient.getGroupDataModel().getActiveSanctionMechanism()== SanctionMechanism.NOSANCTION); + boolean invalidSanctionRequest = sourceClient.getCurrentTokens() == 0 || targetClient.getCurrentTokens() == 0 || sourceClient.getGroupDataModel().isResourceDistributionEmpty() || (sourceClient.getGroupDataModel().getActiveSanctionMechanism()== SanctionMechanism.NONE); if ( invalidSanctionRequest ) { // ignore the sanction request, send a message to the sanctioner. logger.warning("Ignoring token reduction request, sending new client error message event to : " + sourceClient.getId()); - if (sourceClient.getGroupDataModel().getActiveSanctionMechanism()== SanctionMechanism.NOSANCTION) + if (sourceClient.getGroupDataModel().getActiveSanctionMechanism()== SanctionMechanism.NONE) { transmit(new ClientMessageEvent(sourceClient.getId(), - String.format("Ignoring token reduction request: Sanctioning not allowed in this round", targetClient.getAssignedNumber()))); - else + String.format("Ignoring token reduction request: Sanctioning not allowed in this round", targetClient.getAssignedNumber()))); + } + else { transmit(new ClientMessageEvent(sourceClient.getId(), String.format("Ignoring token reduction request: # %d does not have any tokens to reduce.", targetClient.getAssignedNumber()))); + } return; } sourceClient.sanctionCost(); - targetClient.sanctionPenalty(); + int subtractedTokens = targetClient.sanctionPenalty(); + // generate sanction applied event + SanctionAppliedEvent sanctionAppliedEvent = new SanctionAppliedEvent(sourceClient.getId()); + // the sanction cost should always be set since the client should prevent any sanction requests from being emitted + // if the user doesn't have enough tokens to issue the request. + sanctionAppliedEvent.setSanctionCost(getCurrentRoundConfiguration().getSanctionCost()); + // the sanction penalty may be in the range [1, RoundConfiguration.getSanctionPenalty()] - + // if target has less than the actual sanction penalty they just get their tokens reduced to 0. + sanctionAppliedEvent.setSanctionPenalty(subtractedTokens); + sanctionAppliedEvent.setTarget(targetClient.getId()); + persister.store(sanctionAppliedEvent); + // add sanction request to the target client so they can figure out who just sanctioned them targetClient.getLatestSanctions().add(request); transmit(new ClientMessageEvent(sourceClient.getId(), @@ -716,128 +712,6 @@ // FIXME: handle reconfiguration requests from facilitator } -// private double getRank(int rankNo) { -// double actualRank = 0; -// if (rankNo == 0) actualRank=1; -// if (rankNo == 1) actualRank=0.5; -// if (rankNo == 2) actualRank=0.33; -// if (rankNo == 3) actualRank=0.25; -// if (rankNo == 4) actualRank=0.2; -// return actualRank; -// } -// -// private int findMax(double voteArray[], int loopCount) -// { -// double max = voteArray[0]; -// int i=0; -// int index=0; -// for(i=0 ; i < loopCount ; i++) -// { -// if(voteArray[i] > max) -// { -// index = i; -// max = voteArray[i]; -// } -// } -// return index; -// } - -// private void sendNewRolesToClients(Identifier id, int roles[]) { -// ClientRole clientRole = new ClientRole(); -// clientRole.setClientRoles(roles); -// int i = 0; -// for (Identifier targetId : clients.get(id).getGroupDataModel().getClientIdentifiers()) { -// NewClientRole newClientRole = new NewClientRole(targetId); -// clientRole.setClientId(targetId); -// clientRole.setRoleNo(i); -// if(roles[i] == MONITER)clientRole.setMoniterId(targetId); -// clients.get(targetId).setClientRole(clientRole); -// newClientRole.setRoleObj(clientRole); -// transmit(newClientRole); -// getLogger().info("transmitted timesliced client roles"); -// i++; -// } -// } - - // private int [] findClientRoles(GroupDataModel group, int index) { - // int roles [] = new int [MAX_CLIENTS_PER_GROUP]; - // int i; - // System.out.println("Finding roles for mechanism : "+index); - // switch(index){ - // case NO_SANCTIONS: - // for(i=0; i<MAX_CLIENTS_PER_GROUP; i++){ - // roles[i] = HARVEST; - // } - // break; - // - // case HARVEST_WITH_SANCTION: - // for(i=0; i<MAX_CLIENTS_PER_GROUP; i++){ - // roles[i] = HARVESTANDSANCTION; - // } - // break; - // - // case RANDOM_SANCTIONER: - // roles[0] = MONITER; - // for(i=1; i<MAX_CLIENTS_PER_GROUP; i++){ - // roles[i] = HARVEST; - // } - // break; - // - // case CIRCULAR_MONITERING: - // // first client is given the chance to sanction - // int moniter = group.getRandomMoniterCount(); - // group.incrRandomMoniterCount(); - // roles[moniter] = MONITER; - // - // //roles[0] = MONITER; - // for(i=0; i<MAX_CLIENTS_PER_GROUP; i++){ - // if(i != moniter)roles[i] = HARVEST; - // } - // - // group.setGroupRoles(roles); - // break; - // } - // return roles; - // } - -// -// -// -// -// private void calculateRegulationTheResult(SubmitRegulationRequest request) { -// double[] voteArray = new double[5]; -// Arrays.fill(voteArray, 0.0d); -// Identifier source = request.getId(); -// // relay to all clients in this client's group. -// RegulationData regulationData; -// int currentRankingInformation[] = new int[5]; -// getLogger().info("sending regulation votes to all group participants"); -// for (Identifier targetId : clients.get(source).getGroupDataModel().getClientIdentifiers()) { -// currentRankingInformation = clients.get(targetId).getRegulationRankings(); -// // -// for(int i=0 ; i<5 ; i++) -// { -// System.out.println(currentRankingInformation[i]); -// } -// // -// for(int i=0 ; i<5 ; i++) -// { -// System.out.println(getRank(i)); -// if(currentRankingInformation[i] >= 0) -// voteArray[currentRankingInformation[i]] = voteArray[currentRankingInformation[i]] + getRank(i); -// } -// } -// -// int index = findMax(voteArray, 5); -// regulations.clear(); -// for (Identifier targetId : clients.get(source).getGroupDataModel().getClientIdentifiers()) { -// RegulationEvent regulationEvent = new RegulationEvent(regulations); -// transmit(regulationEvent); -// getLogger().info("transmitted voted regulation"); -// } -// -// } - private void relayChatRequest(ChatRequest request) { Identifier source = request.getSource(); Identifier target = request.getTarget(); @@ -860,24 +734,7 @@ persister.store(request); } - // private void checkMonitorStatus(GroupDataModel group) { - // - // if (currentRoundDuration.getElapsedTimeInSeconds()%48 == 0) { - // int[] roles = new int[MAX_CLIENTS_PER_GROUP]; - // // for(GroupDataModel group : serverDataModel.getGroups()) { - // // determine roles for the entire group - // - // // update all clients with the roles - // roles = findClientRoles(group, 3); - // - // for(Identifier targetId: group.getClientIdentifiers()) { - // sendNewRolesToClients(targetId, roles); - // } - // // } - // } - // } - - // FIXME: remove Dispatcher reference if it's unused. + // FIXME: remove Dispatcher reference if it's unused. public void execute(Dispatcher dispatcher) { switch (serverState) { case ROUND_IN_PROGRESS: @@ -914,49 +771,6 @@ } } -// private int calculatePolicingPayment(int totalTokens) { -// return (totalTokens / 4); -// } - -// private void adjustTokens(GroupDataModel group) { -// System.out.println("Adjusting tokens : "); -// int roles [] = group.getGroupRoles(); -// -// for(int i = 0 ; i < roles.length ; i++) -// System.out.println(roles[i]); -// -// ClientRole clientRole = new ClientRole(); -// int policingTokens = 0; -// Identifier moniterId = null; -// //System.out.println("No of clients: "+ clients.size()); -// -// int i = 0; -// -// for(Identifier targetId : group.getClientIdentifiers()) { -// clientRole = clients.get(targetId).getClientRole(); -// int roleNo = clientRole.getRoleNo(); -// System.out.println("Role no :"+roleNo); -// System.out.println("Client Id:"+clients.get(targetId).getId()); -// if(roles[roleNo] != MONITER) { -// policingTokens += calculatePolicingPayment(clients.get(targetId).getCurrentTokens()); -// } -// else { -// System.out.println("Setting the moniterId"); -// moniterId = targetId; -// } -// i++; -// } -// group.getClientData(moniterId).addTokens(policingTokens); -// } - -// private boolean isTokenAdjustmentRequired() { -// if(enforcementData == null)return false; -// else if(enforcementData.getResultIndex() == 2 || enforcementData.getResultIndex() == 3) return true; -// else return false; -// } - - - private void processRound3d() { boolean secondHasPassed = secondTick.hasExpired(); if (secondHasPassed) { Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/util/ForagingSaveFileConverter.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/util/ForagingSaveFileConverter.java 2010-03-10 22:23:56 UTC (rev 491) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/util/ForagingSaveFileConverter.java 2010-03-23 23:08:38 UTC (rev 492) @@ -22,9 +22,11 @@ import edu.asu.commons.experiment.SavedRoundData; import edu.asu.commons.foraging.conf.RoundConfiguration; import edu.asu.commons.foraging.event.ClientPoseUpdate; +import edu.asu.commons.foraging.event.EnforcementRankingRequest; import edu.asu.commons.foraging.event.HarvestFruitRequest; import edu.asu.commons.foraging.event.HarvestResourceRequest; import edu.asu.commons.foraging.event.MovementEvent; +import edu.asu.commons.foraging.event.RealTimeSanctionRequest; import edu.asu.commons.foraging.event.ResourceAddedEvent; import edu.asu.commons.foraging.event.ResourcesAddedEvent; import edu.asu.commons.foraging.event.TokenCollectedEvent; @@ -40,26 +42,28 @@ /** * $Id$ - * - * Save file processors for binary savefiles for the foraging experiment. + * <p> + * Save file processors used to convert binary data files from the foraging experiment. * * @author <a href='mailto:All...@as...'>Allen Lee</a> * @version $Rev$ */ @SuppressWarnings("unused") public class ForagingSaveFileConverter { + + private static final int DEFAULT_AGGREGATE_TIME_INTERVAL = 5; public static boolean convert(String saveDataDirectory) { File allSaveFilesDirectory = new File(saveDataDirectory); if (allSaveFilesDirectory.exists() && allSaveFilesDirectory.isDirectory()) { List<SaveFileProcessor> processors = new ArrayList<SaveFileProcessor>(); processors.addAll(Arrays.asList( -// new AllDataProcessor(), + new AllDataProcessor(), new AggregateTimeIntervalProcessor(), -// new SummaryProcessor(), + new SummaryProcessor(), new AggregateTokenSpatialDistributionProcessor(), -// new CollectedTokenSpatialDistributionProcessor(), -// new MovementStatisticsProcessor(), + new CollectedTokenSpatialDistributionProcessor(), + new MovementStatisticsProcessor(), new AggregateCollectedTokenNeighborProcessor() // new MovieCreatorProcessor() )); @@ -273,6 +277,9 @@ } private static class AggregateTokenSpatialDistributionProcessor extends SaveFileProcessor.Base { + public AggregateTokenSpatialDistributionProcessor() { + setSecondsPerInterval(DEFAULT_AGGREGATE_TIME_INTERVAL); + } @Override public void process(SavedRoundData savedRoundData, PrintWriter writer) { ServerDataModel serverDataModel = (ServerDataModel) savedRoundData.getDataModel(); @@ -529,6 +536,21 @@ System.err.println(line); writer.println(line); } + else if (event instanceof RealTimeSanctionRequest) { + RealTimeSanctionRequest request = (RealTimeSanctionRequest) event; + Identifier source = request.getSource(); + Identifier target = request.getTarget(); + String line = String.format("%s, %s, %s, %s", savedRoundData.toSecondString(event), source, target, request.toString()); + writer.println(line); + } + else if (event instanceof EnforcementRankingRequest) { + EnforcementRankingRequest request = (EnforcementRankingRequest) event; + Identifier id = request.getId(); + String line = String.format("%s, %s, %s, %s", savedRoundData.toSecondString(event), id, request.toString(), Arrays.asList(request.getRankings())); + } + else { + writer.println(String.format("%s, %s", savedRoundData.toSecondString(event), event.toString())); + } } } @@ -600,8 +622,10 @@ public static class AggregateCollectedTokenNeighborProcessor extends SaveFileProcessor.Base { - public AggregateCollectedTokenNeighborProcessor() { - setSecondsPerInterval(60); + + + public AggregateCollectedTokenNeighborProcessor() { + setSecondsPerInterval(DEFAULT_AGGREGATE_TIME_INTERVAL); } public void process(SavedRoundData savedRoundData, PrintWriter writer) { @@ -676,6 +700,9 @@ public static class AggregateTimeIntervalProcessor extends SaveFileProcessor.Base { + public AggregateTimeIntervalProcessor() { + setSecondsPerInterval(DEFAULT_AGGREGATE_TIME_INTERVAL); + } public void process(SavedRoundData savedRoundData, PrintWriter writer) { // populate the ordered identifiers, try directly from the participant tokens map that // is persisted in later versions of the experiment. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Allen L. (JIRA) <jef...@as...> - 2010-03-11 17:59:59
|
[ http://opensource.asu.edu/jira/browse/COMMONS-31?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=10052#action_10052 ] Allen Lee commented on COMMONS-31: ---------------------------------- Network averages for group rounds go back up: sod19.asu.edu => 10.208.96.194 142Kb 171Kb 147Kb <= 40.3Kb 38.3Kb 33.8Kb sod19.asu.edu => 10.208.97.70 143Kb 141Kb 149Kb <= 52.7Kb 50.4Kb 44.0Kb sod19.asu.edu => 10.208.96.191 142Kb 141Kb 140Kb <= 35.8Kb 42.6Kb 40.3Kb sod19.asu.edu => 10.208.96.185 139Kb 157Kb 144Kb <= 20.0Kb 21.8Kb 31.1Kb sod19.asu.edu => 10.208.97.68 140Kb 140Kb 145Kb <= 36.8Kb 37.1Kb 36.1Kb sod19.asu.edu => 10.208.97.72 140Kb 139Kb 138Kb <= 44.5Kb 36.9Kb 28.1Kb sod19.asu.edu => 10.208.96.222 139Kb 140Kb 139Kb <= 7.28Kb 35.1Kb 30.7Kb sod19.asu.edu => 10.208.96.198 140Kb 139Kb 145Kb <= 32.5Kb 34.7Kb 33.7Kb sod19.asu.edu => 10.208.98.66 139Kb 153Kb 139Kb <= 32.2Kb 17.6Kb 6.79Kb sod19.asu.edu => 10.208.96.193 139Kb 138Kb 146Kb <= 2.97Kb 12.0Kb 11.6Kb sod19.asu.edu => 10.208.96.186 137Kb 137Kb 139Kb <= 3.28Kb 8.23Kb 28.5Kb sod19.asu.edu => 10.208.96.189 137Kb 135Kb 139Kb <= 2.97Kb 3.19Kb 3.44Kb sod19.asu.edu => 10.208.96.223 137Kb 135Kb 139Kb <= 3.28Kb 3.19Kb 3.22Kb sod19.asu.edu => 10.208.96.195 137Kb 135Kb 135Kb <= 3.12Kb 3.12Kb 3.16Kb sod19.asu.edu => 10.208.97.69 137Kb 135Kb 134Kb <= 3.28Kb 3.12Kb 3.05Kb sod19.asu.edu => 10.208.97.192 4.44Kb 4.77Kb 4.47Kb <= 320b 320b 376b > performance > ----------- > > Key: COMMONS-31 > URL: http://opensource.asu.edu/jira/browse/COMMONS-31 > Project: The Virtual Commons > Issue Type: Improvement > Components: foraging > Reporter: Allen Lee > Assignee: Deepak Barge > > Based on iftop, the network traffic to/from each host averages around 145 Kb for server -> client and 40-50 Kb from client->server (see below snapshot for a badly formatted example). > We should be able to improve performance by carefully monitoring what data we send, and how frequently we send it. That would be in processRound2d() and the SERVER_SLEEP_INTERVAL in ForagingServer. > 145 Kb > sod19.asu.edu => 10.208.96.195 145Kb 145Kb 160Kb > <= 49.1Kb 46.1Kb 42.9Kb > sod19.asu.edu => 10.208.96.191 144Kb 144Kb 160Kb > <= 35.9Kb 36.8Kb 36.6Kb > sod19.asu.edu => 10.208.97.68 143Kb 144Kb 144Kb > <= 32.2Kb 36.2Kb 33.9Kb > sod19.asu.edu => 10.208.97.70 143Kb 144Kb 144Kb > <= 34.5Kb 35.1Kb 38.8Kb > sod19.asu.edu => 10.208.97.69 144Kb 144Kb 160Kb > <= 36.4Kb 34.6Kb 39.3Kb > sod19.asu.edu => 10.208.96.194 143Kb 144Kb 144Kb > <= 28.0Kb 34.4Kb 35.4Kb > sod19.asu.edu => 10.208.96.185 144Kb 143Kb 159Kb > <= 36.6Kb 28.7Kb 28.3Kb > sod19.asu.edu => 10.208.96.186 143Kb 142Kb 143Kb > <= 23.9Kb 24.4Kb 24.2Kb > sod19.asu.edu => 10.208.97.72 142Kb 142Kb 159Kb > <= 23.1Kb 17.0Kb 25.4Kb > sod19.asu.edu => 10.208.96.189 142Kb 142Kb 157Kb > <= 27.0Kb 13.5Kb 15.6Kb > sod19.asu.edu => 10.208.97.192 4.81Kb 3.72Kb 2.82Kb > <= 320b 320b 304b > 129.219.246.77 => ALL-ROUTERS.MCAST.NET 1.12Kb 883b 931b -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.asu.edu/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Allen L. (JIRA) <jef...@as...> - 2010-03-11 17:44:09
|
[ http://opensource.asu.edu/jira/browse/COMMONS-31?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Allen Lee updated COMMONS-31: ----------------------------- Summary: performance (was: networking performance) More data from 3/11 pretest, 15 participants: CPU utilization averages around 3-5% iftop reports data transfer averages drops about 40Kb to 105Kb per second from server->client and 30-37Kb from client->server sod19.asu.edu => 10.208.96.195 105Kb 104Kb 106Kb <= 37.2Kb 34.6Kb 29.3Kb sod19.asu.edu => 10.208.97.68 106Kb 104Kb 109Kb <= 33.3Kb 31.3Kb 27.1Kb sod19.asu.edu => 10.208.96.186 105Kb 103Kb 107Kb <= 30.6Kb 31.1Kb 26.5Kb sod19.asu.edu => 10.208.96.198 97.9Kb 103Kb 104Kb <= 29.5Kb 30.5Kb 17.5Kb sod19.asu.edu => 10.208.96.185 101Kb 102Kb 107Kb <= 26.5Kb 29.9Kb 20.9Kb sod19.asu.edu => 10.208.97.70 102Kb 102Kb 106Kb <= 33.9Kb 30.6Kb 32.2Kb sod19.asu.edu => 10.208.97.69 100Kb 101Kb 109Kb <= 21.3Kb 27.6Kb 33.2Kb sod19.asu.edu => 10.208.96.191 107Kb 103Kb 108Kb <= 18.5Kb 24.7Kb 23.2Kb sod19.asu.edu => 10.208.96.222 99.6Kb 100Kb 109Kb <= 21.5Kb 26.2Kb 21.7Kb sod19.asu.edu => 10.208.96.223 101Kb 100Kb 107Kb <= 23.9Kb 21.3Kb 20.7Kb sod19.asu.edu => 10.208.96.189 106Kb 101Kb 109Kb <= 31.2Kb 19.2Kb 19.1Kb sod19.asu.edu => 10.208.97.72 103Kb 103Kb 105Kb <= 20.1Kb 16.5Kb 19.4Kb sod19.asu.edu => 10.208.98.66 99.3Kb 100Kb 107Kb <= 17.3Kb 18.9Kb 26.2Kb sod19.asu.edu => 10.208.96.194 100Kb 99.8Kb 106Kb <= 30.6Kb 15.9Kb 19.9Kb sod19.asu.edu => 10.208.96.193 103Kb 100Kb 106Kb <= 2.03Kb 9.51Kb 20.5Kb sod19.asu.edu => 10.208.97.192 5.12Kb 7.93Kb 3.27Kb <= 320b 704b 280b > performance > ----------- > > Key: COMMONS-31 > URL: http://opensource.asu.edu/jira/browse/COMMONS-31 > Project: The Virtual Commons > Issue Type: Improvement > Components: foraging > Reporter: Allen Lee > Assignee: Deepak Barge > > Based on iftop, the network traffic to/from each host averages around 145 Kb for server -> client and 40-50 Kb from client->server (see below snapshot for a badly formatted example). > We should be able to improve performance by carefully monitoring what data we send, and how frequently we send it. That would be in processRound2d() and the SERVER_SLEEP_INTERVAL in ForagingServer. > 145 Kb > sod19.asu.edu => 10.208.96.195 145Kb 145Kb 160Kb > <= 49.1Kb 46.1Kb 42.9Kb > sod19.asu.edu => 10.208.96.191 144Kb 144Kb 160Kb > <= 35.9Kb 36.8Kb 36.6Kb > sod19.asu.edu => 10.208.97.68 143Kb 144Kb 144Kb > <= 32.2Kb 36.2Kb 33.9Kb > sod19.asu.edu => 10.208.97.70 143Kb 144Kb 144Kb > <= 34.5Kb 35.1Kb 38.8Kb > sod19.asu.edu => 10.208.97.69 144Kb 144Kb 160Kb > <= 36.4Kb 34.6Kb 39.3Kb > sod19.asu.edu => 10.208.96.194 143Kb 144Kb 144Kb > <= 28.0Kb 34.4Kb 35.4Kb > sod19.asu.edu => 10.208.96.185 144Kb 143Kb 159Kb > <= 36.6Kb 28.7Kb 28.3Kb > sod19.asu.edu => 10.208.96.186 143Kb 142Kb 143Kb > <= 23.9Kb 24.4Kb 24.2Kb > sod19.asu.edu => 10.208.97.72 142Kb 142Kb 159Kb > <= 23.1Kb 17.0Kb 25.4Kb > sod19.asu.edu => 10.208.96.189 142Kb 142Kb 157Kb > <= 27.0Kb 13.5Kb 15.6Kb > sod19.asu.edu => 10.208.97.192 4.81Kb 3.72Kb 2.82Kb > <= 320b 320b 304b > 129.219.246.77 => ALL-ROUTERS.MCAST.NET 1.12Kb 883b 931b -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.asu.edu/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: <al...@us...> - 2010-03-10 22:24:03
|
Revision: 491 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=491&view=rev Author: alllee Date: 2010-03-10 22:23:56 +0000 (Wed, 10 Mar 2010) Log Message: ----------- voting + full vision treatment Added Paths: ----------- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round0.xml foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round1.xml foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round2.xml foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round3.xml foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round4.xml foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round5.xml foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round6.xml foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/server.xml Added: foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round0.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round0.xml (rev 0) +++ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round0.xml 2010-03-10 22:23:56 UTC (rev 491) @@ -0,0 +1,67 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="resource-width">13</entry> +<entry key="resource-depth">13</entry> +<entry key="practice-round">true</entry> +<entry key="private-property">true</entry> +<entry key="duration">240</entry> + +<entry key="quiz">true</entry> +<entry key="q1">C</entry> +<entry key="q2">B</entry> + +<entry key='instructions'> +<![CDATA[ +<h3>Practice Round Instructions</h3> +<hr> +<p> +You will now have four minutes to practice with the experimental environment. +The decisions you make in this round will NOT influence your earnings. At the +At the beginning of the practice round half of the cells are occupied +with green tokens. The environment is a 13 x 13 grid of cells. +</p> +<p> +During this practice round, and <b>only during</b> this practice round, you are able +to reset the tokens displayed on the screen by pressing the <b>R</b> key. When you +press the <b>R</b> key you will reset the resource to its initial distribution, +randomly filling half of the cells. +</p> +<p><b> Please do not communicate with any other participant.</b></p> +<p>If you have any questions please raise your hand. <b>Do you have any +questions so far?</b></p> +]]> +</entry> + +<entry key="quiz-instructions"> +<![CDATA[ +<p> +Before we begin the practice round you need to answer the following questions +correctly. You can only continue when you have answered all questions +correctly. If an error is made you will need to answer the questions again. +</p> +<br> +<form> +Which of the statements is <b><u>incorrect</u></b>? <br> +<input type="radio" name="q1" value="A">Your decisions of where to collect tokens affects the regeneration of tokens.<br> +<input type="radio" name="q1" value="B">When you have collected all tokens on +the screen, no new tokens will appear.<br> +<input type="radio" name="q1" value="C">Tokens grow from the middle of the +screen.<br> +<input type="radio" name="q1" value="D">In order to collect a token you need +to press the space bar while your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> is on a cell with a token.<br> +<br><br> + +Which sequence of situations is not possible? <br> +<img src="@CODEBASE_URL@/images/question2.jpg"><br> +<input type="radio" name="q2" value="A">A<br> +<input type="radio" name="q2" value="B">B<br> +<input type="radio" name="q2" value="C">C<br> +<br> +<input type="submit" name="submit" value="Submit"> +</form> +]]> +</entry> + +</properties> Added: foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round1.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round1.xml (rev 0) +++ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round1.xml 2010-03-10 22:23:56 UTC (rev 491) @@ -0,0 +1,49 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 1 Instructions</h3> +<hr> +<p> +This is the first round of the experiment. The length of the round is 4 +minutes. Like in the practice round you can collect green tokens. This time +you earn <b>two cents</b> for each token collected. This time you +<b>cannot</b> reset the distribution of green tokens. +</p> +<p> +In this round the renewable resource will become five times bigger. You will share this +larger environment with four other players in this room that have been randomly +selected. One group's resource environment is distinct from the other groups. +</p> +<p> +Each of you has been assigned a number from 1 to 5. These numbers will remain the +same throughout the experiment but you will <b>not</b> be able to identify which +person in the room has been assigned which number, so your anonymity is guaranteed. + +The other four players will appear on the screen as blue dots +<img src="@CODEBASE_URL@/images/gem-other.gif"> with a white +number embedded in the dot. On the top right corner of the screen you can see +how many tokens each player has collected. On the top left corner of the screen you can see +a clock that displays the remaining time in the round.</p> +<p>Since you can only see the resource within your vision you may neither see all +the other participants nor all the resource units. The figure below indicates the +vision range compared to the whole environment</p> +<img src="@CODEBASE_URL@/images/vision-range.jpg"> +<p> +If you have any questions please raise your hand. <b>Do you have any +questions so far?</b> +</p> +]]> +</entry> +</properties> Added: foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round2.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round2.xml (rev 0) +++ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round2.xml 2010-03-10 22:23:56 UTC (rev 491) @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> + + +<!-- enable field of vision for tokens and subjects --> + +<entry key='initial-distribution'>.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 2 Instructions</h3> +<hr> +<p> +Round 2 is the same as round 1. +</p> +<p> +If you have any questions please raise your hand. <b>Do you have any +questions so far?</b> +</p> +]]> +</entry> +</properties> Added: foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round3.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round3.xml (rev 0) +++ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round3.xml 2010-03-10 22:23:56 UTC (rev 491) @@ -0,0 +1,30 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<!-- resource regrowth parameters --> +<entry key="initial-distribution">.25</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 3 Instructions</h3> +<hr> +<p> +Round 3 is the same as round 2. +</p> +<p> +If you have any questions please raise your hand. <b>Do you have any +questions so far?</b> +</p> +]]> +</entry> +</properties> Added: foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round4.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round4.xml (rev 0) +++ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round4.xml 2010-03-10 22:23:56 UTC (rev 491) @@ -0,0 +1,151 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> +<entry key="duration">240</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<!-- before this round begins, we have a chat session --> +<entry key="chat-enabled">true</entry> +<entry key="chat-duration">240</entry> + +<!-- enable sanctioning --> +<entry key="sanction-type">real-time</entry> +<entry key="sanction-cost">1</entry> +<entry key="sanction-multiplier">2</entry> + + +<entry key="initial-distribution">.25</entry> + +<!-- enable quiz --> +<entry key='quiz'>true</entry> +<entry key='q1'>1</entry> +<entry key='q2'>2</entry> +<entry key='q3'>1</entry> +<entry key='q4'>1</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 4 Instructions</h3> +<hr> +<p> +Round 4 is the same as the previous two rounds with two exceptions. +</p> +<p> +Before the next round starts you can anonymously communicate by text messages +for four minutes with the other participants in your group. You can use this +opportunity to discuss the experiment and coordinate your actions to improve +your earnings. You may not promise side-payments after the experiment is +completed or make any threats. You are also not allowed to reveal your real +identity. We are monitoring the chat traffic while you chat. +</p> +<p> +During the next round you will have the option to reduce the earnings of another +participant at a cost to your own earnings. +</p> +<ul> +<li>If you press the numeric key 1-5 corresponding to another participant, you +will reduce the number of tokens they have collected in this round by two +tokens. This will also reduce your own token amount by one token. The decision +whether or when to use this option is up to you. +<li>When you reduce the number of tokens of another participant, they will +receive a message stating that you have reduced their tokens. Likewise, if +another participant reduces your number of tokens, you will also receive a +message. These messages will be displayed on the bottom of your screen. +<li>If your tokens are being reduced or you are reducing another participant's +tokens, you will receive some visual cues. When your tokens are being reduced +your yellow dot will turn red briefly with a blue background. The participant +currently reducing your tokens will turn purple with a white background. +<li>You may reduce the earnings of other participants as long as there are +tokens remaining on the screen and while both you and the other participant +have a positive number of tokens collected during the round. <b>Each time</b> +you press the numeric key corresponding to another participant your token +amount is reduced by <b>one</b>, and their token amount is reduced by +<b>two</b>. <b>Note:</b> You can only remove tokens from a participant that is +visible to you. +</ul> +<p> + +<p> +The length of this round is four minutes. +</p> +<p> +If you have any questions please raise your hand. <b>Do you have any +questions so far?</b> +</p> +]]> +</entry> + +<entry key="chat-instructions"> +<![CDATA[ +<p> +You can now chat with the other participants in your group for 4 minutes +total. During the chat round, you may communicate about any aspect of the +experiment that you would like to discuss with other participants with whom +you have been matched. You may not promise them side-payments after the +experiment is completed or threaten them with any consequence after the +experiment is finished. We are monitoring the chat traffic while you chat. If +we see that somebody reveals his or her identity, we have to stop the +experiment and remove the whole group from which this person is a member out +of this room. +</p> +<p> +You will see other participants labeled as "1", "2","3", "4", or "5" in the +chat box. You can send a chat message by typing into the textfield at the +bottom of the screen and pressing the "enter" key on your keyboard. +</p> +]]> +</entry> +<entry key="quiz-instructions"> +<![CDATA[ +<p>Before the next round begins you must complete the quiz below. You can +only continue when you have answered all questions correctly. If an error is +made you will need to answer the questions again. +</p> + +<form> +Each time I press the numeric keys between 1-5 my tokens will be reduced +by:<br> +<input type="radio" name="q1" value="0">0 tokens<br> +<input type="radio" name="q1" value="1">1 token<br> +<input type="radio" name="q1" value="2">2 tokens<br> +<input type="radio" name="q1" value="4">4 tokens<br> +<br><br> + +Each time I press the numeric keys between 1-5 the number of tokens of the +corresponding participant is reduced by:<br> +<input type="radio" name="q2" value="0">0 tokens<br> +<input type="radio" name="q2" value="1">1 token<br> +<input type="radio" name="q2" value="2">2 tokens<br> +<input type="radio" name="q2" value="4">4 tokens<br> +<br><br> + +The background of your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> turns blue. What does this represent?<br> +<input type="radio" name="q3" value="0">You collected a token<br> +<input type="radio" name="q3" value="1">Another participant is subtracting two +tokens from you<br> +<input type="radio" name="q3" value="2">You are subtracting two tokens from another +participant<br> +<input type="radio" name="q3" value="3">You are moving too fast<br> +<br><br> + +Every time I press the numeric keys between 1-5:<br> +<input type="radio" name="q4" value="0">Two tokens are subtracted from my tokens +collected this round<br> +<input type="radio" name="q4" value="1">One token is subtracted from my tokens +collected this round<br> +<input type="radio" name="q4" value="2">The background of my yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> turns blue +momentarily<br> +<input type="radio" name="q4" value="3">My yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> is paused for two seconds<br> + +<input type="submit" name="submit" value="Submit"> +</form> +]]> +</entry> +</properties> Added: foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round5.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round5.xml (rev 0) +++ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round5.xml 2010-03-10 22:23:56 UTC (rev 491) @@ -0,0 +1,71 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> +<entry key="duration">240</entry> + +<!-- enable sanctioning --> +<entry key="sanction-type">real-time</entry> +<entry key="sanction-cost">1</entry> +<entry key="sanction-multiplier">2</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<!-- before this round begins, we have a chat session --> +<entry key="chat-enabled">true</entry> +<entry key="chat-duration">240</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 5 Instructions</h3> +<hr> +<p> +Round 5 is the same as round 4.</p> +<p> +The length of this round is again four minutes. +</p> +<p> +If you have any questions please raise your hand. <b>Do you have any +questions so far?</b> +</p> +]]> +</entry> + +<entry key="chat-instructions"> +<![CDATA[ +<p> +You can now chat with the other participants in your group for 4 minutes +total. During the chat round, you may communicate about any aspect of the +experiment that you would like to discuss with other participants with whom +you have been matched. You may not promise them side-payments after the +experiment is completed or threaten them with any consequence after the +experiment is finished. We are monitoring the chat traffic while you chat. If +we see that somebody reveals his or her identity, we have to stop the +experiment and remove the whole group from which this person is a member out +of this room. +</p> +<p> +You will see other participants labeled as "1", "2","3", "4", or "5" in the +chat box. You can send a chat message by typing into the textfield at the +bottom of the screen and pressing the "enter" key on your keyboard. +</p> +]]> +</entry> + +<entry key='private-chat-instructions'> +<![CDATA[ +You may send private messages to a specific participant by clicking on the +appropriately labeled button (1, 2, 3, 4, or 5) before typing your message in +the chat box and sending it. By default you are communicating with all +members of your group. +]]> +</entry> + +</properties> Added: foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round6.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round6.xml (rev 0) +++ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/round6.xml 2010-03-10 22:23:56 UTC (rev 491) @@ -0,0 +1,78 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> +<entry key="duration">240</entry> + +<!-- enable sanctioning --> +<entry key="sanction-type">real-time</entry> +<entry key="sanction-cost">1</entry> +<entry key="sanction-multiplier">2</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<!-- before this round begins, we have a chat session --> +<entry key="chat-enabled">true</entry> +<entry key="chat-duration">240</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 6 Instructions</h3> +<hr> +<p> +Round 6 is the same as round 5.</p> +<p> +The length of this round is again four minutes. +</p> +<p> +If you have any questions please raise your hand. <b>Do you have any +questions so far?</b> +</p> +]]> +</entry> + +<entry key="last-round-debriefing"> +<![CDATA[ +<p> +This was the last round, but not the end of the experiment. We will now +determine your payments. While we are doing this, we request that you +carefully fill out a brief survey. +</p> +<p> +When we are ready we will call you one by one to the room next door. We will +pay you there in private. Please wait until your computer number is called, +and then proceed to the room next door to turn in your computer number and +your survey. +</p> +<p> +Please answer the survey carefully and thank you for participating. +</p> +]]> +</entry> + +<entry key="chat-instructions"> +<![CDATA[ +<p> +You can now chat with the other participants in your group for 4 minutes +total. During the chat round, you may communicate about any aspect of the +experiment that you would like to discuss with other participants with whom +you have been matched. You may not promise them side-payments after the +experiment is completed or threaten them with any consequence after the +experiment is finished. We are monitoring the chat traffic while you chat. If +we detect that somebody has revealed their identity, we will have to stop the +experiment and remove that person's entire group from the experiment. +</p> +<p> +You will see other participants labeled as "1", "2","3", "4", or "5" in the +chat box. You can send a chat message by typing into the textfield at the +bottom of the screen and pressing the "enter" key. </p> +]]> +</entry> +</properties> Added: foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/server.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/server.xml (rev 0) +++ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fullvision/server.xml 2010-03-10 22:23:56 UTC (rev 491) @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Costly Sanctioning XML-ized experiment round configuration</comment> +<entry key="hostname">@SERVER_ADDRESS@</entry> +<entry key="port">@PORT_NUMBER@</entry> +<entry key="round0">round0.xml</entry> +<entry key="round1">round1.xml</entry> +<entry key="round2">round2.xml</entry> +<entry key="round3">round3.xml</entry> +<entry key="round4">round4.xml</entry> +<entry key="round5">round5.xml</entry> +<entry key="round6">round6.xml</entry> +<entry key="wait-for-participants">true</entry> +<entry key="number-of-rounds">7</entry> +<entry key="facilitator-instructions"> +<![CDATA[ +<h3>Facilitator Instructions</h3> +<p> +Welcome to the facilitator interface. This interface allows you to control +the experiment. You may only modify configuration parameters <b>before</b> +you start the experiment by selecting the Configuration menu. When all the +participants are ready to begin the experiment, you can start the experiment +by selecting Experiment -> Start. After a round has been completed you +will be able to view the statistics for all of the participants. You can +begin the next round by selecting Round -> Start. +</p> +]]> +</entry> + +<entry key='field-of-vision-instructions'> +<![CDATA[ +Your vision is limited in this experiment. The area that is visible to you will be +shaded. +]]> +</entry> + +<entry key="welcome-instructions"> +<![CDATA[ +<h3>Welcome to the experiment. The experiment will begin shortly after everyone has been +assigned a station.</h3> +<p> +Please <b>wait quietly</b> and <b>do not close this window or open any other applications</b>. +</p> +]]> +</entry> + +<entry key="general-instructions"> +<![CDATA[ +<h3>General Instructions</h3> +<p> +Welcome. You have already earned 5 dollars by showing up at this experiment. You can +earn more, up to a maximum of 40 dollars, by participating in this experiment, which +will take about an hour to an hour and a half. The amount of money you earn depends +on your decisions as well as the decisions of other people in this room during the +six rounds of the experiment. +</p> +<p> +You appear on the screen as a yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif">. +You move by pressing the four arrow keys on your keyboard. You can move up, down, +left, or right. You have to press a key for each and every move of your yellow dot. +In this experiment you can collect green diamond shaped tokens +<img src="@CODEBASE_URL@/images/gem-token.gif"> and earn two cents for each collected token. +To collect a token, move your yellow dot over a green token and press the <b>space +bar</b>. If you move over a token without pressing the <b>space bar</> you do NOT +collect that token. +</p> + +<p> +The tokens that you collect have the potential to regenerate. After you have +collected a green token, a new token can re-appear on that empty cell. +However, the rate at which new tokens will appear depends on the number of +adjacent cells with tokens. The more tokens in the eight cells around +an empty cell, the faster a new token will appear on that empty cell. In other +words, <b>existing tokens can generate new tokens</b>. To illustrate this, please +refer to Image 1 and Image 2. The middle cell in Image 1 denoted with an X has +a greater chance of regeneration than the middle cell in Image 2. When all +neighboring cells are empty, there is <b>no chance for regeneration</b>. + +<table width="100%"> +<tr> +<td align="center"><b>Image 1</b></td> +<td align="center"><b>Image 2</b></td> +</tr> +<tr> +<td align="center"> +<img src="@CODEBASE_URL@/images/8neighbors.jpg" alt="image 1"> +</td> +<td align="center"> +<img src="@CODEBASE_URL@/images/5neighbors.jpg" alt="image 2"> +</td> +</tr> +</table> +]]> +</entry> + + +</properties> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2010-03-10 22:21:55
|
Revision: 490 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=490&view=rev Author: alllee Date: 2010-03-10 22:21:49 +0000 (Wed, 10 Mar 2010) Log Message: ----------- updating voting + field of vision pretest treatment Modified Paths: -------------- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round4.xml foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round5.xml foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round6.xml Modified: foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round4.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round4.xml 2010-03-10 19:05:12 UTC (rev 489) +++ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round4.xml 2010-03-10 22:21:49 UTC (rev 490) @@ -102,8 +102,7 @@ <p> You will see other participants labeled as "1", "2","3", "4", or "5" in the chat box. You can send a chat message by typing into the textfield at the -bottom of the screen and clicking the "send" button with your mouse or -pressing the "enter" key on your keyboard. +bottom of the screen and pressing the "enter" key on your keyboard. </p> ]]> </entry> Modified: foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round5.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round5.xml 2010-03-10 19:05:12 UTC (rev 489) +++ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round5.xml 2010-03-10 22:21:49 UTC (rev 490) @@ -58,8 +58,7 @@ <p> You will see other participants labeled as "1", "2","3", "4", or "5" in the chat box. You can send a chat message by typing into the textfield at the -bottom of the screen and clicking the "send" button with your mouse or -pressing the "enter" key on your keyboard. +bottom of the screen and pressing the "enter" key on your keyboard. </p> ]]> </entry> Modified: foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round6.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round6.xml 2010-03-10 19:05:12 UTC (rev 489) +++ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round6.xml 2010-03-10 22:21:49 UTC (rev 490) @@ -74,8 +74,7 @@ <p> You will see other participants labeled as "1", "2","3", "4", or "5" in the chat box. You can send a chat message by typing into the textfield at the -bottom of the screen and clicking the "send" button with your mouse or -pressing the "enter" key on your keyboard. </p> +bottom of the screen and pressing the "enter" key. </p> ]]> </entry> </properties> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: Allen L. (JIRA) <jef...@as...> - 2010-03-10 22:01:05
|
networking performance ---------------------- Key: COMMONS-31 URL: http://opensource.asu.edu/jira/browse/COMMONS-31 Project: The Virtual Commons Issue Type: Improvement Components: foraging Reporter: Allen Lee Assignee: Deepak Barge Based on iftop, the network traffic to/from each host averages around 145 Kb for server -> client and 40-50 Kb from client->server (see below snapshot for a badly formatted example). We should be able to improve performance by carefully monitoring what data we send, and how frequently we send it. That would be in processRound2d() and the SERVER_SLEEP_INTERVAL in ForagingServer. 145 Kb sod19.asu.edu => 10.208.96.195 145Kb 145Kb 160Kb <= 49.1Kb 46.1Kb 42.9Kb sod19.asu.edu => 10.208.96.191 144Kb 144Kb 160Kb <= 35.9Kb 36.8Kb 36.6Kb sod19.asu.edu => 10.208.97.68 143Kb 144Kb 144Kb <= 32.2Kb 36.2Kb 33.9Kb sod19.asu.edu => 10.208.97.70 143Kb 144Kb 144Kb <= 34.5Kb 35.1Kb 38.8Kb sod19.asu.edu => 10.208.97.69 144Kb 144Kb 160Kb <= 36.4Kb 34.6Kb 39.3Kb sod19.asu.edu => 10.208.96.194 143Kb 144Kb 144Kb <= 28.0Kb 34.4Kb 35.4Kb sod19.asu.edu => 10.208.96.185 144Kb 143Kb 159Kb <= 36.6Kb 28.7Kb 28.3Kb sod19.asu.edu => 10.208.96.186 143Kb 142Kb 143Kb <= 23.9Kb 24.4Kb 24.2Kb sod19.asu.edu => 10.208.97.72 142Kb 142Kb 159Kb <= 23.1Kb 17.0Kb 25.4Kb sod19.asu.edu => 10.208.96.189 142Kb 142Kb 157Kb <= 27.0Kb 13.5Kb 15.6Kb sod19.asu.edu => 10.208.97.192 4.81Kb 3.72Kb 2.82Kb <= 320b 320b 304b 129.219.246.77 => ALL-ROUTERS.MCAST.NET 1.12Kb 883b 931b -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.asu.edu/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Allen L. (JIRA) <jef...@as...> - 2010-03-10 21:14:59
|
field of vision is off a little bit ----------------------------------- Key: COMMONS-30 URL: http://opensource.asu.edu/jira/browse/COMMONS-30 Project: The Virtual Commons Issue Type: Bug Components: foraging Affects Versions: enhanced foraging Reporter: Allen Lee Assignee: Allen Lee Fix For: enhanced foraging The displayed field of vision is off-center. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.asu.edu/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Allen L. (JIRA) <jef...@as...> - 2010-03-10 20:44:59
|
[ http://opensource.asu.edu/jira/browse/COMMONS-24?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Allen Lee resolved COMMONS-24. ------------------------------ Resolution: Fixed Fixed except for at the end of the practice round, tell people why they didn't earn any money - will create a separate issue for that. > foraging voting and field of vison issues > ----------------------------------------- > > Key: COMMONS-24 > URL: http://opensource.asu.edu/jira/browse/COMMONS-24 > Project: The Virtual Commons > Issue Type: Improvement > Components: foraging > Affects Versions: enhanced foraging > Reporter: Allen Lee > Assignee: Deepak Barge > Priority: Blocker > > in quiz, underline + bold "incorrect" > replace avatar with yellow dot > at the end of the practice round, tell people why they didn't earn any money > visual artifacts on Seema and Marcel's laptops, duplication of the score and time labels, refresh / repaint issue where > Marco's laptop: visual artifacts, old version of code appears with purple slash over avatar > Make field of vision distinctly yellow -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.asu.edu/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Allen L. (JIRA) <jef...@as...> - 2010-03-10 20:42:59
|
persist SanctionRankingRequest and SanctionUpdateEvent ------------------------------------------------------- Key: COMMONS-29 URL: http://opensource.asu.edu/jira/browse/COMMONS-29 Project: The Virtual Commons Issue Type: Task Components: foraging Affects Versions: enhanced foraging Reporter: Allen Lee Assignee: Deepak Barge summary says it all. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.asu.edu/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Allen L. (JIRA) <jef...@as...> - 2010-03-10 20:39:02
|
persist all quiz responses -------------------------- Key: COMMONS-28 URL: http://opensource.asu.edu/jira/browse/COMMONS-28 Project: The Virtual Commons Issue Type: Task Components: foraging Affects Versions: enhanced foraging Reporter: Allen Lee Assignee: Allen Lee Fix For: enhanced foraging All quiz responses should be sent to the server and saved so we can keep track of incorrect responses, etc. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.asu.edu/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Allen L. (JIRA) <jef...@as...> - 2010-03-10 20:39:00
|
station ids need to be updated on server side --------------------------------------------- Key: COMMONS-27 URL: http://opensource.asu.edu/jira/browse/COMMONS-27 Project: The Virtual Commons Issue Type: Bug Components: foraging Affects Versions: enhanced foraging Reporter: Allen Lee Assignee: Allen Lee Fix For: enhanced foraging The station identifiers need to be updated via SocketIdentifierUpdateRequest for the foraging experiment. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.asu.edu/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Allen L. (JIRA) <jef...@as...> - 2010-03-10 20:37:02
|
[ http://opensource.asu.edu/jira/browse/COMMONS-7?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Allen Lee resolved COMMONS-7. ----------------------------- Fix Version/s: enhanced foraging Resolution: Fixed This appears to have been resolved by using ImageIO.read instead of Toolkit.getDefaultToolkit() > images aren't always loading properly (resize fixes it sometimes) > ----------------------------------------------------------------- > > Key: COMMONS-7 > URL: http://opensource.asu.edu/jira/browse/COMMONS-7 > Project: The Virtual Commons > Issue Type: Bug > Components: foraging > Reporter: Allen Lee > Assignee: Allen Lee > Priority: Critical > Fix For: enhanced foraging > > > Images in the foraging experiment aren't always loaded properly. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.asu.edu/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: Allen L. (JIRA) <jef...@as...> - 2010-03-10 19:27:12
|
refactor how the client determines whether or not it can sanction ----------------------------------------------------------------- Key: COMMONS-26 URL: http://opensource.asu.edu/jira/browse/COMMONS-26 Project: The Virtual Commons Issue Type: Bug Components: foraging Reporter: Allen Lee Assignee: Allen Lee Currently in the voting treatment if sanctioning is enabled but the participants decided to vote against it, they can get the sanction animation even though the sanction isn't going through. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://opensource.asu.edu/jira/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira |
From: <al...@us...> - 2010-03-10 19:05:20
|
Revision: 489 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=489&view=rev Author: alllee Date: 2010-03-10 19:05:12 +0000 (Wed, 10 Mar 2010) Log Message: ----------- minor updates to the active configuration files, changing the default initial distribution to 25% etc. Modified Paths: -------------- foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ResourceDispenser.java foraging/trunk/src/main/resources/configuration/round4.xml foraging/trunk/src/main/resources/configuration/round5.xml foraging/trunk/src/main/resources/configuration/round6.xml Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java 2010-03-10 18:35:34 UTC (rev 488) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java 2010-03-10 19:05:12 UTC (rev 489) @@ -139,7 +139,7 @@ } public double getInitialDistribution() { - return getDoubleProperty("initial-distribution", 0.5d); + return getDoubleProperty("initial-distribution", 0.25d); } public Dimension getBoardSize() { Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ResourceDispenser.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ResourceDispenser.java 2010-03-10 18:35:34 UTC (rev 488) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ResourceDispenser.java 2010-03-10 19:05:12 UTC (rev 489) @@ -345,6 +345,7 @@ this.rate = roundConfiguration.getRegrowthRate(); for (GroupDataModel group: serverDataModel.getGroups()) { Set<Resource> resources = generateInitialDistribution(group); + logger.info("density dependent resource generator initialized with " + resources.size() + " resources."); serverDataModel.addResources(group, resources); } // FIXME: is this necessary? Modified: foraging/trunk/src/main/resources/configuration/round4.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round4.xml 2010-03-10 18:35:34 UTC (rev 488) +++ foraging/trunk/src/main/resources/configuration/round4.xml 2010-03-10 19:05:12 UTC (rev 489) @@ -102,8 +102,7 @@ <p> You will see other participants labeled as "1", "2","3", "4", or "5" in the chat box. You can send a chat message by typing into the textfield at the -bottom of the screen and clicking the "send" button with your mouse or -pressing the "enter" key on your keyboard. +bottom of the screen and pressing the "enter" key on your keyboard. </p> ]]> </entry> Modified: foraging/trunk/src/main/resources/configuration/round5.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round5.xml 2010-03-10 18:35:34 UTC (rev 488) +++ foraging/trunk/src/main/resources/configuration/round5.xml 2010-03-10 19:05:12 UTC (rev 489) @@ -58,8 +58,7 @@ <p> You will see other participants labeled as "1", "2","3", "4", or "5" in the chat box. You can send a chat message by typing into the textfield at the -bottom of the screen and clicking the "send" button with your mouse or -pressing the "enter" key on your keyboard. +bottom of the screen and pressing the "enter" key on your keyboard. </p> ]]> </entry> Modified: foraging/trunk/src/main/resources/configuration/round6.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round6.xml 2010-03-10 18:35:34 UTC (rev 488) +++ foraging/trunk/src/main/resources/configuration/round6.xml 2010-03-10 19:05:12 UTC (rev 489) @@ -74,8 +74,7 @@ <p> You will see other participants labeled as "1", "2","3", "4", or "5" in the chat box. You can send a chat message by typing into the textfield at the -bottom of the screen and clicking the "send" button with your mouse or -pressing the "enter" key on your keyboard. </p> +bottom of the screen and pressing the "enter" key. </p> ]]> </entry> </properties> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2010-03-10 18:35:41
|
Revision: 488 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=488&view=rev Author: alllee Date: 2010-03-10 18:35:34 +0000 (Wed, 10 Mar 2010) Log Message: ----------- scaling images to about 50% the size Modified Paths: -------------- foraging/trunk/src/main/resources/images/question2.jpg foraging/trunk/src/main/resources/images/vision-range.jpg Modified: foraging/trunk/src/main/resources/images/question2.jpg =================================================================== (Binary files differ) Modified: foraging/trunk/src/main/resources/images/vision-range.jpg =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2010-03-10 10:19:25
|
Revision: 487 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=487&view=rev Author: alllee Date: 2010-03-10 10:19:19 +0000 (Wed, 10 Mar 2010) Log Message: ----------- copying treatment configuration to config directory Modified Paths: -------------- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round0.xml foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round1.xml foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round4.xml foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/server.xml foraging/trunk/src/main/resources/configuration/server.xml Modified: foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round0.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round0.xml 2010-03-10 00:10:40 UTC (rev 486) +++ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round0.xml 2010-03-10 10:19:19 UTC (rev 487) @@ -46,14 +46,14 @@ </p> <br> <form> -Which of the statements is incorrect? <br> +Which of the statements is <b><u>incorrect</u></b>? <br> <input type="radio" name="q1" value="A">Your decisions of where to collect tokens affects the regeneration of tokens.<br> <input type="radio" name="q1" value="B">When you have collected all tokens on the screen, no new tokens will appear.<br> <input type="radio" name="q1" value="C">Tokens grow from the middle of the screen.<br> <input type="radio" name="q1" value="D">In order to collect a token you need -to press the space bar while your avatar is on a cell with a token.<br> +to press the space bar while your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> is on a cell with a token.<br> <br><br> Which sequence of situations is not possible? <br> Modified: foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round1.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round1.xml 2010-03-10 00:10:40 UTC (rev 486) +++ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round1.xml 2010-03-10 10:19:19 UTC (rev 487) @@ -36,9 +36,13 @@ The other four players will appear on the screen as blue dots <img src="@CODEBASE_URL@/images/gem-other.gif"> with a white -number embedded in the dot. On the top right corner of the screen you can see -how many tokens each player has collected. -</p> +number embedded in the dot. On the top right corner of the screen you can see +how many tokens each player has collected. On the top left corner of the screen you can see +a clock that displays the remaining time in the round.</p> +<p>Since you can only see the resource within your vision you may neither see all +the other participants nor all the resource units. The figure below indicates the +vision range compared to the whole environment</p> +<img src="@CODEBASE_URL@/images/vision-range.jpg"> <p> If you have any questions please raise your hand. <b>Do you have any questions so far?</b> Modified: foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round4.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round4.xml 2010-03-10 00:10:40 UTC (rev 486) +++ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round4.xml 2010-03-10 10:19:19 UTC (rev 487) @@ -131,7 +131,7 @@ <input type="radio" name="q2" value="4">4 tokens<br> <br><br> -The background of your avatar turns blue. What does this represent?<br> +The background of your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> turns blue. What does this represent?<br> <input type="radio" name="q3" value="0">You collected a token<br> <input type="radio" name="q3" value="1">Another participant is subtracting two tokens from you<br> @@ -145,9 +145,9 @@ collected this round<br> <input type="radio" name="q4" value="1">One token is subtracted from my tokens collected this round<br> -<input type="radio" name="q4" value="2">The background of my avatar turns blue +<input type="radio" name="q4" value="2">The background of my yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> turns blue momentarily<br> -<input type="radio" name="q4" value="3">My avatar is paused for two seconds<br> +<input type="radio" name="q4" value="3">My yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> is paused for two seconds<br> <input type="submit" name="submit" value="Submit"> </form> Modified: foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/server.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/server.xml 2010-03-10 00:10:40 UTC (rev 486) +++ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/server.xml 2010-03-10 10:19:19 UTC (rev 487) @@ -73,7 +73,7 @@ adjacent cells with tokens. The more tokens in the eight cells around an empty cell, the faster a new token will appear on that empty cell. In other words, <b>existing tokens can generate new tokens</b>. To illustrate this, please -see refer to Image 1 and Image 2. The middle cell in Image 1 denoted with an X has +refer to Image 1 and Image 2. The middle cell in Image 1 denoted with an X has a greater chance of regeneration than the middle cell in Image 2. When all neighboring cells are empty, there is <b>no chance for regeneration</b>. Modified: foraging/trunk/src/main/resources/configuration/server.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/server.xml 2010-03-10 00:10:40 UTC (rev 486) +++ foraging/trunk/src/main/resources/configuration/server.xml 2010-03-10 10:19:19 UTC (rev 487) @@ -73,7 +73,7 @@ adjacent cells with tokens. The more tokens in the eight cells around an empty cell, the faster a new token will appear on that empty cell. In other words, <b>existing tokens can generate new tokens</b>. To illustrate this, please -see refer to Image 1 and Image 2. The middle cell in Image 1 denoted with an X has +refer to Image 1 and Image 2. The middle cell in Image 1 denoted with an X has a greater chance of regeneration than the middle cell in Image 2. When all neighboring cells are empty, there is <b>no chance for regeneration</b>. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <db...@us...> - 2010-03-10 00:10:46
|
Revision: 486 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=486&view=rev Author: dbarge Date: 2010-03-10 00:10:40 +0000 (Wed, 10 Mar 2010) Log Message: ----------- changed the vision range of the image Modified Paths: -------------- foraging/trunk/src/main/resources/images/vision-range.jpg Modified: foraging/trunk/src/main/resources/images/vision-range.jpg =================================================================== (Binary files differ) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <db...@us...> - 2010-03-09 00:43:56
|
Revision: 485 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=485&view=rev Author: dbarge Date: 2010-03-09 00:43:49 +0000 (Tue, 09 Mar 2010) Log Message: ----------- Issues resolved This version includes changes for 1) Code changes to incorporate the UI improvements/suggestions that came up last meeting 2) Code changes to incorporate the implementation of the simplified version of the sanctioning system. Issues unresolved 1) The field of vision circle is out of sync and not centered. Modified Paths: -------------- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round0.xml foraging/trunk/src/main/resources/images/question2.jpg Added Paths: ----------- foraging/trunk/src/main/resources/configuration/round0.xml foraging/trunk/src/main/resources/configuration/round1.xml foraging/trunk/src/main/resources/configuration/round2.xml foraging/trunk/src/main/resources/configuration/round3.xml foraging/trunk/src/main/resources/configuration/round4.xml foraging/trunk/src/main/resources/configuration/round5.xml foraging/trunk/src/main/resources/configuration/round6.xml foraging/trunk/src/main/resources/configuration/server.xml foraging/trunk/src/main/resources/images/vision-range.jpg Modified: foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round0.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round0.xml 2010-03-09 00:42:46 UTC (rev 484) +++ foraging/trunk/src/main/resources/configuration/asu-experiments/voting-fov/round0.xml 2010-03-09 00:43:49 UTC (rev 485) @@ -31,6 +31,7 @@ press the <b>R</b> key you will reset the resource to its initial distribution, randomly filling half of the cells. </p> +<p><b> Please do not communicate with any other participant.</b></p> <p>If you have any questions please raise your hand. <b>Do you have any questions so far?</b></p> ]]> Added: foraging/trunk/src/main/resources/configuration/round0.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round0.xml (rev 0) +++ foraging/trunk/src/main/resources/configuration/round0.xml 2010-03-09 00:43:49 UTC (rev 485) @@ -0,0 +1,70 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="resource-width">13</entry> +<entry key="resource-depth">13</entry> +<entry key="practice-round">true</entry> +<entry key="private-property">true</entry> +<entry key="duration">240</entry> + +<entry key='tokens-field-of-vision'>true</entry> +<entry key='subjects-field-of-vision'>true</entry> + +<entry key="quiz">true</entry> +<entry key="q1">C</entry> +<entry key="q2">B</entry> + +<entry key='instructions'> +<![CDATA[ +<h3>Practice Round Instructions</h3> +<hr> +<p> +You will now have four minutes to practice with the experimental environment. +The decisions you make in this round will NOT influence your earnings. At the +At the beginning of the practice round half of the cells are occupied +with green tokens. The environment is a 13 x 13 grid of cells. +</p> +<p> +During this practice round, and <b>only during</b> this practice round, you are able +to reset the tokens displayed on the screen by pressing the <b>R</b> key. When you +press the <b>R</b> key you will reset the resource to its initial distribution, +randomly filling half of the cells. +</p> +<p><b> Please do not communicate with any other participant.</b></p> +<p>If you have any questions please raise your hand. <b>Do you have any +questions so far?</b></p> +]]> +</entry> + +<entry key="quiz-instructions"> +<![CDATA[ +<p> +Before we begin the practice round you need to answer the following questions +correctly. You can only continue when you have answered all questions +correctly. If an error is made you will need to answer the questions again. +</p> +<br> +<form> +Which of the statements is <b><u>incorrect</u></b>? <br> +<input type="radio" name="q1" value="A">Your decisions of where to collect tokens affects the regeneration of tokens.<br> +<input type="radio" name="q1" value="B">When you have collected all tokens on +the screen, no new tokens will appear.<br> +<input type="radio" name="q1" value="C">Tokens grow from the middle of the +screen.<br> +<input type="radio" name="q1" value="D">In order to collect a token you need +to press the space bar while your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> is on a cell with a token.<br> +<br><br> + +Which sequence of situations is not possible? <br> +<img src="@CODEBASE_URL@/images/question2.jpg"><br> +<input type="radio" name="q2" value="A">A<br> +<input type="radio" name="q2" value="B">B<br> +<input type="radio" name="q2" value="C">C<br> +<br> +<input type="submit" name="submit" value="Submit"> +</form> +]]> +</entry> + +</properties> Added: foraging/trunk/src/main/resources/configuration/round1.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round1.xml (rev 0) +++ foraging/trunk/src/main/resources/configuration/round1.xml 2010-03-09 00:43:49 UTC (rev 485) @@ -0,0 +1,52 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> + +<entry key='tokens-field-of-vision'>true</entry> +<entry key='subjects-field-of-vision'>true</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 1 Instructions</h3> +<hr> +<p> +This is the first round of the experiment. The length of the round is 4 +minutes. Like in the practice round you can collect green tokens. This time +you earn <b>two cents</b> for each token collected. This time you +<b>cannot</b> reset the distribution of green tokens. +</p> +<p> +In this round the renewable resource will become five times bigger. You will share this +larger environment with four other players in this room that have been randomly +selected. One group's resource environment is distinct from the other groups. +</p> +<p> +Each of you has been assigned a number from 1 to 5. These numbers will remain the +same throughout the experiment but you will <b>not</b> be able to identify which +person in the room has been assigned which number, so your anonymity is guaranteed. + +The other four players will appear on the screen as blue dots +<img src="@CODEBASE_URL@/images/gem-other.gif"> with a white +number embedded in the dot. On the top right corner of the screen you can see +how many tokens each player has collected. On the top left corner of the screen you can see +a clock that displays the remaining time in the round.</p> +<p>Since you can only see the resource within your vision you may neither see all +the other participants nor all the resource units. The figure below indicates the +vision range compared to the whole environment</p> +<img src="@CODEBASE_URL@/images/vision-range.jpg"> +<p> +If you have any questions please raise your hand. <b>Do you have any +questions so far?</b> +</p> +]]> +</entry> +</properties> Added: foraging/trunk/src/main/resources/configuration/round2.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round2.xml (rev 0) +++ foraging/trunk/src/main/resources/configuration/round2.xml 2010-03-09 00:43:49 UTC (rev 485) @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> + + +<!-- enable field of vision for tokens and subjects --> +<entry key='tokens-field-of-vision'>true</entry> +<entry key='subjects-field-of-vision'>true</entry> + +<entry key='initial-distribution'>.25</entry> + +<entry key='tokens-field-of-vision'>true</entry> +<entry key='subjects-field-of-vision'>true</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 2 Instructions</h3> +<hr> +<p> +Round 2 is the same as round 1. +</p> +<p> +If you have any questions please raise your hand. <b>Do you have any +questions so far?</b> +</p> +]]> +</entry> +</properties> Added: foraging/trunk/src/main/resources/configuration/round3.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round3.xml (rev 0) +++ foraging/trunk/src/main/resources/configuration/round3.xml 2010-03-09 00:43:49 UTC (rev 485) @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="duration">240</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> + +<!-- enable field of vision for tokens and subjects --> +<entry key='tokens-field-of-vision'>true</entry> +<entry key='subjects-field-of-vision'>true</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<!-- resource regrowth parameters --> +<entry key="initial-distribution">.25</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 3 Instructions</h3> +<hr> +<p> +Round 3 is the same as round 2. +</p> +<p> +If you have any questions please raise your hand. <b>Do you have any +questions so far?</b> +</p> +]]> +</entry> +</properties> Added: foraging/trunk/src/main/resources/configuration/round4.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round4.xml (rev 0) +++ foraging/trunk/src/main/resources/configuration/round4.xml 2010-03-09 00:43:49 UTC (rev 485) @@ -0,0 +1,156 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> +<entry key="duration">240</entry> + +<!-- enable field of vision for tokens and subjects --> +<entry key='tokens-field-of-vision'>true</entry> +<entry key='subjects-field-of-vision'>true</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<!-- before this round begins, we have a chat session --> +<entry key="chat-enabled">true</entry> +<entry key="chat-duration">240</entry> + +<!-- enable sanctioning --> +<entry key="sanction-type">real-time</entry> +<entry key="sanction-cost">1</entry> +<entry key="sanction-multiplier">2</entry> + + +<entry key="initial-distribution">.25</entry> + +<!-- enable quiz --> +<entry key='quiz'>true</entry> +<entry key='q1'>1</entry> +<entry key='q2'>2</entry> +<entry key='q3'>1</entry> +<entry key='q4'>1</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 4 Instructions</h3> +<hr> +<p> +Round 4 is the same as the previous two rounds with two exceptions. +</p> +<p> +Before the next round starts you can anonymously communicate by text messages +for four minutes with the other participants in your group. You can use this +opportunity to discuss the experiment and coordinate your actions to improve +your earnings. You may not promise side-payments after the experiment is +completed or make any threats. You are also not allowed to reveal your real +identity. We are monitoring the chat traffic while you chat. +</p> +<p> +During the next round you will have the option to reduce the earnings of another +participant at a cost to your own earnings. +</p> +<ul> +<li>If you press the numeric key 1-5 corresponding to another participant, you +will reduce the number of tokens they have collected in this round by two +tokens. This will also reduce your own token amount by one token. The decision +whether or when to use this option is up to you. +<li>When you reduce the number of tokens of another participant, they will +receive a message stating that you have reduced their tokens. Likewise, if +another participant reduces your number of tokens, you will also receive a +message. These messages will be displayed on the bottom of your screen. +<li>If your tokens are being reduced or you are reducing another participant's +tokens, you will receive some visual cues. When your tokens are being reduced +your yellow dot will turn red briefly with a blue background. The participant +currently reducing your tokens will turn purple with a white background. +<li>You may reduce the earnings of other participants as long as there are +tokens remaining on the screen and while both you and the other participant +have a positive number of tokens collected during the round. <b>Each time</b> +you press the numeric key corresponding to another participant your token +amount is reduced by <b>one</b>, and their token amount is reduced by +<b>two</b>. <b>Note:</b> You can only remove tokens from a participant that is +visible to you. +</ul> +<p> + +<p> +The length of this round is four minutes. +</p> +<p> +If you have any questions please raise your hand. <b>Do you have any +questions so far?</b> +</p> +]]> +</entry> + +<entry key="chat-instructions"> +<![CDATA[ +<p> +You can now chat with the other participants in your group for 4 minutes +total. During the chat round, you may communicate about any aspect of the +experiment that you would like to discuss with other participants with whom +you have been matched. You may not promise them side-payments after the +experiment is completed or threaten them with any consequence after the +experiment is finished. We are monitoring the chat traffic while you chat. If +we see that somebody reveals his or her identity, we have to stop the +experiment and remove the whole group from which this person is a member out +of this room. +</p> +<p> +You will see other participants labeled as "1", "2","3", "4", or "5" in the +chat box. You can send a chat message by typing into the textfield at the +bottom of the screen and clicking the "send" button with your mouse or +pressing the "enter" key on your keyboard. +</p> +]]> +</entry> +<entry key="quiz-instructions"> +<![CDATA[ +<p>Before the next round begins you must complete the quiz below. You can +only continue when you have answered all questions correctly. If an error is +made you will need to answer the questions again. +</p> + +<form> +Each time I press the numeric keys between 1-5 my tokens will be reduced +by:<br> +<input type="radio" name="q1" value="0">0 tokens<br> +<input type="radio" name="q1" value="1">1 token<br> +<input type="radio" name="q1" value="2">2 tokens<br> +<input type="radio" name="q1" value="4">4 tokens<br> +<br><br> + +Each time I press the numeric keys between 1-5 the number of tokens of the +corresponding participant is reduced by:<br> +<input type="radio" name="q2" value="0">0 tokens<br> +<input type="radio" name="q2" value="1">1 token<br> +<input type="radio" name="q2" value="2">2 tokens<br> +<input type="radio" name="q2" value="4">4 tokens<br> +<br><br> + +The background of your yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> turns blue. What does this represent?<br> +<input type="radio" name="q3" value="0">You collected a token<br> +<input type="radio" name="q3" value="1">Another participant is subtracting two +tokens from you<br> +<input type="radio" name="q3" value="2">You are subtracting two tokens from another +participant<br> +<input type="radio" name="q3" value="3">You are moving too fast<br> +<br><br> + +Every time I press the numeric keys between 1-5:<br> +<input type="radio" name="q4" value="0">Two tokens are subtracted from my tokens +collected this round<br> +<input type="radio" name="q4" value="1">One token is subtracted from my tokens +collected this round<br> +<input type="radio" name="q4" value="2">The background of my yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> turns blue +momentarily<br> +<input type="radio" name="q4" value="3">My yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif"> is paused for two seconds<br> + +<input type="submit" name="submit" value="Submit"> +</form> +]]> +</entry> +</properties> Added: foraging/trunk/src/main/resources/configuration/round5.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round5.xml (rev 0) +++ foraging/trunk/src/main/resources/configuration/round5.xml 2010-03-09 00:43:49 UTC (rev 485) @@ -0,0 +1,76 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> +<entry key="duration">240</entry> + +<!-- enable field of vision for tokens and subjects --> +<entry key='tokens-field-of-vision'>true</entry> +<entry key='subjects-field-of-vision'>true</entry> + +<!-- enable sanctioning --> +<entry key="sanction-type">real-time</entry> +<entry key="sanction-cost">1</entry> +<entry key="sanction-multiplier">2</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<!-- before this round begins, we have a chat session --> +<entry key="chat-enabled">true</entry> +<entry key="chat-duration">240</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 5 Instructions</h3> +<hr> +<p> +Round 5 is the same as round 4.</p> +<p> +The length of this round is again four minutes. +</p> +<p> +If you have any questions please raise your hand. <b>Do you have any +questions so far?</b> +</p> +]]> +</entry> + +<entry key="chat-instructions"> +<![CDATA[ +<p> +You can now chat with the other participants in your group for 4 minutes +total. During the chat round, you may communicate about any aspect of the +experiment that you would like to discuss with other participants with whom +you have been matched. You may not promise them side-payments after the +experiment is completed or threaten them with any consequence after the +experiment is finished. We are monitoring the chat traffic while you chat. If +we see that somebody reveals his or her identity, we have to stop the +experiment and remove the whole group from which this person is a member out +of this room. +</p> +<p> +You will see other participants labeled as "1", "2","3", "4", or "5" in the +chat box. You can send a chat message by typing into the textfield at the +bottom of the screen and clicking the "send" button with your mouse or +pressing the "enter" key on your keyboard. +</p> +]]> +</entry> + +<entry key='private-chat-instructions'> +<![CDATA[ +You may send private messages to a specific participant by clicking on the +appropriately labeled button (1, 2, 3, 4, or 5) before typing your message in +the chat box and sending it. By default you are communicating with all +members of your group. +]]> +</entry> + +</properties> Added: foraging/trunk/src/main/resources/configuration/round6.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/round6.xml (rev 0) +++ foraging/trunk/src/main/resources/configuration/round6.xml 2010-03-09 00:43:49 UTC (rev 485) @@ -0,0 +1,81 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Foraging XML-ized experiment round configuration</comment> +<entry key="display-group-tokens">true</entry> +<entry key="clients-per-group">5</entry> +<entry key="resource-depth">29</entry> +<entry key="resource-width">29</entry> +<entry key="duration">240</entry> + +<entry key='tokens-field-of-vision'>true</entry> +<entry key='subjects-field-of-vision'>true</entry> +<!-- enable sanctioning --> +<entry key="sanction-type">real-time</entry> +<entry key="sanction-cost">1</entry> +<entry key="sanction-multiplier">2</entry> + +<entry key="initial-distribution">.25</entry> + +<entry key='always-explicit'>true</entry> +<entry key='max-cell-occupancy'>1</entry> + +<!-- before this round begins, we have a chat session --> +<entry key="chat-enabled">true</entry> +<entry key="chat-duration">240</entry> + +<entry key="instructions"> +<![CDATA[ +<h3>Round 6 Instructions</h3> +<hr> +<p> +Round 6 is the same as round 5.</p> +<p> +The length of this round is again four minutes. +</p> +<p> +If you have any questions please raise your hand. <b>Do you have any +questions so far?</b> +</p> +]]> +</entry> + +<entry key="last-round-debriefing"> +<![CDATA[ +<p> +This was the last round, but not the end of the experiment. We will now +determine your payments. While we are doing this, we request that you +carefully fill out a brief survey. +</p> +<p> +When we are ready we will call you one by one to the room next door. We will +pay you there in private. Please wait until your computer number is called, +and then proceed to the room next door to turn in your computer number and +your survey. +</p> +<p> +Please answer the survey carefully and thank you for participating. +</p> +]]> +</entry> + +<entry key="chat-instructions"> +<![CDATA[ +<p> +You can now chat with the other participants in your group for 4 minutes +total. During the chat round, you may communicate about any aspect of the +experiment that you would like to discuss with other participants with whom +you have been matched. You may not promise them side-payments after the +experiment is completed or threaten them with any consequence after the +experiment is finished. We are monitoring the chat traffic while you chat. If +we detect that somebody has revealed their identity, we will have to stop the +experiment and remove that person's entire group from the experiment. +</p> +<p> +You will see other participants labeled as "1", "2","3", "4", or "5" in the +chat box. You can send a chat message by typing into the textfield at the +bottom of the screen and clicking the "send" button with your mouse or +pressing the "enter" key on your keyboard. </p> +]]> +</entry> +</properties> Added: foraging/trunk/src/main/resources/configuration/server.xml =================================================================== --- foraging/trunk/src/main/resources/configuration/server.xml (rev 0) +++ foraging/trunk/src/main/resources/configuration/server.xml 2010-03-09 00:43:49 UTC (rev 485) @@ -0,0 +1,98 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd"> +<properties> +<comment>Costly Sanctioning XML-ized experiment round configuration</comment> +<entry key="hostname">@SERVER_ADDRESS@</entry> +<entry key="port">@PORT_NUMBER@</entry> +<entry key="round0">round0.xml</entry> +<entry key="round1">round1.xml</entry> +<entry key="round2">round2.xml</entry> +<entry key="round3">round3.xml</entry> +<entry key="round4">round4.xml</entry> +<entry key="round5">round5.xml</entry> +<entry key="round6">round6.xml</entry> +<entry key="wait-for-participants">true</entry> +<entry key="number-of-rounds">7</entry> +<entry key="facilitator-instructions"> +<![CDATA[ +<h3>Facilitator Instructions</h3> +<p> +Welcome to the facilitator interface. This interface allows you to control +the experiment. You may only modify configuration parameters <b>before</b> +you start the experiment by selecting the Configuration menu. When all the +participants are ready to begin the experiment, you can start the experiment +by selecting Experiment -> Start. After a round has been completed you +will be able to view the statistics for all of the participants. You can +begin the next round by selecting Round -> Start. +</p> +]]> +</entry> + +<entry key='field-of-vision-instructions'> +<![CDATA[ +Your vision is limited in this experiment. The area that is visible to you will be +shaded. +]]> +</entry> + +<entry key="welcome-instructions"> +<![CDATA[ +<h3>Welcome to the experiment. The experiment will begin shortly after everyone has been +assigned a station.</h3> +<p> +Please <b>wait quietly</b> and <b>do not close this window or open any other applications</b>. +</p> +]]> +</entry> + +<entry key="general-instructions"> +<![CDATA[ +<h3>General Instructions</h3> +<p> +Welcome. You have already earned 5 dollars by showing up at this experiment. You can +earn more, up to a maximum of 40 dollars, by participating in this experiment, which +will take about an hour to an hour and a half. The amount of money you earn depends +on your decisions as well as the decisions of other people in this room during the +six rounds of the experiment. +</p> +<p> +You appear on the screen as a yellow dot <img src="@CODEBASE_URL@/images/gem-self.gif">. +You move by pressing the four arrow keys on your keyboard. You can move up, down, +left, or right. You have to press a key for each and every move of your yellow dot. +In this experiment you can collect green diamond shaped tokens +<img src="@CODEBASE_URL@/images/gem-token.gif"> and earn two cents for each collected token. +To collect a token, move your yellow dot over a green token and press the <b>space +bar</b>. If you move over a token without pressing the <b>space bar</> you do NOT +collect that token. +</p> + +<p> +The tokens that you collect have the potential to regenerate. After you have +collected a green token, a new token can re-appear on that empty cell. +However, the rate at which new tokens will appear depends on the number of +adjacent cells with tokens. The more tokens in the eight cells around +an empty cell, the faster a new token will appear on that empty cell. In other +words, <b>existing tokens can generate new tokens</b>. To illustrate this, please +see refer to Image 1 and Image 2. The middle cell in Image 1 denoted with an X has +a greater chance of regeneration than the middle cell in Image 2. When all +neighboring cells are empty, there is <b>no chance for regeneration</b>. + +<table width="100%"> +<tr> +<td align="center"><b>Image 1</b></td> +<td align="center"><b>Image 2</b></td> +</tr> +<tr> +<td align="center"> +<img src="@CODEBASE_URL@/images/8neighbors.jpg" alt="image 1"> +</td> +<td align="center"> +<img src="@CODEBASE_URL@/images/5neighbors.jpg" alt="image 2"> +</td> +</tr> +</table> +]]> +</entry> + + +</properties> Modified: foraging/trunk/src/main/resources/images/question2.jpg =================================================================== (Binary files differ) Added: foraging/trunk/src/main/resources/images/vision-range.jpg =================================================================== (Binary files differ) Property changes on: foraging/trunk/src/main/resources/images/vision-range.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <db...@us...> - 2010-03-09 00:42:53
|
Revision: 484 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=484&view=rev Author: dbarge Date: 2010-03-09 00:42:46 +0000 (Tue, 09 Mar 2010) Log Message: ----------- Issues resolved This version includes changes for 1) Code changes to incorporate the UI improvements/suggestions that came up last meeting 2) Code changes to incorporate the implementation of the simplified version of the sanctioning system. Issues unresolved 1) The field of vision circle is out of sync and not centered. Modified Paths: -------------- foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ClientDataModel.java foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java foraging/trunk/src/main/java/edu/asu/commons/foraging/client/SubjectView.java foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ClientData.java foraging/trunk/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java Added Paths: ----------- foraging/trunk/src/main/java/edu/asu/commons/foraging/event/SanctionRankingRequest.java foraging/trunk/src/main/java/edu/asu/commons/foraging/event/SanctionUpdateEvent.java foraging/trunk/src/main/java/edu/asu/commons/foraging/model/SanctionMechanism.java Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ClientDataModel.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ClientDataModel.java 2010-03-08 19:01:37 UTC (rev 483) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ClientDataModel.java 2010-03-09 00:42:46 UTC (rev 484) @@ -19,6 +19,7 @@ import edu.asu.commons.foraging.model.GroupDataModel; import edu.asu.commons.foraging.model.RegulationData; import edu.asu.commons.foraging.model.Resource; +import edu.asu.commons.foraging.model.SanctionMechanism; import edu.asu.commons.net.Identifier; import edu.asu.commons.util.Duration; @@ -130,8 +131,10 @@ return groupDataModel.getActiveEnforcementMechanism(); } - - + public SanctionMechanism getActiveSanctionMechanism() { + return groupDataModel.getActiveSanctionMechanism(); + } + public void initialize(GroupDataModel groupDataModel) { clear(); this.groupDataModel = groupDataModel; Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java 2010-03-08 19:01:37 UTC (rev 483) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/client/ForagingClient.java 2010-03-09 00:42:46 UTC (rev 484) @@ -33,6 +33,7 @@ import edu.asu.commons.foraging.event.RegulationUpdateEvent; import edu.asu.commons.foraging.event.ResetTokenDistributionRequest; import edu.asu.commons.foraging.event.RoundStartedEvent; +import edu.asu.commons.foraging.event.SanctionUpdateEvent; import edu.asu.commons.foraging.event.ShowInstructionsRequest; import edu.asu.commons.foraging.event.SynchronizeClientEvent; import edu.asu.commons.util.Duration; @@ -224,7 +225,6 @@ } }); - addEventProcessor(new EventTypeProcessor<ClientMessageEvent>(ClientMessageEvent.class) { public void handle(ClientMessageEvent event) { gameWindow2D.displayErrorMessage(event.toString(),0); @@ -248,6 +248,13 @@ gameWindow2D.displayActiveRegulation(); } }); + + addEventProcessor(new EventTypeProcessor<SanctionUpdateEvent>(SanctionUpdateEvent.class) { + public void handle(final SanctionUpdateEvent event) { + dataModel.setGroupDataModel(event.getGroupDataModel()); + gameWindow2D.displaySanctionMechanism(); + } + }); } public boolean canPerformRealTimeSanction() { Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java 2010-03-08 19:01:37 UTC (rev 483) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/client/GameWindow2D.java 2010-03-09 00:42:46 UTC (rev 484) @@ -25,8 +25,10 @@ import javax.swing.BorderFactory; import javax.swing.Box; import javax.swing.BoxLayout; +import javax.swing.ButtonGroup; import javax.swing.JLabel; import javax.swing.JPanel; +import javax.swing.JRadioButton; import javax.swing.JScrollPane; import javax.swing.JTextArea; import javax.swing.JTextPane; @@ -48,6 +50,7 @@ import edu.asu.commons.foraging.event.QuizCompletedEvent; import edu.asu.commons.foraging.event.RealTimeSanctionRequest; import edu.asu.commons.foraging.event.ResetTokenDistributionRequest; +import edu.asu.commons.foraging.event.SanctionRankingRequest; import edu.asu.commons.foraging.event.SubmitRegulationRequest; import edu.asu.commons.foraging.model.ClientData; import edu.asu.commons.foraging.model.Direction; @@ -67,7 +70,7 @@ * @author <a href='mailto:All...@as...'>Allen Lee</a> * @version $Revision$ */ -public class GameWindow2D extends JPanel implements GameWindow { +public class GameWindow2D extends JPanel implements GameWindow, ActionListener { private static final long serialVersionUID = -7733523846114902166L; @@ -128,6 +131,8 @@ (int) Math.floor(size.getHeight() * 0.85)); subjectView = new SubjectView(subjectViewSize, dataModel); // subjectView.addKeyListener(this); + this.currentRankingInformation = new int [2]; + this.currentRankingInformation[0] = this.currentRankingInformation[1] = -1; initGuiComponents(); } @@ -149,8 +154,16 @@ }); } + public void resetSanctionRanks() { + this.currentRankingInformation[0] = this.currentRankingInformation[1] = -1; + } + + public void sendSanctionDecisionVotes() { + System.out.println("Sanction votes ready to be sent."); + client.transmit(new SanctionRankingRequest(client.getId(), currentRankingInformation)); + resetSanctionRanks(); + } - /** * In certain cases, init() _can_ be called before endRound() is finished. Need to lock * access! @@ -288,6 +301,26 @@ } } + private void startSanctionVotingTimer() { + if (timer == null) { + duration = Duration.create(dataModel.getRoundConfiguration().getSanctionVotingDuration()); + timer = new Timer(1000, new ActionListener() { + public void actionPerformed(ActionEvent event) { + if (duration.hasExpired()) { + timeLeftLabel.setText("Voting is now disabled. Next round begins shortly."); + timer.stop(); + timer = null; + sendSanctionDecisionVotes(); + displayVotingWaitMessage(); + } + else { + timeLeftLabel.setText( String.format("Voting period will now end in %d seconds.", duration.getTimeLeft() / 1000L) ); + } + } + }); + timer.start(); + } + } private void startRegulationSubmissionTimer() { if (timer == null) { @@ -320,7 +353,8 @@ timeLeftLabel.setText("Chat is now disabled."); timer.stop(); timer = null; - initializeRegulationPanel(); + initializeSanctionDecisionPanel(); + //initializeRegulationPanel(); } else { timeLeftLabel.setText( String.format("Chat will end in %d seconds.", duration.getTimeLeft() / 1000L) ); @@ -768,6 +802,19 @@ } }); } + + public void displaySanctionMechanism() { + SwingUtilities.invokeLater(new Runnable() { + public void run() { + System.out.println("Inside display sanction"); + instructionsBuilder.delete(0, instructionsBuilder.length()); + instructionsBuilder.append("<hr/><h2>Sanction choice voted : </h2><hr/><p>").append(dataModel.getActiveSanctionMechanism().getDescription()).append("</p>"); + instructionsBuilder.append("<hr/><h2>Active enforcement mechanism</h2><hr/><p>").append(dataModel.getActiveEnforcementMechanism().getDescription()).append("</p>"); + setInstructions(instructionsBuilder.toString()); + addCenterComponent(instructionsScrollPane); + } + }); + } private void displayVotingWaitMessage() { setInstructions("<h3>Please wait while we finish collecting information from all the participants.</h3>"); @@ -854,7 +901,69 @@ } }); } + + public void actionPerformed (ActionEvent e) { + String choice = group.getSelection().getActionCommand(); + int buttonNo = Integer.parseInt(choice); + System.out.println("Choice : "+choice); + System.out.println("Button : "+buttonNo); + //currentRankingInformation[buttonNo] = 1; + currentRankingInformation[0] = buttonNo; + } + + private JPanel getDecisionPanel() { + + if (decisionPanel == null) { + decisionPanel = new JPanel(new BorderLayout()); + decisionPanel.setBackground(Color.GRAY); + + HtmlEditorPane editorPane = createInstructionsEditorPane(); + JScrollPane scrollPane = new JScrollPane(editorPane); + editorPane.setText(dataModel.getRoundConfiguration().getSanctionInstructions()); + decisionPanel.add(scrollPane, BorderLayout.PAGE_START); + + group = new ButtonGroup(); + + JPanel rankPanel = new JPanel(); + rankPanel.setBackground(Color.WHITE); + rankPanel.setLayout(new BoxLayout (rankPanel, BoxLayout.Y_AXIS)); + rankPanel.setBorder(BorderFactory.createTitledBorder("Voting Options")); + + JLabel sanctionText = new JLabel("Please select one of the below voting options"); + + rankPanel.add(Box.createVerticalStrut(5)); + + rankPanel.add(sanctionText); + + rankPanel.add(Box.createVerticalStrut(8)); + + noSanction = new JRadioButton("No Sanctioning [No one can sanction/reduce tokens]"); + noSanction.setActionCommand("0"); + group.add(noSanction); + noSanction.addActionListener(this); + rankPanel.add(noSanction); + + rankPanel.add(Box.createVerticalStrut(8)); + + sanction = new JRadioButton("Allow Sanctioning [Everyone can sanction each other]"); + sanction.setActionCommand("1"); + group.add(sanction); + sanction.addActionListener(this); + rankPanel.add(sanction); + + decisionPanel.add(rankPanel); + } + group.clearSelection(); + return decisionPanel; + } + + public void initializeSanctionDecisionPanel() { + addCenterComponent(getDecisionPanel()); + startSanctionVotingTimer(); + } + + public void initializeRegulationPanel() { // getRegulationPanel().initialize(); // System.out.println("Initialization done"); @@ -877,6 +986,14 @@ } return submitRegulationPanel; } + + private JPanel decisionPanel; + private ButtonGroup group; + private JRadioButton sanction; + private JRadioButton noSanction; + private int currentRankingInformation[]; + + public void initializeChatPanel() { //new code Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/client/SubjectView.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/client/SubjectView.java 2010-03-08 19:01:37 UTC (rev 483) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/client/SubjectView.java 2010-03-09 00:42:46 UTC (rev 484) @@ -40,7 +40,7 @@ private final ClientDataModel dataModel; - public final static Color FIELD_OF_VISION_COLOR = new Color(255, 255, 255, 30); + public final static Color FIELD_OF_VISION_COLOR = new Color(255, 255, 255, 150); // associates a Duration with a piece of token consumed at the given Point - // the duration is used to render the token as shrinking. Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java 2010-03-08 19:01:37 UTC (rev 483) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/conf/RoundConfiguration.java 2010-03-09 00:42:46 UTC (rev 484) @@ -287,6 +287,10 @@ return getIntProperty("chat-duration", 120); } + public int getSanctionVotingDuration() { + return getIntProperty("sanction-voting-duration", 30); + } + public int getRegulationSubmissionDuration() { return getIntProperty("regulation-submission-duration", 60); } @@ -307,10 +311,8 @@ return getIntProperty("enforcement-display-duration", 30); } - - public String getSanctionInstructions() { - return getProperty("sanction-instructions"); + return getProperty("sanction-instructions","<h2>Please read the below mentioned instructions</h2>.<ul> <li> Please make your choice within the next 30 seconds. <li>The votes of all group participants will determine the outcome.</ul>"); } public boolean isAlwaysInExplicitCollectionMode() { Added: foraging/trunk/src/main/java/edu/asu/commons/foraging/event/SanctionRankingRequest.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/event/SanctionRankingRequest.java (rev 0) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/event/SanctionRankingRequest.java 2010-03-09 00:42:46 UTC (rev 484) @@ -0,0 +1,21 @@ +package edu.asu.commons.foraging.event; + +import edu.asu.commons.event.AbstractEvent; +import edu.asu.commons.net.Identifier; + +public class SanctionRankingRequest extends AbstractEvent{ + + private static final long serialVersionUID = 6453457534654365745L; + + private int[] rankings; + + public SanctionRankingRequest(Identifier id, int[] ranking) { + super(id); + this.rankings = ranking; + } + + public int[] getRankings() { + return rankings; + } + +} Added: foraging/trunk/src/main/java/edu/asu/commons/foraging/event/SanctionUpdateEvent.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/event/SanctionUpdateEvent.java (rev 0) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/event/SanctionUpdateEvent.java 2010-03-09 00:42:46 UTC (rev 484) @@ -0,0 +1,21 @@ +package edu.asu.commons.foraging.event; + +import edu.asu.commons.event.AbstractEvent; +import edu.asu.commons.foraging.model.GroupDataModel; +import edu.asu.commons.net.Identifier; + +public class SanctionUpdateEvent extends AbstractEvent{ + + private static final long serialVersionUID = 3456876534653456891L; + + private GroupDataModel groupDataModel; + + public SanctionUpdateEvent(Identifier id, GroupDataModel groupDataModel) { + super(id); + this.groupDataModel = groupDataModel; + } + + public GroupDataModel getGroupDataModel() { + return groupDataModel; + } +} Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ClientData.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ClientData.java 2010-03-08 19:01:37 UTC (rev 483) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/model/ClientData.java 2010-03-09 00:42:46 UTC (rev 484) @@ -33,6 +33,7 @@ private int[] regulationRankings; private int[] enforcementRankings; + private int[] sanctionRankings; private ForagingRole foragingRole = ForagingRole.HARVEST; @@ -529,6 +530,14 @@ public void setRegulationRankings(int[] regulationRankings) { this.regulationRankings = regulationRankings; } + + public void setSanctionRankings(int[] sanctionRankings) { + this.sanctionRankings = sanctionRankings; + } + + public int[] getSanctionRankings() { + return sanctionRankings; + } public int[] getEnforcementRankings() { return enforcementRankings; Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java 2010-03-08 19:01:37 UTC (rev 483) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/model/GroupDataModel.java 2010-03-09 00:42:46 UTC (rev 484) @@ -22,6 +22,7 @@ import edu.asu.commons.foraging.event.MonitorTaxEvent; import edu.asu.commons.foraging.event.PostRoundSanctionRequest; import edu.asu.commons.foraging.event.RegulationRankingRequest; +import edu.asu.commons.foraging.event.SanctionRankingRequest; import edu.asu.commons.foraging.event.SubmitRegulationRequest; import edu.asu.commons.foraging.event.SynchronizeClientEvent; import edu.asu.commons.foraging.event.TokenCollectedEvent; @@ -63,8 +64,9 @@ private volatile int receivedEnforcementRankings = 0; private volatile int receivedRegulationRankings = 0; - + private volatile int receivedSanctionRankings = 0; private EnforcementMechanism activeEnforcementMechanism = EnforcementMechanism.NONE; + private SanctionMechanism activeSanctionMechanism = SanctionMechanism.NOSANCTION; private RegulationData activeRegulation; private List<ClientData> waitingMonitors; @@ -195,6 +197,10 @@ public void setActiveRegulation(RegulationData activeRegulation) { this.activeRegulation = activeRegulation; } + + public void setActiveEnforcementMechanism(EnforcementMechanism enforcementMechanism) { + this.activeEnforcementMechanism = enforcementMechanism; + } // FIXME: this algorithm is very similar to generateRegulationRankings, extract to other method. public EnforcementMechanism generateEnforcementRankings() { @@ -246,11 +252,52 @@ } return activeEnforcementMechanism; } + + public SanctionMechanism generateSanctionRankings() { + resetSanctionRankingCount(); + // FIXME: change to round config parameter instead? + double[] sanctionVotingTally = new double[SanctionMechanism.values().length]; + Arrays.fill(sanctionVotingTally, 0.0d); + int maxRankingIndex = 0; + double maxRankingValue = 0.0d; + for (ClientData clientData: clients.values()) { + int[] sanctionRankings = clientData.getSanctionRankings(); + System.out.println("Server ranks: "+sanctionRankings[0]+" "+sanctionRankings[1]); + logger.info("XXX: sanction rankings: " + sanctionRankings); + for (int rank = 0; rank < sanctionRankings.length; rank++) { + // 0 is top choice + int actualSanctionIndex = sanctionRankings[rank]; + if (actualSanctionIndex == -1) { + // nothing selected for this rank + continue; + } + sanctionVotingTally[actualSanctionIndex] += rankToValue(rank); + //sanctionVotingTally[actualSanctionIndex] += rankToValue(actualSanctionIndex); + // keep a tally of the max index so we don't have to make another pass. + if (sanctionVotingTally[actualSanctionIndex] > maxRankingValue) { + maxRankingValue = sanctionVotingTally[actualSanctionIndex]; + maxRankingIndex = actualSanctionIndex; + } + } + } + activeSanctionMechanism = SanctionMechanism.get(maxRankingIndex); + logger.info("Active sanction mechanism: " + activeSanctionMechanism.getTitle() + " with rank " + maxRankingValue); + + setActiveEnforcementMechanism(EnforcementMechanism.get(maxRankingIndex)); + logger.info("Active enforcement mechanism: " + activeEnforcementMechanism.getTitle() + " with rank " + maxRankingValue); + + return activeSanctionMechanism; + } + private void resetEnforcementRankingCount() { receivedEnforcementRankings = 0; } + private void resetSanctionRankingCount() { + receivedSanctionRankings = 0; + } + private void resetRegulationRankingCount() { receivedRegulationRankings = 0; } @@ -293,6 +340,7 @@ clearResourceDistribution(); tokensCollectedDuringInterval = 0; activeEnforcementMechanism = EnforcementMechanism.NONE; + activeSanctionMechanism = SanctionMechanism.NOSANCTION; submittedRegulations.clear(); activeMonitor = null; } @@ -669,6 +717,10 @@ return activeEnforcementMechanism; } + public SanctionMechanism getActiveSanctionMechanism() { + return activeSanctionMechanism; + } + public ClientData getActiveMonitor() { return activeMonitor; } @@ -684,6 +736,11 @@ receivedRegulationRankings++; } + public void submitSanctionRanking(SanctionRankingRequest request) { + clients.get(request.getId()).setSanctionRankings(request.getRankings()); + receivedSanctionRankings++; + } + public boolean isRotatingMonitor() { return activeEnforcementMechanism != null && activeEnforcementMechanism.isRotatingMonitor(); } @@ -691,6 +748,10 @@ public boolean hasReceivedAllRegulationRankings() { return receivedRegulationRankings >= clients.size(); } + + public boolean hasReceivedAllSanctionRankings() { + return receivedSanctionRankings >= clients.size(); + } public List<RegulationData> getSubmittedRegulations() { return submittedRegulations; Added: foraging/trunk/src/main/java/edu/asu/commons/foraging/model/SanctionMechanism.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/model/SanctionMechanism.java (rev 0) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/model/SanctionMechanism.java 2010-03-09 00:42:46 UTC (rev 484) @@ -0,0 +1,35 @@ +package edu.asu.commons.foraging.model; + +public enum SanctionMechanism { + + NOSANCTION("No Sanctioning","Everybody can harvest. Nobody can subtract tokens from others"), + ALLOWSANCTION("Everybody can sanction","Every participant can reduce the tokens of other participants by pressing the number key associated with that participant."); + + + private final String title; + private final String description; + + SanctionMechanism(String title, String description) { + this.title = title; + this.description = description; + } + + public String getTitle() { + return title; + } + + public String getDescription() { + return description; + } + + + public static SanctionMechanism get(int index) { + if (index < values().length && index >= 0) { + return values()[index]; + } + System.err.println("Returning NONE. No sanction mechanism for out-of-bounds index: " + index); + return NOSANCTION; +// throw new IllegalArgumentException("No enforcement mechanism for index: " + index); + } + +} Modified: foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java =================================================================== --- foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java 2010-03-08 19:01:37 UTC (rev 483) +++ foraging/trunk/src/main/java/edu/asu/commons/foraging/server/ForagingServer.java 2010-03-09 00:42:46 UTC (rev 484) @@ -51,6 +51,8 @@ import edu.asu.commons.foraging.event.RegulationUpdateEvent; import edu.asu.commons.foraging.event.ResetTokenDistributionRequest; import edu.asu.commons.foraging.event.RoundStartedEvent; +import edu.asu.commons.foraging.event.SanctionRankingRequest; +import edu.asu.commons.foraging.event.SanctionUpdateEvent; import edu.asu.commons.foraging.event.ShowInstructionsRequest; import edu.asu.commons.foraging.event.SubmitRegulationRequest; import edu.asu.commons.foraging.event.SynchronizeClientEvent; @@ -61,6 +63,7 @@ import edu.asu.commons.foraging.model.GroupDataModel; import edu.asu.commons.foraging.model.RegulationData; import edu.asu.commons.foraging.model.ResourceDispenser; +import edu.asu.commons.foraging.model.SanctionMechanism; import edu.asu.commons.foraging.model.ServerDataModel; import edu.asu.commons.foraging.util.ForagingSaveFileConverter; import edu.asu.commons.net.Dispatcher; @@ -299,6 +302,16 @@ } }); + addEventProcessor(new EventTypeProcessor<SanctionRankingRequest>(SanctionRankingRequest.class) { + public void handle(final SanctionRankingRequest request) { + GroupDataModel group = serverDataModel.getGroup(request.getId()); + group.submitSanctionRanking(request); + if (group.hasReceivedAllSanctionRankings()) { + sendSanctionRankingUpdate(group); + } + } + }); + addEventProcessor(new EventTypeProcessor<SubmitRegulationRequest>(SubmitRegulationRequest.class) { public void handle(final SubmitRegulationRequest request) { GroupDataModel group = serverDataModel.getGroup(request.getId()); @@ -457,6 +470,13 @@ } } + private void sendSanctionRankingUpdate(GroupDataModel group) { + group.generateSanctionRankings(); + for (Identifier id: group.getClientIdentifiers()) { + transmit(new SanctionUpdateEvent(id, group)); + } + } + private void sendEnforcementUpdate(GroupDataModel group) { group.generateEnforcementRankings(); for (Identifier id: group.getClientIdentifiers()) { @@ -465,6 +485,8 @@ } private void handleEnforcementSanctionRequest(RealTimeSanctionRequest request) { + System.out.println("**************Inside the handleEnforcementSanction"); + ClientData sourceClient = clients.get(request.getSource()); ClientData targetClient = clients.get(request.getTarget()); @@ -579,15 +601,22 @@ } private void handleRealTimeSanctionRequest(RealTimeSanctionRequest request) { + System.out.println("**************Inside the handleRealTimeSanction"); + ClientData targetClient = clients.get(request.getTarget()); ClientData sourceClient = clients.get(request.getSource()); // validate request - boolean invalidSanctionRequest = sourceClient.getCurrentTokens() == 0 || targetClient.getCurrentTokens() == 0 || sourceClient.getGroupDataModel().isResourceDistributionEmpty(); + //FIXME:Added a new test condition to check for the simplified version of sanctioning + boolean invalidSanctionRequest = sourceClient.getCurrentTokens() == 0 || targetClient.getCurrentTokens() == 0 || sourceClient.getGroupDataModel().isResourceDistributionEmpty() || (sourceClient.getGroupDataModel().getActiveSanctionMechanism()== SanctionMechanism.NOSANCTION); if ( invalidSanctionRequest ) { // ignore the sanction request, send a message to the sanctioner. logger.warning("Ignoring token reduction request, sending new client error message event to : " + sourceClient.getId()); - transmit(new ClientMessageEvent(sourceClient.getId(), - String.format("Ignoring token reduction request: # %d does not have any tokens to reduce.", targetClient.getAssignedNumber()))); + if (sourceClient.getGroupDataModel().getActiveSanctionMechanism()== SanctionMechanism.NOSANCTION) + transmit(new ClientMessageEvent(sourceClient.getId(), + String.format("Ignoring token reduction request: Sanctioning not allowed in this round", targetClient.getAssignedNumber()))); + else + transmit(new ClientMessageEvent(sourceClient.getId(), + String.format("Ignoring token reduction request: # %d does not have any tokens to reduce.", targetClient.getAssignedNumber()))); return; } sourceClient.sanctionCost(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <al...@us...> - 2010-03-08 19:01:43
|
Revision: 483 http://virtualcommons.svn.sourceforge.net/virtualcommons/?rev=483&view=rev Author: alllee Date: 2010-03-08 19:01:37 +0000 (Mon, 08 Mar 2010) Log Message: ----------- fixed sample properties to work out of the box for local testing Modified Paths: -------------- foraging/trunk/build.properties.example Modified: foraging/trunk/build.properties.example =================================================================== --- foraging/trunk/build.properties.example 2010-03-04 00:32:42 UTC (rev 482) +++ foraging/trunk/build.properties.example 2010-03-08 19:01:37 UTC (rev 483) @@ -7,7 +7,7 @@ # the experiment server # FIXME: currently, this MUST be the same as the IP address/domain name of the # webserver you are deploying the software on. -server.address=libai.la.asu.edu +server.address=localhost # the absolute path of where you would like to deploy the experiment JNLP and # jar files @@ -20,7 +20,7 @@ # part of the URL you can just set the server.address and leave this property # blank since the build.xml that loads this properties file sets the codebase # url to the ${server.address} + "/foraging" by default. -codebase.url=http://${server.address}:8080/foraging +codebase.url=http://${server.address}:8080/ # set to whatever port you want the Java experiment server to run on (this is # *not* the webserver port, this is the experiment server port used to This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |