Changeset 46 for src/main/webapp
- Timestamp:
- 12/18/24 13:54:06 (5 days ago)
- Location:
- src/main/webapp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/main/webapp/newsession.xhtml
r45 r46 50 50 <br /> Domain/Profile Server: 51 51 <input type="url" name="url" id="profilesserverurl" 52 value="localhost:8080/profilesserver-2. 1.6"52 value="localhost:8080/profilesserver-2.2.1" 53 53 pattern=".*:[0-9]+/profilesserver.*" size="30" 54 54 onchange="connectDomain()"> </input> … … 65 65 <br /> <b>Participants</b> <br /> Parties Server: <input type="url" 66 66 name="url" id="partiesserverurl" 67 value="localhost:8080/partiesserver-2. 1.6"67 value="localhost:8080/partiesserver-2.2.1" 68 68 pattern=".*:[0-9]+/partiesserver.*" size="30" 69 69 onchange="connectParties()"> </input> <br /> <br /> <b>Party … … 356 356 refresh table: copy all parties elements in there. 357 357 Typically parties is something like 358 [{"uri":"http:130.161.180.1:8080/partiesserver/run/randomparty-2. 1.6",358 [{"uri":"http:130.161.180.1:8080/partiesserver/run/randomparty-2.2.1", 359 359 "capabilities":{"protocols":["SAOP"]}, 360 360 "description":"places random bids until it can accept an offer with utility >0.6", 361 "id":"randomparty-2. 1.6",361 "id":"randomparty-2.2.1", 362 362 "partyClass":"geniusweb.exampleparties.randomparty.RandomParty"}, 363 363 ...] … … 736 736 function init() { 737 737 selectProtocol(); 738 document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-2. 1.6"739 document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-2. 1.6"738 document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-2.2.1" 739 document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-2.2.1" 740 740 connectDomain(); 741 741 connectParties(); -
src/main/webapp/newtournament.xhtml
r45 r46 683 683 */ 684 684 function init() { 685 document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-2. 1.6";686 document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-2. 1.6";685 document.getElementById("partiesserverurl").value =window.location.hostname+":8080/partiesserver-2.2.1"; 686 document.getElementById("profilesserverurl").value =window.location.hostname+":8080/profilesserver-2.2.1"; 687 687 688 688 selectSessionProtocol(); -
src/main/webapp/plotlog.xhtml
r45 r46 56 56 57 57 var ws = null; 58 59 function arrayequals(array1, array2) { 60 return array1.length === array2.length && array1.every(function(value, index) { return value === array2[index]}) 61 } 58 62 59 63 <!-- Most functions are reactive programming written out--> … … 179 183 ws.onmessage = function (event) { 180 184 var profile = JSON.parse(event.data); 181 if (profile['LinearAdditiveUtilitySpace']==undefined ) {182 setStatus('Fatal: profile '+uri+" does not contain a LinearAdditive UtilitySpace.");185 if (profile['LinearAdditiveUtilitySpace']==undefined && profile['SumOfGroupsUtilitySpace']==undefined) { 186 setStatus('Fatal: profile '+uri+" does not contain a LinearAdditive- or SumOfGroups UtilitySpace."); 183 187 return; 184 188 } 185 partyprofiles[party]=profile ['LinearAdditiveUtilitySpace'];189 partyprofiles[party]=profile; 186 190 getProfiles(json, partyprofileURIs, protocol, partyprofiles); 187 191 }; … … 381 385 382 386 387 function utility(profile, issueValues) { 388 if (profile['LinearAdditiveUtilitySpace']!=undefined) 389 return linearUtility(profile['LinearAdditiveUtilitySpace'], issueValues); 390 391 if (profile['SumOfGroupsUtilitySpace']!=undefined) 392 return groupUtility(profile['SumOfGroupsUtilitySpace'], issueValues); 393 394 } 395 396 /** 397 Compute utilityes for a linear-additive profile 398 @param linadditive the linear additive utility space 399 @param issueValues the bid containing dict with values for the issues 400 @return utility of issueValues 401 */ 402 function groupUtility(profile, issueValues) { 403 var util=0; 404 405 for (var part in profile['partUtilities']) { 406 util = util + grouputil(profile['partUtilities'][part]['PartsUtilities'], issueValues ); 407 } 408 return util; 409 } 410 411 function grouputil(partutils, issueValues) { 412 413 // extract the exact value list of this group 414 var value = [] 415 for (const iss of partutils['issues']) { 416 value.push( issueValues[iss] ) 417 } 418 419 // find the utility in the utilslist 420 for (const item of partutils['utilslist']) { 421 if ( arrayequals( item['values'], value)) 422 return item['util'] 423 } 424 return 0; // fallback, not found. Maybe error? 425 426 } 427 428 383 429 384 385 430 /** 386 Compute utilityes 431 Compute utilityes for a linear-additive profile 387 432 @param linadditive the linear additive utility space 388 433 @param issueValues the bid containing dict with values for the issues 389 434 @return utility of issueValues 390 435 */ 391 function utility(profile, issueValues) {436 function linearUtility(profile, issueValues) { 392 437 var util=0; 393 438 var weights = profile['issueWeights']; … … 399 444 } 400 445 401 /** 446 447 /** 402 448 Bit hacky, javascript version of evaluator of utility space. 403 449 Would be much nicer if we could use java here … … 437 483 438 484 485 439 486 </script> 440 487
Note:
See TracChangeset
for help on using the changeset viewer.