Пример #1
0
for k in range(0, numNodes):
    if nodeTypes[k] == 0 or nodeTypes[k] == 'legacy':
        t = legacyNode(numChans, numSteps,
                       legacyChanList[CountLegacyChanIndex])
        CountLegacyChanIndex += 1
    elif nodeTypes[k] == 1 or nodeTypes[k] == 'hopping':
        t = hoppingNode(numChans, numSteps,
                        hoppingChanList[CountHoppingChanIndex], hopRate,
                        offSet[CountHoppingChanIndex])
        CountHoppingChanIndex += 1
    elif nodeTypes[k] == 2 or nodeTypes[k] == 'im':
        t = imNode(numChans, numSteps, imPeriod, imDutyCircleList[CountIm],
                   imChanList[CountIm])
        CountIm += 1
    elif nodeTypes[k] == 3 or nodeTypes[k] == 'dsa':
        t = dsaNode(numChans, numSteps)
    elif nodeTypes[k] == 4 or nodeTypes[k] == 'possion':
        t = poissonNode(numChans, numSteps, poissonChanList, arrivalInterval,
                        serviceInterval)
    elif nodeTypes[k] == 5 or nodeTypes[k] == 'markovChain':
        t = markovChainNode(numChans, numSteps, mcChanList, alpha, beta)
    elif nodeTypes[k] == 10 or nodeTypes[k] == 'mdp':
        t = mdpNode(numChans, states, numSteps, 'VI')
    elif (nodeTypes[k] >= 11 and nodeTypes[k] <= 16)  \
         or (nodeTypes[k] >= 30 and nodeTypes[k] <= 33)  \
                    or nodeTypes[k] == 'dqn'          or nodeTypes[k] == 'dqnDouble' \
                    or nodeTypes[k] == 'dqnPriReplay' or nodeTypes[k] == 'dqnDuel'   \
                    or nodeTypes[k] == 'dqnRef'       or nodeTypes[k] == 'dpg'       \
                    or nodeTypes[k] == 'dqnPo'        or nodeTypes[k] == 'dqnPad'    \
                    or nodeTypes[k] == 'dqnStack':
        #            or nodeTypes[k] in ['dqn', 'dqnDouble', 'dqnPriReplay', 'dqnDuel', 'dqnRef', \
''' ===================================================================  '''
'''          Construct different Type of Nodes                                '''
''' ===================================================================  '''

for k in range(0,numNodes):
    if   nodeTypes[k] == 0 or nodeTypes[k] == 'legacy':
        t = legacyNode(numChans,numSteps, txProbability[CountLegacyChanIndex], legacyChanList[CountLegacyChanIndex]) 
        CountLegacyChanIndex += 1               
    elif nodeTypes[k] == 1  or nodeTypes[k] == 'hopping':
        t = hoppingNode(numChans,numSteps,hoppingChanList[CountHoppingChanIndex],hopRate)
        CountHoppingChanIndex += 1
    elif nodeTypes[k] == 2 or nodeTypes[k] == 'im':
        t = imNode(numChans,numSteps,imPeriod, imDutyCircleList[CountIm], imChanList[CountIm])
        CountIm += 1
    elif nodeTypes[k] == 3  or nodeTypes[k] == 'dsa':
        t = dsaNode(numChans,numSteps,txProbability)    
    elif nodeTypes[k] == 4  or nodeTypes[k] == 'possion':
        t = poissonNode( numChans, numSteps, poissonChanList, arrivalRate, serviceRate)
    elif nodeTypes[k] == 5  or nodeTypes[k] == 'markovChain':
        t = markovChainNode( numChans, numSteps, mcChanList, alpha, beta)
    elif nodeTypes[k] == 10:
        t = mdpNode(numChans,states,numSteps,'PI')   
    elif (nodeTypes[k] >= 11 and nodeTypes[k] <= 16)  \
         or (nodeTypes[k] >= 30 and nodeTypes[k] <= 33)  \
                    or nodeTypes[k] == 'dqn'          or nodeTypes[k] == 'dqnDouble' \
                    or nodeTypes[k] == 'dqnPriReplay' or nodeTypes[k] == 'dqnDuel'   \
                    or nodeTypes[k] == 'dqnRef'       or nodeTypes[k] == 'dpg'       \
                    or nodeTypes[k] == 'dqnPo'        or nodeTypes[k] == 'dqnPad'    \
                    or nodeTypes[k] == 'dqnStack':
                    
        t = dqnNode(numChans,states,numSteps, nodeTypes[k])