Changeset 46 for src/main


Ignore:
Timestamp:
12/18/24 13:54:06 (5 days ago)
Author:
ruud
Message:

All TimeDependent parties now support the nonlinear SumOfGroupsUtilitySpace. Example Nonlinear space in the computer domain

Location:
src/main/webapp
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/main/webapp/newsession.xhtml

    r45 r46  
    5050        <br /> Domain/Profile Server:
    5151        <input type="url" name="url" id="profilesserverurl"
    52                 value="localhost:8080/profilesserver-2.1.6"
     52                value="localhost:8080/profilesserver-2.2.1"
    5353                pattern=".*:[0-9]+/profilesserver.*" size="30"
    5454                onchange="connectDomain()"> </input>
     
    6565                <br /> <b>Participants</b> <br /> Parties Server: <input type="url"
    6666                        name="url" id="partiesserverurl"
    67                         value="localhost:8080/partiesserver-2.1.6"
     67                        value="localhost:8080/partiesserver-2.2.1"
    6868                        pattern=".*:[0-9]+/partiesserver.*" size="30"
    6969                        onchange="connectParties()"> </input> <br /> <br /> <b>Party
     
    356356         refresh table: copy all parties elements in there.
    357357         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",
    359359                 "capabilities":{"protocols":["SAOP"]},
    360360                 "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",
    362362                 "partyClass":"geniusweb.exampleparties.randomparty.RandomParty"},
    363363                                 ...]
     
    736736        function init() {
    737737                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"
    740740                connectDomain();
    741741                connectParties();
  • src/main/webapp/newtournament.xhtml

    r45 r46  
    683683        */
    684684        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";
    687687
    688688                selectSessionProtocol();
  • src/main/webapp/plotlog.xhtml

    r45 r46  
    5656       
    5757        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        }
    5862
    5963        <!-- Most functions are reactive programming written out-->
     
    179183            ws.onmessage = function (event) {
    180184                var profile = JSON.parse(event.data);
    181                 if (profile['LinearAdditiveUtilitySpace']==undefined) {
    182                     setStatus('Fatal: profile '+uri+" does not contain a LinearAdditiveUtilitySpace.");
     185                if (profile['LinearAdditiveUtilitySpace']==undefined && profile['SumOfGroupsUtilitySpace']==undefined) {
     186                    setStatus('Fatal: profile '+uri+" does not contain a LinearAdditive- or SumOfGroups UtilitySpace.");
    183187                    return;
    184188                }
    185                 partyprofiles[party]=profile['LinearAdditiveUtilitySpace'];
     189                partyprofiles[party]=profile;
    186190                getProfiles(json, partyprofileURIs, protocol, partyprofiles);
    187191            };
     
    381385       
    382386   
     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       
    383429   
    384                
    385430        /**
    386                 Compute utilityes
     431                Compute utilityes for a linear-additive profile
    387432                @param linadditive the linear additive utility space
    388433                @param issueValues the bid containing dict with values for the issues
    389434                @return utility of issueValues
    390435                */
    391                 function utility(profile, issueValues) {
     436                function linearUtility(profile, issueValues) {
    392437                        var util=0;
    393438                        var weights = profile['issueWeights'];
     
    399444                }
    400445       
    401                 /**
     446
     447        /**
    402448                Bit hacky, javascript version of evaluator of utility space.
    403449                Would be much nicer if we could use java here
     
    437483
    438484
     485
    439486</script>
    440487
Note: See TracChangeset for help on using the changeset viewer.