當前位置: 首頁>>代碼示例>>Python>>正文


Python Agent.__init__方法代碼示例

本文整理匯總了Python中Agent.Agent.__init__方法的典型用法代碼示例。如果您正苦於以下問題:Python Agent.__init__方法的具體用法?Python Agent.__init__怎麽用?Python Agent.__init__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Agent.Agent的用法示例。


在下文中一共展示了Agent.__init__方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from Agent import Agent [as 別名]
# 或者: from Agent.Agent import __init__ [as 別名]
    def __init__(self,errGrowth,unnormalizeDirtRate,unnormalizeDirtSize,accuracy,N) :
        Agent.__init__(self,Router.PLANNER)
	
        # define the
        #     variance growth parameter,
        #     average dirt fall,
        #     handle to sensor,
        #     handle to array of vacuums)
        self.setNumber(N)
        self.vacuumRange = 3
        self.setAccuracy(accuracy)

        # Initialize the matrices.
        self.worldview = zeros((N,N),dtype=float64);
        self.dirtLevels = []
        self.wetview = zeros((N,N),dtype=float64);
        self.viewPrecision = zeros((N,N),dtype=float64);

        self.unnormalizeDirtRate = unnormalizeDirtRate
	self.unnormalizeDirtSize = unnormalizeDirtSize
        self.errGrowth = errGrowth
	self.normalizeDirtRate()


        self.vacuumlocation = []
        
        #create distance matrix
        self.defineDistanceArray()
        self.wDist=0;               # default
開發者ID:cu-madc,項目名稱:vacuum,代碼行數:31,代碼來源:Planner.py

示例2: __init__

# 需要導入模塊: from Agent import Agent [as 別名]
# 或者: from Agent.Agent import __init__ [as 別名]
    def __init__( self, refm, disc_rate, init_Q, Lambda, alpha, epsilon, gamma=0 ):

        Agent.__init__( self, refm, disc_rate )

        self.num_states  = refm.getNumObs() # assuming that states = observations
        self.obs_symbols = refm.getNumObsSyms()
        self.obs_cells   = refm.getNumObsCells()
        
        self.init_Q  = init_Q
        self.Lambda  = Lambda
        self.epsilon = epsilon
        self.alpha   = alpha

        # if the internal discount rate isn't set, use the environment value
        if gamma == 0:
            self.gamma = disc_rate
        else:
            self.gamma = gamma

        if self.gamma >= 1.0:
            print "Error: Q learning can only handle an internal discount rate ", \
                  "that is below 1.0"
            sys.exit()
            
        self.reset()
開發者ID:benkant,項目名稱:AIQ,代碼行數:27,代碼來源:Q_l.py

示例3: __init__

# 需要導入模塊: from Agent import Agent [as 別名]
# 或者: from Agent.Agent import __init__ [as 別名]
    def __init__(self, refm, disc_rate, sims, depth, horizon, epsilon=0.05, threads=1, memory=32):

        Agent.__init__(self, refm, disc_rate)

        if epsilon > 1.0:
            epsilon = 1.0
        if epsilon < 0.0:
            epsilon = 0.0

        self.refm = refm
        self.sims = int(sims)
        self.depth = int(depth)
        self.horizon = int(horizon)
        self.memory = int(memory)
        self.epsilon = epsilon
        self.threads = int(threads)

        self.obs_cells = refm.getNumObsCells()
        self.obs_symbols = refm.getNumObsSyms()

        self.obs_bits = int(ceil(log(refm.getNumObs(), 2.0)))
        self.reward_bits = int(ceil(log(refm.getNumRewards(), 2.0)))
        self.num_actions = refm.getNumActions()

        print "obs_bits = ", self.obs_bits
        print "reward_bits = ", self.reward_bits

        self.agent = None

        self.reset()
開發者ID:erensezener,項目名稱:AIQ,代碼行數:32,代碼來源:MC_AIXI.py

示例4: __init__

# 需要導入模塊: from Agent import Agent [as 別名]
# 或者: from Agent.Agent import __init__ [as 別名]
    def __init__(self, name=None):
        if name is None:
            name = "builder"
            
        Agent.__init__(self, name, "build")
        ProjectInspector.__init__(self)

        return
開發者ID:bmi-forum,項目名稱:bmi-pyre,代碼行數:10,代碼來源:Builder.py

示例5: __init__

# 需要導入模塊: from Agent import Agent [as 別名]
# 或者: from Agent.Agent import __init__ [as 別名]
    def __init__(self,accuracy=0.0) :
	Agent.__init__(self,Router.SENSORARRAY)
        # constructor (accuracy of measurement)
        self.accuracy=accuracy-float(int(accuracy))  #force to be within constraints

        self.N = 5
        self.array = zeros((self.N,self.N),dtype=float64) # array of values for dirt levels
        self.Wet = zeros((self.N,self.N),dtype=float64)   # array of values for dirt levels
開發者ID:cu-madc,項目名稱:vacuum,代碼行數:10,代碼來源:SensorArray.py

示例6: __init__

# 需要導入模塊: from Agent import Agent [as 別名]
# 或者: from Agent.Agent import __init__ [as 別名]
 def __init__(self, gamma, filename):
     Agent.__init__(self)
     self._fileName = filename + "startingCountry.pickle"
     self.gamma = gamma
     self.load()
     self.lastState = None
     self.lastAction = None
     self.stateActionList = []
開發者ID:RaphaelLapierre,項目名稱:INF4215,代碼行數:10,代碼來源:ChooseStartingCountryAgent.py

示例7: __init__

# 需要導入模塊: from Agent import Agent [as 別名]
# 或者: from Agent.Agent import __init__ [as 別名]
 def __init__(self, gamma, filename):
     Agent.__init__(self)
     self._fileName = filename + "fortify.pickle"
     self.load()
     self.gamma = gamma
     self.lastState = None
     self.lastAction = None
     self.lastScore = 0
開發者ID:RaphaelLapierre,項目名稱:INF4215,代碼行數:10,代碼來源:FortifyingAgent.py

示例8: __init__

# 需要導入模塊: from Agent import Agent [as 別名]
# 或者: from Agent.Agent import __init__ [as 別名]
    def __init__( self, refm, disc_rate ):
        Agent.__init__( self, refm, disc_rate )

        if self.num_actions > 10:
            print "Error: Manual agent only handles 10 or less actions!"
            sys.exit()

        self.mode = MANUAL
        self.last_val = 0
開發者ID:benkant,項目名稱:AIQ,代碼行數:11,代碼來源:Manual.py

示例9: __init__

# 需要導入模塊: from Agent import Agent [as 別名]
# 或者: from Agent.Agent import __init__ [as 別名]
 def __init__(self, gamma, filename):
     Agent.__init__(self)
     self._fileName = filename + "placeTroops.pickle"
     self.load()
     self.gamma = gamma
     self.lastState = None
     self.lastAction = None
     self.lastScore = 0
     self.stateActionList = []
開發者ID:RaphaelLapierre,項目名稱:INF4215,代碼行數:11,代碼來源:PlaceTroopsAgent.py

示例10: __init__

# 需要導入模塊: from Agent import Agent [as 別名]
# 或者: from Agent.Agent import __init__ [as 別名]
    def __init__( self, refm, disc_rate, epsilon ):

        Agent.__init__( self, refm, disc_rate )
        
        self.obs_symbols = refm.getNumObsSyms()
        self.obs_cells   = refm.getNumObsCells()

        self.epsilon = epsilon
        
        self.reset()
開發者ID:benkant,項目名稱:AIQ,代碼行數:12,代碼來源:Freq.py

示例11: __init__

# 需要導入模塊: from Agent import Agent [as 別名]
# 或者: from Agent.Agent import __init__ [as 別名]
    def __init__(self,r=1.0,s=1.0,v=1.0,cloudsize=1.0) :
	Agent.__init__(self,Router.WORLD)
        self.time = 0
    
        self.N=5                   # %size of grid
        self.expenditure = 0.0     # cummulative funds expended since last reset
        self.numberVacuums = 0     # No vacuums assigned yet.
	self.vacuumArray = []      # array of object handles
        self.intializeVariables(r,s,v,cloudsize)

	self.setSensor(None)
	self.setPlanner(None)
開發者ID:cu-madc,項目名稱:vacuum,代碼行數:14,代碼來源:World.py

示例12: __init__

# 需要導入模塊: from Agent import Agent [as 別名]
# 或者: from Agent.Agent import __init__ [as 別名]
 def __init__(self, x, y):
     """
     Allocation d'un agent requin.
     @param x: position en x
     @param y: position en y
     @param pasX: le déplacement en x
     @param pasY: le déplacement en y
     """
     Agent.__init__(self,x,y,0,0)
     self.color = 'red'
     self.age = 0
     self.HUNGER_CYCLE = 6
     self.hunger = choice(range(int(self.HUNGER_CYCLE/2.0)))
     self.PERIOD = 10
開發者ID:agoryu,項目名稱:SCI,代碼行數:16,代碼來源:Shark.py

示例13: __init__

# 需要導入模塊: from Agent import Agent [as 別名]
# 或者: from Agent.Agent import __init__ [as 別名]
    def __init__(self, name=None, project=None, mode=None):
        if name is None:
            name = "janitor"

        if mode is None:
            mode = 'clean'
        self.mode = mode

        self.project = project
            
        Agent.__init__(self, name, "janitor")
        ProjectInspector.__init__(self)

        return
開發者ID:bmi-forum,項目名稱:bmi-pyre,代碼行數:16,代碼來源:Janitor.py

示例14: __init__

# 需要導入模塊: from Agent import Agent [as 別名]
# 或者: from Agent.Agent import __init__ [as 別名]
 def __init__(self, aMessageProcessorFunction, aAgentCount):
 
     Agent.__init__(self)
     
     self.agents = []
     
     self.processedCount = 0
     self.receivedCount = 0
     self.exitOnDone = False
     self.messageDataQueue = []
     self.agentIdentifierQueue = []
     
     for index in range(0, aAgentCount):
     
         agent= WorkerBee(aMessageProcessorFunction)
         self.agents = self.agents + [agent]
         self.agentIdentifierQueue += [agent.identifier]
開發者ID:AssertTrue,項目名稱:agent,代碼行數:19,代碼來源:AgentFarm.py

示例15: __init__

# 需要導入模塊: from Agent import Agent [as 別名]
# 或者: from Agent.Agent import __init__ [as 別名]
    def __init__(self,IDnum,currentTime=0.0,channel=None) : #class constructor
	Agent.__init__(self,Router.VACUUM)
	
        self.xPos   = 0
        self.yPos   = 0
        self.setStatus(3)                     # 1 - moving, 2-cleaning, 3-waiting, 4-repairing
        self.initializeTime(currentTime)      # time it will be done with current operation
        self.setID(IDnum)
        self.range = 3                        # maximum distance that can be travelled 
        self.moveQueue  = []

        self.setChannel(channel)              #channel to commander
        self.timeToClean=8;
        self.timeToRepair=32;
        self.odometer=0;                      # tracks distance travelled
        self.missions=0;                      #number of cells than have been cleaned
        self.moveCost=1;                      #cost to move
        self.repairCost=30;                   # cost to conduct repair
        self.repairs=0;                       # number of repairs - running total
        
        self.time = 0;

        self.Moisture = None
開發者ID:cu-madc,項目名稱:vacuum,代碼行數:25,代碼來源:Vacuum.py


注:本文中的Agent.Agent.__init__方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。