当前位置: 首页>>代码示例>>Python>>正文


Python DomainBehavior.__init__方法代码示例

本文整理汇总了Python中DomainInterface.DomainBehavior.DomainBehavior.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python DomainBehavior.__init__方法的具体用法?Python DomainBehavior.__init__怎么用?Python DomainBehavior.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DomainInterface.DomainBehavior.DomainBehavior的用法示例。


在下文中一共展示了DomainBehavior.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from DomainInterface.DomainBehavior import DomainBehavior [as 别名]
# 或者: from DomainInterface.DomainBehavior.DomainBehavior import __init__ [as 别名]
    def __init__(self):
        ''' Constructor.
        '''
        DomainBehavior.__init__(self)

        self.state = {'status': 'IDLE', 'sigma': INFINITY}
        self.proc = 0
        self.x = {}
        self.y = {}
        self.pos = [-1] * 100

        ''' The object '''
        self.objectName = ClassName()
        # The states go below
        self.states = [
			State(name='off'),
			State(name='on')
		]

        # The transition go below
        self.transitions = [
			{'trigger': 'turnOn', 'source': 'off', 'dest': 'on'},
			{'trigger': 'turnOff', 'source': 'on', 'dest': 'off'}
		]

        # Initialize below
        machine = Machine(self.objectName, states=self.states, transitions=self.transitions, initial='off')
开发者ID:RaedsLab,项目名称:pyFSM-generator,代码行数:29,代码来源:test2.py

示例2: __init__

# 需要导入模块: from DomainInterface.DomainBehavior import DomainBehavior [as 别名]
# 或者: from DomainInterface.DomainBehavior.DomainBehavior import __init__ [as 别名]
	def __init__(self, 	bias = 1.0,
						N = 0.9,
						M = 0.1,
						activation_f = ("tanh","sigmoid"),
						k = 1.0,
						a = -0.2,
						b = 0.2,
						fileName = os.path.join(os.getcwd(),"weights_%d"%randint(1,100)),
						learning_flag = True):
		""" constructor.
			@param bias 				= the bias value of hidden layer.
			@param activation_function 	= the type of the activation function.
			@param k					= param. for sigmoide activation function only.
			@param a					= weight initialization range [a,b]
			@param b					= weight initialization range [a,b]
			@param fileName 			= weights file
			@param learning_flag		= model status \n if true model write its weights at the end of simulation into a file then it read weights file
		"""
		DomainBehavior.__init__(self)
		self.state = {'status':'Idle','sigma':INFINITY}
		#self.simData = SingeltonData()
		#self.simData.Set({})
		
		self.dataInit = {'N':N,'M':M,'bias':bias,'activation':activation_f[0]}
		self.k = k
		self.a = a
		self.b = b
		self.msgListOut = []
		self.msgListIn = {}
		self.sim = None
		self.fileName = fileName
		self.learning_flag = learning_flag
		self.layerId = self.myID
		
		seed(0)
开发者ID:capocchi,项目名称:DEVSimPy-lib-nn,代码行数:37,代码来源:Hidden.py

示例3: __init__

# 需要导入模块: from DomainInterface.DomainBehavior import DomainBehavior [as 别名]
# 或者: from DomainInterface.DomainBehavior.DomainBehavior import __init__ [as 别名]
	def __init__(self, K = [1,1]):
		"""	Constructor.

			@param K : list of weight
		"""

		DomainBehavior.__init__(self)

		# State variables
		self.state = {'status': 'IDLE', 'sigma': INFINITY}

		# Local copy
		self.K=map(float,map(eval,map(str,K)))			# matrix y=K[0]*x0+...+K[7]*x7 (QSS1 to3)

		n = len(self.K)
		try:
			from numpy import zeros

			self.Xs = zeros(n)
			self.Mxs = zeros(n)
			self.Pxs = zeros(n)

		except ImportError:

			self.Xs = [0.0]*n
			self.Mxs = [0.0]*n
			self.Pxs = [0.0]*n

		self.Y=[0.0]*3
开发者ID:capocchi,项目名称:DEVSimPy-lib-powersystem,代码行数:31,代码来源:WSum.py

示例4: __init__

# 需要导入模块: from DomainInterface.DomainBehavior import DomainBehavior [as 别名]
# 或者: from DomainInterface.DomainBehavior.DomainBehavior import __init__ [as 别名]
	def __init__(self, t0=.0, tr=.001, u=.5, m="QSS2", dq=.01):
		"""	Constructor.

			@param t0 :	initial time
			@param tr :	rise time
			@param u :	final value
			@param m :	QSS methode choise
			@param dq :	quantification level
		"""

		DomainBehavior.__init__(self)

		# State varaibles
		self.state = {	'status': 'ACTIVE', 'sigma': 0}

		# Local copy
		self.t0=t0		# initial time
		self.tr=tr		# rise time
		self.u=u		# final value
		self.m=m	# QSS methode choise
		self.dq=dq		# quantification level

		self.T = [0, self.t0, self.t0+self.tr, INFINITY]
		self.v = [0, 0, self.u, self.u]
		self.mv = [0]

		if (self.tr>0):
			self.mv.append(self.u/self.tr)
		self.mv.append(0)
		self.j = 0
开发者ID:capocchi,项目名称:DEVSimPy-lib-powersystem,代码行数:32,代码来源:RampGen.py

示例5: __init__

# 需要导入模块: from DomainInterface.DomainBehavior import DomainBehavior [as 别名]
# 或者: from DomainInterface.DomainBehavior.DomainBehavior import __init__ [as 别名]
	def __init__(self, tol=0.0001, y0=1.0, n=1):
		'''	Constructeur
		'''
		DomainBehavior.__init__(self)

		#  Declaration des variables d'état.
		self.state = {	'status': 'IDLE', 'sigma': INFINITY}
						
		self.Y = [0.0]*3
		
		#local copy
		self.n=n
		self.tol=tol
		self.y0=y0
		
		#self.mn	= 0
		self.u	= [0.0]*self.n 
		self.mu	= [0.0]*self.n 
		self.pu	= [00.]*self.n 
		
		#self.expr=str(pow(self.Y[0],3)+self.Y[0]+pow(self.u[0],2))
		
		self.nm=0.0

		#self.expr=compile(self.expr,"","eval")
		
		# message d'arriv� qui va �tre modifier pour etre renvoye
		self.msg = None
		self.p = 0
开发者ID:capocchi,项目名称:DEVSimPy-lib-powersystem,代码行数:31,代码来源:ImpFunction.py

示例6: __init__

# 需要导入模块: from DomainInterface.DomainBehavior import DomainBehavior [as 别名]
# 或者: from DomainInterface.DomainBehavior.DomainBehavior import __init__ [as 别名]
    def __init__(self, m=("QSS3", "QSS2", "QSS1"), dQ=0.01, x=0.0):
        """	Constructor.

			@param m : QSS methode choise
			@param dQ : quantification level
			@param x : initial value
		"""

        DomainBehavior.__init__(self)

        # State variables
        self.state = {"status": "IDLE", "sigma": 0.0}

        # local copy
        self.m = m[0]
        self.dQ = dQ
        self.x = x

        self.u = 0.0
        self.mu = 0.0
        self.mq = 0.0
        self.pq = 0.0
        self.pu = 0.0
        self.q = self.x

        # output message
        self.msg = None
开发者ID:capocchi,项目名称:DEVSimPy-lib-powersystem,代码行数:29,代码来源:Integrator.py

示例7: __init__

# 需要导入模块: from DomainInterface.DomainBehavior import DomainBehavior [as 别名]
# 或者: from DomainInterface.DomainBehavior.DomainBehavior import __init__ [as 别名]
	def __init__(self):
		''' Constructor.
		'''
		DomainBehavior.__init__(self)

		self.state = {	'status': 'IDLE', 'sigma':INFINITY}
		self.proc = 0
		self.x = {}
		self.y = {}
		self.pos = [-1]*100
		''' The object '''
		self.lump = Lamp()
		# The states
		self.states = [
    		State(name='on', on_enter=['say_im_turned_on']),
    		State(name='off', on_enter=['say_im_turned_off'])
			]

		self.transitions = [
			{'trigger': 'illuminate', 'source': 'off', 'dest': 'on'},
			{'trigger': 'darken', 'source': 'on', 'dest': 'off'}
		]
		
		# Initialize
		self.machine = Machine(self.lump, states=self.states, transitions=self.transitions, initial='off')
开发者ID:RaedsLab,项目名称:pfeContainer,代码行数:27,代码来源:MiddleSample.py

示例8: __init__

# 需要导入模块: from DomainInterface.DomainBehavior import DomainBehavior [as 别名]
# 或者: from DomainInterface.DomainBehavior.DomainBehavior import __init__ [as 别名]
	def __init__(self, arrivalMeanTime = 2.0, serviceMeanTime = 1.0):
		''' Constructor.
		'''
		DomainBehavior.__init__(self) 

		self.initPhase('IDLE',0)

		self.arrivalMeanTime = arrivalMeanTime
		self.serviceMeanTime = serviceMeanTime
		self.queueLength     = 0
		self.msg             = Message(None, None)

		print('Arrival Mean Time = ' + str(self.arrivalMeanTime))
		print('Service Mean Time = ' + str(self.serviceMeanTime))

		# Mean values
		self.nbTransitions   = 0
		self.nbIncrease      = 0
		self.queueLengthSum  = 0
		self.tauIncreaseSum  = 0
		self.tauDecreaseSum  = 0

		# Affichage loi de tau Increase 
		self.repTauInc       = []
		for i in range(int(TAU_MAX/TAU_RES)) :
			self.repTauInc.append(0);
开发者ID:CelineBateauKessler,项目名称:DEVSimPy,代码行数:28,代码来源:MM1.py

示例9: __init__

# 需要导入模块: from DomainInterface.DomainBehavior import DomainBehavior [as 别名]
# 或者: from DomainInterface.DomainBehavior.DomainBehavior import __init__ [as 别名]
	def __init__(self, spaceSize = 10):
		''' Constructor.
		'''
		DomainBehavior.__init__(self)

		self.spaceSize = spaceSize
		self.msg = Message(None, None)
		self.interceptLocation = (self.spaceSize*uniform(0,1), self.spaceSize*uniform(0,1))
		self.initPhase('Update', 1.0)
开发者ID:CelineBateauKessler,项目名称:DEVSimPy,代码行数:11,代码来源:Interceptor.py

示例10: __init__

# 需要导入模块: from DomainInterface.DomainBehavior import DomainBehavior [as 别名]
# 或者: from DomainInterface.DomainBehavior.DomainBehavior import __init__ [as 别名]
	def __init__(self, filename="image.jpg"):
		''' Constructor.
		'''
		DomainBehavior.__init__(self)

		### local copy
		self.fn = filename

		self.state = {	'status': 'IDLE', 'sigma':0}
开发者ID:CelineBateauKessler,项目名称:DEVSimPy,代码行数:11,代码来源:ImgGen.py

示例11: __init__

# 需要导入模块: from DomainInterface.DomainBehavior import DomainBehavior [as 别名]
# 或者: from DomainInterface.DomainBehavior.DomainBehavior import __init__ [as 别名]
	def __init__(self):
		''' Constructor.
		'''
		DomainBehavior.__init__(self)
		self.interactionQueue = None
		self.destinationToPort = {}
		self.msg = Message(None, None)
		self.initPhase('IDLE',0)
		self.count = 0
开发者ID:CelineBateauKessler,项目名称:DEVSimPy,代码行数:11,代码来源:Interaction.py

示例12: __init__

# 需要导入模块: from DomainInterface.DomainBehavior import DomainBehavior [as 别名]
# 或者: from DomainInterface.DomainBehavior.DomainBehavior import __init__ [as 别名]
	def __init__(self):
		""" constructor.
		"""

		DomainBehavior.__init__(self)
		self.state = {	'status': 'Idel', 'sigma':INFINITY}
		self.layerId = None
		self.outError = {}
		self.sim = None
		self.msgListOut = [Message([None,None,None],0.0),Message([None,None,None],0.0)]
开发者ID:capocchi,项目名称:DEVSimPy-lib-nn,代码行数:12,代码来源:DeltaOutput_Weight.py

示例13: __init__

# 需要导入模块: from DomainInterface.DomainBehavior import DomainBehavior [as 别名]
# 或者: from DomainInterface.DomainBehavior.DomainBehavior import __init__ [as 别名]
	def __init__(self, fn='test', token='', key='', username='', plotUrl='',
				sharing=['public', 'private', 'secret'],
				fileopt = ['new', 'overwrite', 'extend', 'append']):
		''' Constructor.

			fn (string) -- the name that will be associated with this figure
			fileopt ('new' | 'overwrite' | 'extend' | 'append') -- 'new' creates a
				'new': create a new, unique url for this plot
				'overwrite': overwrite the file associated with `filename` with this
				'extend': add additional numbers (data) to existing traces
				'append': add additional traces to existing data lists
			world_readable (default=True) -- make this figure private/public
			auto_open (default=True) -- Toggle browser options
				True: open this plot in a new browser tab
				False: do not open plot in the browser, but do return the unique url
			sharing ('public' | 'private' | 'sharing') -- Toggle who can view this graph
				- 'public': Anyone can view this graph. It will appear in your profile 
					and can appear in search engines. You do not need to be 
					logged in to Plotly to view this chart.
				- 'private': Only you can view this plot. It will not appear in the
					Plotly feed, your profile, or search engines. You must be
					logged in to Plotly to view this graph. You can privately
					share this graph with other Plotly users in your online
					Plotly account and they will need to be logged in to
					view this plot.
				- 'secret': Anyone with this secret link can view this chart. It will
					not appear in the Plotly feed, your profile, or search
					engines. If it is embedded inside a webpage or an IPython
					notebook, anybody who is viewing that page will be able to
					view the graph. You do not need to be logged in to view
					this plot.
		'''
		DomainBehavior.__init__(self)
		
		if token != '' and key != '' and username != '':
			py.sign_in(username, key)
			trace1 = Scatter(
				x=[],
				y=[],
				stream=dict(token=token)
			)
			data = Data([trace1])
			self.plotUrl = py.plot(data, filename=fn, auto_open=False, sharing=sharing[0], fileopt=fileopt[0])
			#print(self.plotUrl)
			self.s = py.Stream(token)
			self.s.open()
			# patch TIC
			self.sTime = time.time()
			self.sNbData = 0
			self.x = []
			self.y = []
		else:
			self.s = None

		self.state = {	'status': 'IDLE', 'sigma':INFINITY}
开发者ID:CelineBateauKessler,项目名称:DEVSimPy,代码行数:57,代码来源:PlotlyStream.py

示例14: __init__

# 需要导入模块: from DomainInterface.DomainBehavior import DomainBehavior [as 别名]
# 或者: from DomainInterface.DomainBehavior.DomainBehavior import __init__ [as 别名]
    def __init__(self, maxX=8, maxY=8, forbidden=['c18','c19','c20','c28','c36','c44','c52','c51','c50'], goal='c34'):
        ''' Constructor.
        '''
        DomainBehavior.__init__(self)

        # Grid 4x3 :
        #     0    1    2    3
        #   ---------------------
        # 0 |    |    |    | +1 |
        #   ---------------------
        # 1 |    |xxxx|    | -1 |
        #   ---------------------
        # 2 |    |    |    |    |
        #   ---------------------


        # Cell (0,3) gives reward +1
        # Cell (1,3) gives reward -1
        # Cell (1,1) cannot be entered

        # Actions : Go North/South/West/East
        # Action result : 80% OK, 20% on orthogonal sides
        # eg : Go North results in : 80% North, 10%East, 10%West
        # If the move is not possible, then the agent remains on the same cell

        self.maxX = maxX;
        self.maxY = maxY;

        # Forbidden cells
        self.cellIsForbidden = []
        for x in range(self.maxX):
            self.cellIsForbidden.append([])
            for y in range(self.maxY):
                self.cellIsForbidden[x].append(False)
        for c in forbidden :
            pos = self.stateToPosition(c)
            self.cellIsForbidden[pos[0]][pos[1]] = True

        # Visits Counter
        self.counter = []
        for x in range(self.maxX):
            self.counter.append([])
            for y in range(self.maxY):
                self.counter[x].append({'visit' : 0, 'start' : 0})

        # Terminal cells
        self.goal = goal

        # State
        self.currentPosition = None

        self.msgToAgent      = Message (None, None)

        self.initPhase('IDLE', INFINITY)
开发者ID:CelineBateauKessler,项目名称:DEVSimPy,代码行数:56,代码来源:Grid_Env_1Agent.py

示例15: __init__

# 需要导入模块: from DomainInterface.DomainBehavior import DomainBehavior [as 别名]
# 或者: from DomainInterface.DomainBehavior.DomainBehavior import __init__ [as 别名]
    def __init__(self, a=0, tm=1):
        """	Constructor.

			 @param a : Amplitude
			 @param tm : Modulating sinusoidal period
		"""

        DomainBehavior.__init__(self)

        # State variables
        self.state = {"status": "ACTIVE", "sigma": 0}

        # Local copy
        self.a = a
        self.tm = tm

        self.dt = [
            0.52576249002189,
            0.42770710237896,
            0.62266988694768,
            0.33235474394723,
            0.71465110292802,
            0.24345384677928,
            0.79816713494423,
            0.16448202528866,
            0.87006137717856,
            0.09849927665395,
            0.92767110593532,
            0.04803154181473,
            0.96890546649863,
            0.01498703066906,
            0.99229400455701,
            0.00060227626444,
            0.99701303051085,
            0.00541209560964,
            0.98289729495148,
            0.02923790417889,
            0.95044204882374,
            0.07119152689703,
            0.90079658391823,
            0.12969549084197,
            0.83574604807234,
            0.20252423831807,
            0.75767499017353,
            0.2868723108525,
            0.66950488056329,
            0.37945431748385,
            0.57459956378267,
            0.47663726221426,
        ]
        self.dt += [self.dt[31 - i] for i in range(0, 32)]
        self.dt = map(lambda x: 1.0 * x * self.tm / 32.0, self.dt)
        self.sig = 1
        self.j = -1
开发者ID:capocchi,项目名称:DEVSimPy-lib-powersystem,代码行数:56,代码来源:PWMGen.py


注:本文中的DomainInterface.DomainBehavior.DomainBehavior.__init__方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。