Exemplo n.º 1
0
    def reset(self, initState=None):
        """
        resets the environment to starting conditions, i.e. starts a new game
 
        """
        if initState is None:
            rawData = self.rawGen.generateDinner()
            assigner = assignDinnerCourses(rawData[0], rawData[1])
            dinnerAssigned = assigner.assignDinnerCourses(random=False)
            self.env = state(data=dinnerAssigned,
                             dinnerTime=self.dinnerTime,
                             travelMode=self.travelMode,
                             padSize=self.padSize,
                             shuffleTeams=self.shuffleTeams)
            self.env.initNormalState()
        else:
            self.env = initState
        self.validActions = 0 * self.validActions
        self.validActions[self.env.getValidActions()] = 1
        if not self.restrictValidActions:
            self.validActions[:] = 1
        self.state = self.env.getState()
        self.netState = [self.raw2singleNetState()] * len(self.netState)
        self.is_done = False
        self.is_partDone = False  # is set to True if all non-rescue teams have been assigned.
        self.score = 0
        self.lastReward = -np.Inf
Exemplo n.º 2
0
 def __init__(self,
              dinnerTable,
              finalPartyLocation,
              dinnerTime,
              travelMode='simple',
              shuffleTeams=False,
              padSize=50,
              tableAssigner=randomAgent,
              **kwargs):
     """
     Args:
         dinnerTable (pandas dataframe): info about all the teams in defined format
         finalPartyLocation (array): geocoordinates of the final party location
         dinnerTime (datetime): time of the dinner
         travelMode (string): see state.__init__ documentation for details.
                              'simple' is safe and easy
         shuffleTeams (bool): If True, the choice, which team is seated next is random. 
                              Otherwise, always the subsequent team will be seated.
         padSize (int): see state.py __init__. Must be at least as high as the number of participating teams.
         tableAssigner (class with a chooseAction method): the logic to assign tables
         **kwargs: additional arguments passed to the tableAssigner
     """
     self.courseAssigner = assignDinnerCourses(dinnerTable,
                                               finalPartyLocation)
     self.state = state(dinnerTable, dinnerTime, travelMode, shuffleTeams,
                        padSize)
     self.tableAssigner = tableAssigner(**kwargs)
     self.validation = validation()
Exemplo n.º 3
0
from datetime import datetime


Dinner1 = randomDinnerGenerator(numberOfTeams=20
                                    ,centerAddress={'lat':53.551086, 'lng':9.993682}
                                    ,radiusInMeter=5000
                                    ,wishStarterProbability=0.3
                                    ,wishMainCourseProbability=0.4
                                    ,wishDessertProbability=0.3
                                    ,rescueTableProbability=0.5
                                    ,meatIntolerantProbability=0
                                    ,animalProductsIntolerantProbability=0
                                    ,lactoseIntolerantProbability=0
                                    ,fishIntolerantProbability=0
                                    ,seafoodIntolerantProbability=0
                                    ,dogsIntolerantProbability=0
                                    ,catsIntolerantProbability=0
                                    ,dogFreeProbability=0
                                    ,catFreeProbability=0
                                    ,verbose=0
                                    ,checkValidity = True)
dinner,finalPartyLocation=Dinner1.generateDinner()

assigner = assignDinnerCourses(dinner, finalPartyLocation)
dinnerAssigned = assigner.assignDinnerCourses()

dinnerTime = datetime(2018, 07, 01, 20)
environment = state(data = dinnerAssigned, dinnerTime = dinnerTime, travelMode = 'simple')