Changeset 17
- Timestamp:
- 09/22/20 08:52:49 (4 years ago)
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
pom.xml
r16 r17 7 7 <artifactId>runserver</artifactId> 8 8 <packaging>war</packaging> 9 <version>1. 4.4</version> <!-- must equal ${geniusweb.version} -->9 <version>1.5.0</version> <!-- must equal ${geniusweb.version} --> 10 10 <name>runserver Maven Webapp</name> 11 11 <url>http://maven.apache.org</url> … … 20 20 <jackson-2-version>2.9.10</jackson-2-version> 21 21 <tomcat.version>8.0.53</tomcat.version> 22 <geniusweb.version>1. 4.4</geniusweb.version>22 <geniusweb.version>1.5.0</geniusweb.version> 23 23 </properties> 24 24 … … 79 79 <groupId>tudelft.utilities</groupId> 80 80 <artifactId>repository</artifactId> 81 <version>1.1. 0</version>81 <version>1.1.1</version> 82 82 </dependency> 83 83 -
src/main/java/geniusweb/runserver/WebSocketProtToPartyConn.java
r16 r17 25 25 import geniusweb.actions.Action; 26 26 import geniusweb.actions.PartyId; 27 import geniusweb. party.inform.Inform;27 import geniusweb.inform.Inform; 28 28 import geniusweb.protocol.partyconnection.ProtocolToPartyConn; 29 29 import geniusweb.references.Reference; -
src/main/webapp/index.jsp
r4 r17 1 1 <html> 2 <head> 3 <link rel="stylesheet" type="text/css" href="style.css" /> 4 </head> 2 5 <body> 3 <h1>GeniusWeb Run Server</h1>6 <h1>GeniusWeb Run Server</h1> 4 7 5 <a href="newsession.xhtml">new session</a> 6 <br> 7 <a href="newtournament.xhtml">new tournament</a> 8 <br> 9 <a href="running.xhtml">view currently running negotiations</a> 10 <br> 11 <a href="log">view logs</a> 12 <p> 13 For help and more info, please refer to the <a href="https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWebRunServer"> run server page</a>. 8 <!-- the onclick construct is to pass through the search term in the URL --> 9 <aa onclick="window.location='newsession.xhtml'+window.location.search;" >new session</aa> 10 <br> 11 <aa onclick="window.location='newtournament.xhtml'+window.location.search;" >new tournament</aa> 12 <br> 13 <aa onclick="window.location='running.xhtml'+window.location.search;" >view currently running negotiations</aa> 14 <br> 15 <a href="log">view logs</a> 16 <p> 17 For help and more info, please refer to the <a 18 href="https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWebRunServer"> 19 run server page</a>. 14 20 </body> 15 21 </html> -
src/main/webapp/newsession.xhtml
r16 r17 4 4 <title>Profiles and Domains list</title> 5 5 <link rel="stylesheet" type="text/css" href="style.css" /> 6 7 6 </head> 8 7 <body onload="init()"> … … 14 13 <br /> Protocol: 15 14 <select id="selectedprotocol" onchange="selectProtocol()"> 16 <option value="SAOP">SAOP (stacked alternating offers)</option> 17 <option value="SHAOP">SHAOP (stacked human alternating 18 offers)</option> 15 <option value="SAOP">SAOP ( Stacked Alternating Offers 16 Protocol )</option> 17 <option value="MOPAC">MOPAC (Multiple Offers Partial 18 Consensus)</option> 19 <option value="AMOP">AMOP (Alternating Multiple Offers 20 Protocol)</option> 21 <option value="SHAOP">SHAOP (Stacked Human Alternating Offers 22 Protocol)</option> 19 23 </select> 20 24 25 <div id="votingevaluator"> 26 <br /> Voting Evaluator: <select id="selectedevaluator"> 27 <option value="LargestAgreement">Largest Agreement</option> 28 <option value="LargestAgreementsLoop">Largest Agreements and Repeat</option> 29 </select> 30 </div> 31 21 32 <br /> Deadline: 22 33 <input type="number" id="deadlinevalue" name="deadline" min="1" … … 29 40 <br /> Domain/Profile Server: 30 41 <input type="url" name="url" id="profilesserverurl" 31 value="localhost:8080/profilesserver-1. 4.4"42 value="localhost:8080/profilesserver-1.5.0" 32 43 pattern=".*:[0-9]+/profilesserver" size="30" 33 44 onchange="connectDomain()"> </input> … … 43 54 <br /> <b>Participants</b> <br /> Parties Server: <input type="url" 44 55 name="url" id="partiesserverurl" 45 value="localhost:8080/partiesserver-1. 4.4"56 value="localhost:8080/partiesserver-1.5.0" 46 57 pattern=".*:[0-9]+/partiesserver" size="30" 47 58 onchange="connectParties()"> </input> <br /> <br /> <b>Party … … 63 74 <input type="text" id="cobfilter" value="" maxlength="40" /> <br /> 64 75 <!-- --> 65 Parameters: { <textarea id="cobparameters" rows="2" cols="70" 66 onchange="updateCobParameters()" value="" /> } <br /> 67 <br /> 76 Parameters: { 77 <textarea id="cobparameters" rows="2" cols="70" 78 onchange="updateCobParameters()" value="" /> 79 } <br /> <br /> 68 80 </div> 69 81 </div> … … 115 127 116 128 <script type="application/javascript"> 129 130 117 131 118 132 … … 186 200 tbl.getElementsByTagName('col')[4].style.visibility=(visible?'':'collapse'); 187 201 tbl.getElementsByTagName('col')[5].style.visibility=(visible?'':'collapse'); 202 203 var evaluatorvisible=getSelectedProtocol() == "MOPAC"; 204 document.getElementById("votingevaluator").style.display=(evaluatorvisible ? 'block': 'none'); 188 205 189 206 } … … 198 215 domainwebsocket=null; 199 216 } 200 var url=document.getElementById("profilesserverurl").value; 201 var target = "ws://"+url+"/websocket/liststream"; 217 var url=new URL("http:"+document.getElementById("profilesserverurl").value); 218 // insert the liststream to the path 219 var target = "ws://"+url.host+url.pathname+"/websocket/liststream"+window.location.search+url.hash; 202 220 if ('WebSocket' in window) { 203 221 domainwebsocket = new WebSocket(target); … … 276 294 refresh table: copy all parties elements in there. 277 295 Typically parties is something like 278 [{"uri":"http:130.161.180.1:8080/partiesserver/run/randomparty-1. 4.4",296 [{"uri":"http:130.161.180.1:8080/partiesserver/run/randomparty-1.5.0", 279 297 "capabilities":{"protocols":["SAOP"]}, 280 298 "description":"places random bids until it can accept an offer with utility >0.6", 281 "id":"randomparty-1. 4.4",299 "id":"randomparty-1.5.0", 282 300 "partyClass":"geniusweb.exampleparties.randomparty.RandomParty"}, 283 301 ...] 284 302 */ 285 303 function updateParties(parties) { 286 updatePartiesCombobox(parties, document.getElementById("partyselection"),['SAOP',' SHAOP']);304 updatePartiesCombobox(parties, document.getElementById("partyselection"),['SAOP','AMOP','SHAOP']); 287 305 updatePartiesCombobox(parties, document.getElementById("cobpartyselection"),['COB']); 288 306 } … … 483 501 var logurl="log/"+this.responseText+".json"; 484 502 document.getElementById("logref").href=logurl; 485 document.getElementById("plotref").href="plotlog.xhtml?id="+this.responseText; 503 document.getElementById("plotref").href="plotlog.xhtml"+ 504 combineQuery("?id="+this.responseText,window.location.search); 486 505 487 506 sometimeWhen(function() { return urlExists(logurl) }, … … 499 518 500 519 520 521 /** 522 @param query1 a query string like &p=q (part of URL) 523 @param query2 another query string 524 @return the combined querystring of query1 and query2 525 */ 526 function combineQuery(query1, query2) { 527 if (query1=="") return query2; 528 if (query2=="") return query1; 529 return query1+"&"+query2.substring(1); 530 } 531 532 501 533 /** 502 534 @return true iff the URL exists. … … 521 553 */ 522 554 function makeRequest() { 523 524 if (getSelectedProtocol()=="SHAOP") {555 switch(getSelectedProtocol()) { 556 case "SHAOP": 525 557 return makeShaopRequest(); 526 } else { 527 return makeSaopRequest(); 558 case"SAOP": 559 case "AMOP": 560 return makeStdRequest(getSelectedProtocol()+"Settings"); 561 case "MOPAC": 562 return makeMopacRequest(); 528 563 } 529 564 } 530 565 531 566 /** 532 @return a SAOP request 533 */ 534 function makeSaopRequest() { 567 @return a SAOP/AMOP request 568 The header contains 'SAOSettings' or 'AMOPSettings' 569 */ 570 function makeStdRequest(header) { 571 return JSON.stringify({[header]: standardHeader() }); 572 } 573 574 /** 575 * @ereturn MOPAC request. Almost standard but extra 'votingEvaluator'. 576 */ 577 function makeMopacRequest() { 578 var extended = standardHeader(); 579 var combo = document.getElementById("selectedevaluator"); 580 var evaluator = combo.options[combo.selectedIndex].value; 581 extended['votingevaluator'] = { [evaluator]: {} }; 582 return JSON.stringify({"MOPACSettings": extended }); 583 } 584 585 /** 586 @return standard header with participants and deadline 587 */ 588 function standardHeader() { 535 589 var deadline={}; 536 590 var value = document.getElementById("deadlinevalue").value; … … 542 596 deadline["deadlinerounds"] = {"rounds": value, "durationms":10000}; 543 597 } 544 545 return JSON.stringify({"SAOPSettings": { "participants": partyprofiles, "deadline":deadline }}); 546 } 598 return { "participants": partyprofiles, "deadline":deadline } 599 } 600 601 547 602 548 603 /** … … 577 632 function init() { 578 633 selectProtocol(); 579 document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-1. 4.4"580 document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-1. 4.4"634 document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-1.5.0" 635 document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-1.5.0" 581 636 connectDomain(); 582 637 connectParties(); … … 592 647 593 648 649 650 594 651 </script> 595 652 -
src/main/webapp/newtournament.xhtml
r16 r17 36 36 id="protocolselection" onchange="selectProtocol()"> 37 37 <option value="SAOP">SAOP</option> 38 <option value="MOPAC">MOPAC</option> 39 <option value="AMOP">AMOP</option> 38 40 <option value="SHAOP">SHAOP</option> 39 </select> <br /> Deadline: <input type="number" id="deadlinevalue" 41 42 43 </select> 44 45 <div id="votingevaluator"> 46 <br /> Voting Evaluator: <select id="selectedevaluator"> 47 <option value="LargestAgreement">Largest Agreement</option> 48 <option value="LargestAgreementsLoop">Largest Agreements 49 and Repeat</option> 50 </select> 51 </div> 52 53 54 <br /> Deadline: <input type="number" id="deadlinevalue" 40 55 name="deadline" min="1" max="10000" value="10" /> <select 41 56 id="deadlinetype"> … … 87 102 <!-- party 1 selection --> 88 103 Party: <select id="partyselection"> 89 </select> 90 <br /> Parameters: { 104 </select> <br /> Parameters: { 91 105 <textarea id="parameters" rows="2" cols="70" 92 106 onchange="getParameters('parameters')" value="" /> … … 95 109 <div class="onlySHAOP"> 96 110 COB: <select id="partyselection2"> 97 </select> 98 <br /> Parameters: { 111 </select> <br /> Parameters: { 99 112 <textarea id="parameters2" rows="2" cols="70" 100 113 onchange="getParameters('parameters2')" value="" /> … … 166 179 167 180 181 168 182 // FIXME quick and dirty code. No clean MVC 169 183 … … 186 200 */ 187 201 function selectProtocol() { 188 const isShaop= "SHAOP"==document.getElementById("protocolselection").value; 189 setStyleSheet('.onlySHAOP','{ display: '+(isShaop? '?':'none')+'; }') 202 const protocol = document.getElementById("protocolselection").value; 203 setStyleSheet('.onlySHAOP','{ display: '+(protocol=="SHAOP"? '?':'none')+'; }') 204 205 document.getElementById("votingevaluator").style.display=(protocol=="MOPAC" ? 'block': 'none'); 190 206 } 191 207 … … 536 552 537 553 // create S(H)AOPSettings. [header] is a weird ECMA script workaround for javascript issue. 538 const sessionSettings = { [header]:{"participants":[],"deadline":deadline}}; 539 554 var settingvalues={"participants":[],"deadline":deadline}; 555 if (protocol=="MOPAC") { 556 var combo = document.getElementById("selectedevaluator"); 557 var evaluator = combo.options[combo.selectedIndex].value; 558 settingvalues['votingevaluator'] = { [evaluator]: {} }; 559 } 560 561 const sessionSettings = { [header]:settingvalues}; 562 540 563 var teamsFull = []; 541 564 for (const team of teamslist) { 542 if (protocol=="S AOP") // only first member of team is used.543 teamsFull.push({"Team": [team[0]]});565 if (protocol=="SHAOP") 566 teamsFull.push({"Team":team}); 544 567 else 545 teamsFull.push({"Team": team});568 teamsFull.push({"Team":[team[0]]}); // most protocols have just 1 member per team 546 569 } 547 570 var profilesFull = [] ; 548 571 for (const profileset of profiles) { 549 if (protocol=="SAOP") // only first member of team is used. 572 if (protocol=="SHAOP") // only first member of team is used. 573 profilesFull.push({"ProfileList":profileset}); 574 else 550 575 profilesFull.push({"ProfileList":[profileset[0]]}); 551 else552 profilesFull.push({"ProfileList":profileset});553 576 } 554 577 … … 562 585 */ 563 586 function init() { 564 document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-1. 4.4";565 document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-1. 4.4";587 document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-1.5.0"; 588 document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-1.5.0"; 566 589 567 590 selectProtocol(); … … 587 610 588 611 612 589 613 </script> 590 614 -
src/main/webapp/plotlog.xhtml
r16 r17 4 4 <title>Plot log results</title> 5 5 <script src="Chart.min_2.8.0.js"></script> 6 <script src="utils.js"></script> 6 7 </head> 7 8 <style> … … 23 24 <div id="progress">Waiting for log file name</div> 24 25 <br /> 25 <div>Notice, the plotted utilities do not include possible elicitation costs.</div> 26 <div>Notice, the plotted utilities do not include possible 27 elicitation costs.</div> 26 28 <div style="width: 100%;"> 27 29 <canvas id="canvas"></canvas> 28 30 </div> 29 30 Agreement: <div id="agreement" style="display:inline;">?</div> 31 32 Agreement: 33 <div id="agreement" style="display: inline;">?</div> 31 34 </body> 32 35 … … 39 42 40 43 44 45 41 46 42 47 … … 52 57 53 58 function connect() { 54 55 var id=document.location.search; 56 id = location.search.split('id=')[1] 57 if (id==undefined) return; 59 var query = new URLSearchParams(location.search); 60 var id=query.get('id'); 61 if (id==undefined) { 62 alert("missing ?id=<logfile> in URL"); 63 return; 64 } 58 65 59 66 // load the log file with given id … … 96 103 var profs=json['partyprofiles']; 97 104 for (var party in profs) { 98 partyprofiles[party]= profs[party]['profile'].split('?',1)[0]; // hacky, remove complete query.105 partyprofiles[party]=withoutPartial(profs[party]['profile']); 99 106 } 100 107 101 108 getProfiles(json, partyprofiles); 102 109 } 110 103 111 104 112 /** … … 112 120 if ( (nr & 1 != 0)) continue; // skip COB parties 113 121 var shaop=teams[nr/2]['shaop']; 114 var profile = shaop['profile'].split('?',1)[0]; // hacky, remove complete query.122 var profile = withoutPartial(shaop['profile']); // hacky, remove complete query. 115 123 partyprofiles[partyid]=profile; 116 124 } … … 120 128 } 121 129 130 131 /** 132 @param uristr a string with an uri that may have ?partial=XX 133 @return the given uristr without the "partia=XXl" value 134 */ 135 function withoutPartial(uristr) { 136 var profuri=new URL(uristr); 137 var searchParams = new URLSearchParams(profuri.search); 138 searchParams.delete("partial"); 139 profuri.search = searchParams.toString(); 140 return profuri.toString(); 141 142 } 122 143 123 144 /** … … 371 392 372 393 394 395 373 396 </script> 374 397 … … 376 399 377 400 <script type="application/javascript"> 401 402 378 403 379 404 … … 407 432 408 433 434 435 409 436 </script> 410 437 -
src/main/webapp/style.css
r12 r17 23 23 This css is programmatically changed when protocol changes */ 24 24 .onlySHAOP { } 25 26 /* substitute for <a> as in <a href-..> */ 27 aa { 28 color: blue; 29 text-decoration: underline; 30 }
Note:
See TracChangeset
for help on using the changeset viewer.