Changeset 14 for src/main/webapp
- Timestamp:
- 06/11/20 16:34:50 (4 years ago)
- Location:
- src/main/webapp
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/webapp/WEB-INF/web.xml
r12 r14 45 45 </servlet> 46 46 47 <servlet> 48 <servlet-name>Info</servlet-name> 49 <display-name>Info</display-name> 50 <description>get info</description> 51 <servlet-class>geniusweb.runserver.Info</servlet-class> 52 </servlet> 53 47 54 48 55 <servlet-mapping> … … 54 61 <url-pattern>/run</url-pattern> 55 62 </servlet-mapping> 56 63 <servlet-mapping> 64 <servlet-name>Info</servlet-name> 65 <url-pattern>/info</url-pattern> 66 </servlet-mapping> 57 67 58 68 </web-app> -
src/main/webapp/newsession.xhtml
r13 r14 29 29 <br /> Domain/Profile Server: 30 30 <input type="url" name="url" id="profilesserverurl" 31 value="localhost:8080/profilesserver-1.4. 0"31 value="localhost:8080/profilesserver-1.4.1" 32 32 pattern=".*:[0-9]+/profilesserver" size="30" 33 33 onchange="connectDomain()"> </input> … … 43 43 <br /> <b>Participants</b> <br /> Parties Server: <input type="url" 44 44 name="url" id="partiesserverurl" 45 value="localhost:8080/partiesserver-1.4. 0"45 value="localhost:8080/partiesserver-1.4.1" 46 46 pattern=".*:[0-9]+/partiesserver" size="30" 47 47 onchange="connectParties()"> </input> <br /> <br /> <b>Party … … 273 273 refresh table: copy all parties elements in there. 274 274 Typically parties is something like 275 [{"uri":"http:130.161.180.1:8080/partiesserver/run/randomparty-1.4. 0",275 [{"uri":"http:130.161.180.1:8080/partiesserver/run/randomparty-1.4.1", 276 276 "capabilities":{"protocols":["SAOP"]}, 277 277 "description":"places random bids until it can accept an offer with utility >0.6", 278 "id":"randomparty-1.4. 0",278 "id":"randomparty-1.4.1", 279 279 "partyClass":"geniusweb.exampleparties.randomparty.RandomParty"}, 280 280 ...] … … 571 571 function init() { 572 572 selectProtocol(); 573 document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-1.4. 0"574 document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-1.4. 0"573 document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-1.4.1" 574 document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-1.4.1" 575 575 connectDomain(); 576 576 connectParties(); -
src/main/webapp/newtournament.xhtml
r12 r14 18 18 </select> 19 19 <br /> 20 <br /> 21 <input type="number" id="teamspersession" name="tentacles" min="2" 22 max="10" value="2" /> Number of teams in each session 20 <input type="number" id="ntournaments" min="1" max="1000000" value="1" /> 21 Number of times to repeat the entire tournament 22 <br /> 23 24 <br /> 25 <input type="number" id="teamspersession" min="2" max="10" value="2" /> 26 Number of teams in each session 23 27 <br /> 24 28 … … 103 107 <th align="left">Party</th> 104 108 <th align="left">Parameters</th> 105 <th align="left"><div class="onlySHAOP">Compare Bids Party</div></th> 106 <th align="left"><div class="onlySHAOP">Compare Bids Parameters</div></th> 109 <th align="left"><div class="onlySHAOP">Compare Bids 110 Party</div></th> 111 <th align="left"><div class="onlySHAOP">Compare Bids 112 Parameters</div></th> 107 113 </thead> 108 114 <tbody id="teamList"> … … 127 133 128 134 <script type="application/javascript"> 135 129 136 130 137 … … 506 513 function makeRequest() { 507 514 const npersession = document.getElementById("teamspersession").value; 515 const ntournaments = document.getElementById("ntournaments").value; 508 516 const reuseTeams = document.getElementById("reuseteams").checked; 509 517 const protocolcombobox = document.getElementById("protocolselection"); … … 540 548 541 549 return JSON.stringify({"AllPermutationsSettings":{"teams":teamsFull,"profileslists":profilesFull, 542 "reuseTeams":reuseTeams,"teamsPerSession":npersession,"sessionsettings":sessionSettings}}); 550 "reuseTeams":reuseTeams,"teamsPerSession":npersession,"sessionsettings":sessionSettings, 551 "numberTournaments":ntournaments}}); 543 552 } 544 553 … … 547 556 */ 548 557 function init() { 549 document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-1.4. 0";550 document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-1.4. 0";558 document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-1.4.1"; 559 document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-1.4.1"; 551 560 552 561 selectProtocol(); … … 570 579 571 580 581 572 582 </script> 573 583 -
src/main/webapp/plotlog.xhtml
r10 r14 26 26 <canvas id="canvas"></canvas> 27 27 </div> 28 29 Agreement: <div id="agreement" style="display:inline;">?</div> 28 30 </body> 29 31 … … 127 129 var keys = Object.keys(partyprofileURIs); 128 130 if (keys.length==0) { 129 plotResults(computeUtils(json, partyprofiles) );131 plotResults(computeUtils(json, partyprofiles), isAgreement(json)); 130 132 return; 131 133 } … … 158 160 159 161 /** 162 @return true if there is agreement 163 */ 164 function isAgreement(logfile) { 165 var actions=logfile['actions']; 166 var lastact = actions[actions.length -1]; 167 return 'accept' in lastact; 168 } 169 /** 160 170 @json the log file contents 161 171 @param partyprofiles a dict with key=party id and value a the (linear additive) profile … … 199 209 /** 200 210 @param utilities the dict with key=party id of the utilities of all steps for each party ) 201 */ 202 203 function plotResults( utilities) { 211 @param isAgreement true iff there is agreement reached 212 */ 213 214 function plotResults( utilities, isAgreement) { 204 215 setStatus("Plotting" ) 216 217 document.getElementById('agreement').innerHTML=isAgreement?"Yes":"No"; 205 218 206 219 var parties=Object.keys(utilities); -
src/main/webapp/utilstable.xhtml
r13 r14 257 257 */ 258 258 function addUtilityCell(cell, agreedbid, partyname, profileurl) { 259 if (Object.keys(agreedbid).lengt==0) {260 cell.innerHTML = "0 :"+partyname;261 return;262 }263 259 var util = utility(profiles[profileurl],agreedbid); 264 260 cell.innerHTML = Math.round(util*1000000)/1000000 +" :"+partyname; … … 267 263 268 264 269 270 271 /**272 @json the log file contents273 @param partyprofiles a dict with key=party id and value a the (linear additive) profile274 */275 function computeUtils(json, partyprofiles) {276 277 setStatus("Computing utilities.")278 var utilities={};279 for (var party in partyprofiles) {280 utilities[party]=[];281 }282 var actions = json['actions'];283 for (var action in actions) {284 var offer = actions[action];285 if (offer['offer']==undefined)286 continue;287 var issueutilities = offer['offer']['bid']['issuevalues']288 for (var party in partyprofiles) {289 utilities[party].push(utility(partyprofiles[party],issueutilities));290 }291 }292 return utilities;293 294 295 }296 265 297 266 … … 324 293 /** 325 294 Compute utilityes 326 @param linadditive the linear additive utility space295 @param profile the linear additive utility space 327 296 @param issueValues the bid containing dict with values for the issues 328 @return utility of issueValues 297 @param isResBidAlternative true if the reservation bid is usable as alternative bid 298 . If true, and the issueValues list is empty/null, this returns the utility 299 of the reservation bid instead. 300 @return utility of issueValues. Returns 0 if profile =null or no bid available 301 329 302 */ 330 function utility(profile, issueValues) { 303 function utility(profile, issueValues, isResBidAlternative) { 304 if (profile==null) return 0; 305 306 // check if we need the reservationbid. 307 if (issueValues==null || Object.keys(issueValues).length==0) { 308 var resBid = profile['reservationBid']; 309 if (resBid==null) return 0; 310 issueValues = resBid['issuevalues']; 311 } 312 313 if (issueValues==null) return 0; 314 331 315 var util=0; 332 316 var weights = profile['issueWeights']; … … 359 343 if (utilfunc['discreteutils']!=undefined) { 360 344 // it's discrete issue. Compute 361 return utilfunc['discreteutils']['valueUtilities'][value]; 345 if (value in utilfunc['discreteutils']['valueUtilities']) 346 return utilfunc['discreteutils']['valueUtilities'][value]; 347 return 0; 362 348 } 363 349 setStatus("Unknown utility function type "+Object.keys(utilfunc));
Note:
See TracChangeset
for help on using the changeset viewer.