当前位置: 首页>>代码示例>>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;未经允许,请勿转载。