Changeset 69


Ignore:
Timestamp:
10/11/21 16:01:02 (3 years ago)
Author:
Wouter Pasman
Message:

Added MOPAC protocol. For GeniusWeb 2.0.3

Files:
41 added
12 edited

Legend:

Unmodified
Added
Removed
  • exampleparties/randomparty/requirements.txt

    r67 r69  
    1 https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWebPython/export/66/geniuswebcore/dist/geniusweb-1.1.0.tar.gz
     1https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWebPython/export/68/geniuswebcore/dist/geniusweb-1.1.1.tar.gz
    22mypy
    33
  • exampleparties/randomparty/setup.py

    r67 r69  
    33setup(
    44    name='randomparty',
    5     version='1.1.0',   
     5    version='1.1.1',   
    66    description='A python3 party that places random bids with sufficient utility',
    77    url='https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWeb',
    88    author='W.Pasman',
    99    packages=['randomparty'],
    10     install_requires=[ "geniusweb@https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWebPython/export/66/geniuswebcore/dist/geniusweb-1.1.0.tar.gz"],
     10    install_requires=[ "geniusweb@https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWebPython/export/68/geniuswebcore/dist/geniusweb-1.1.1.tar.gz"],
    1111    py_modules=['party']
    1212)
  • exampleparties/stupidparty/requirements.txt

    r67 r69  
    1 https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWebPython/export/66/geniuswebcore/dist/geniusweb-1.1.0.tar.gz
     1https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWebPython/export/68/geniuswebcore/dist/geniusweb-1.1.1.tar.gz
    22mypy
    33
  • exampleparties/stupidparty/setup.py

    r67 r69  
    33setup(
    44    name='stupidparty',
    5     version='1.1.0',   
     5    version='1.1.1',   
    66    description='A example python3 party module',
    77    url='https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWeb',
    88    author='W.Pasman',
    99    packages=['stupidparty'],
    10     install_requires=[ "geniusweb@https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWebPython/export/66/geniuswebcore/dist/geniusweb-1.1.0.tar.gz"],
     10    install_requires=[ "geniusweb@https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWebPython/export/68/geniuswebcore/dist/geniusweb-1.1.1.tar.gz"],
    1111    py_modules=['party'],
    1212
  • geniuswebcore/geniusweb/progress/ProgressTime.py

    r67 r69  
    5555
    5656        def getTerminationTime(self) -> datetime:
    57                 return datetime.fromtimestamp( int(datetime.timestamp(self._start)*1000) + self._duration);
     57                return datetime.fromtimestamp( (int(datetime.timestamp(self._start)*1000) + self._duration)/1000.);
    5858       
    5959
  • geniuswebcore/geniusweb/protocol/NegoSettings.py

    r67 r69  
    88
    99
    10 @JsonSubTypes( ["geniusweb.protocol.session.saop.SAOPSettings.SAOPSettings" ])
     10@JsonSubTypes( ["geniusweb.protocol.session.saop.SAOPSettings.SAOPSettings",
     11                        "geniusweb.protocol.session.mopac.MOPACSettings.MOPACSettings" ])
    1112@JsonTypeInfo(use = Id.NAME, include = As.WRAPPER_OBJECT)
    1213class NegoSettings(ABC):
  • geniuswebcore/requirements.txt

    r67 r69  
    11wheel
    2 https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/export/306/pyson/dist/pyson-1.1.1.tar.gz
    3 https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/export/304/utilitiespy/dist/utilities-1.0.3.tar.gz
     2https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/export/312/pyson/dist/pyson-1.1.3.tar.gz
     3https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/export/309/utilitiespy/dist/utilities-1.0.4.tar.gz
    44https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/export/226/loggingpy/dist/logging-1.0.0.tar.gz
    55websocket-client==1.0.1
  • geniuswebcore/setup.py

    r67 r69  
    33setup(
    44    name='geniusweb',
    5     version='1.1.0',   
     5    version='1.1.1',   
    66    description='GeniusWeb glue code to connect python3 parties',
    77    url='https://tracinsy.ewi.tudelft.nl/pubtrac/GeniusWeb',
     
    1111    package_data = { 'geniusweb': ['py.typed'],'tudelft': ['py.typed']    },
    1212    install_requires=[
    13         "pyson@https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/export/306/pyson/dist/pyson-1.1.1.tar.gz",
    14         "utilities@https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/export/304/utilitiespy/dist/utilities-1.0.3.tar.gz",
     13        "pyson@https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/export/312/pyson/dist/pyson-1.1.3.tar.gz",
     14        "utilities@https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/export/309/utilitiespy/dist/utilities-1.0.4.tar.gz",
    1515        "logging@https://tracinsy.ewi.tudelft.nl/pubtrac/Utilities/export/226/loggingpy/dist/logging-1.0.0.tar.gz",
    1616        "websocket-client==1.0.1"
  • geniuswebcore/test/geniusweb/progress/ProgressTimeTest.py

    r67 r69  
    4141       
    4242    def testTerminationTime(self):
    43         self.assertEqual(datetime.fromtimestamp(100000900+1999), self.progress.getTerminationTime())
     43        self.assertEqual(datetime.fromtimestamp((100000900+1999)/1000), self.progress.getTerminationTime())
    4444       
    4545    def testGet(self):
  • geniuswebcore/test/geniusweb/simplerunner/SessionRunnerE2ETest.py

    r67 r69  
    2727        params = ["test/resources/settings.json",
    2828#                                "test/resources/settings2.json" ,          PARTIALORDERING NOT YET
    29                                  "test/resources/settingsbadprofile.json"
     29                                 "test/resources/settingsbadprofile.json",
    3030#                                "test/resources/shaoptoursettings.json",   ALLPERMUTATIONSETTINGS NOT YET
    31 #                                "test/resources/mopac.json" ,              MOPAC NOT YET
     31                                 "test/resources/mopac.json"
    3232#                                "test/resources/tournament.json"                       ALLPERMUTATIONSETTINGS NOT YET
    3333                                 ]
  • geniuswebcore/test/resources/mopac.json

    r67 r69  
    44                {"TeamInfo":{"parties":[
    55                {
    6                         "party": {"partyref":"classpath:geniusweb.exampleparties.randomparty.RandomParty", "parameters":{"power":1}},
    7                         "profile": "file:src/test/resources/jobs/jobs1.json"
     6                        "party": {"partyref":"pythonpath:test.testparty.TestParty.TestParty", "parameters":{"power":1}},
     7                        "profile": "file:test/resources/jobs/jobs1.json"
    88                } ]}},
    99               
    1010                {"TeamInfo":{"parties":[
    1111                {
    12                         "party": {"partyref":"classpath:geniusweb.exampleparties.randomparty.RandomParty", "parameters":{"power":1}},
    13                         "profile": "file:src/test/resources/jobs/jobs2.json"
     12                        "party": {"partyref":"pythonpath:test.testparty.TestParty.TestParty", "parameters":{"power":1}},
     13                        "profile": "file:test/resources/jobs/jobs2.json"
    1414                } ]}} ],
    1515                "deadline": {
  • geniuswebcore/test/testparty/TestParty.py

    r67 r69  
    22import logging
    33import sys
    4 from typing import Dict, Any
     4from typing import Dict, Any, Set
    55from typing import cast
    66
     
    99from geniusweb.actions.Offer import Offer
    1010from geniusweb.actions.PartyId import PartyId
     11from geniusweb.actions.Vote import Vote
     12from geniusweb.actions.Votes import Votes
    1113from geniusweb.inform.ActionDone import ActionDone
    1214from geniusweb.inform.Finished import Finished
    1315from geniusweb.inform.Inform import Inform
     16from geniusweb.inform.OptIn import OptIn
    1417from geniusweb.inform.Settings import Settings
     18from geniusweb.inform.Voting import Voting
    1519from geniusweb.inform.YourTurn import YourTurn
    1620from geniusweb.issuevalue.Bid import Bid
     
    3539        #self.getReporter().log(logging.INFO,"received info:"+str(info))
    3640        if isinstance(info,Settings) :
    37             settings:Settings=cast(Settings,info)   
    38             self._me = settings.getID()
    39             self._protocol = settings.getProtocol()
     41            self._settings:Settings=cast(Settings,info)   
     42            self._me = self._settings.getID()
     43            self._protocol = self._settings.getProtocol()
    4044        elif isinstance(info, ActionDone):
    4145            action:Action=cast( ActionDone,info).getAction()
     
    5458                val(self.getConnection()).send(offer)
    5559                self.getReporter().log(logging.INFO,"sent empty offer:")
     60        elif isinstance(info, Voting):
     61            # MOPAC protocol
     62            self._lastvotes = self._vote(cast(Voting, info));
     63            val(self.getConnection()).send(self._lastvotes)
     64        elif isinstance(info, OptIn):
     65            val(self.getConnection()).send(self._lastvotes)
     66
    5667        elif isinstance(info, Finished):
    5768            self.terminate()
     
    7687            self._profile = None
    7788
     89    def _vote(self, voting:Voting) ->Votes :
     90        '''
     91        @param voting the {@link Voting} object containing the options
     92       
     93        @return our next Votes. Stupid: vote for all received offers.
     94        '''
     95        votes:Set[Vote]  = set([Vote(self._me, offer.getBid(), 2, 5)\
     96                for offer in voting.getOffers() ])
     97        return Votes(self._me, votes)
Note: See TracChangeset for help on using the changeset viewer.