Exemple #1
0
    print "         Problem type: \033[1;33m", args.type, "\033[0m"
    print ""

###
### Read input file
###

ifile = args.input
rules = []
agents = set()

n = 1
for line in ifile:
    li=line.strip()
    if not li.startswith("#") and li != '':
        r = MCNetsRule.fromString(li)
        r.no = n
        n = n + 1
        agents |= r.P
        agents |= r.N
        for a in r.V:
            agents.add(a)

        rules.append(r)

if not args.quiet:
    print "Read %d rules with %d agents." % (len(rules), len(agents))

###
### Generate constraints
###
Exemple #2
0
###
### Rule list generation
###

rules = []

for a in range(args.rules):

    if args.format == 'mcn':
        if args.method == 'trinomial':
            probP = args.params[0]
            probN = args.params[1]
            maxUtility = args.agents
            
            r = MCNetsRule.getRandomRuleTrinomialDistribution(args.agents, probP, probN)
        elif args.method == 'decay':
            decay_alpha = args.params[0]
            decay_p = args.params[1]
    
            r = MCNetsRule.getRandomRuleDecayDistribution(args.agents, decay_alpha, decay_p)
        else:
            pass

    if args.format == 'mtzdd':
        if args.method == 'decay':
            decay_alpha = args.params[0]
            decay_p = args.params[1]
            if args.output.name == '<stdout>':
                os.system('./bdd.py --agents ' + str(args.agents) + ' --alpha ' + str(decay_alpha) + ' --seed ' + str(args.seed))
            else:
Exemple #3
0
###
### Rule list generation
###

rules = []

for a in range(args.rules):

    if args.format == 'mcn':
        if args.method == 'trinomial':
            probP = args.params[0]
            probN = args.params[1]
            maxUtility = args.agents

            r = MCNetsRule.getRandomRuleTrinomialDistribution(
                args.agents, probP, probN)
        elif args.method == 'decay':
            decay_alpha = args.params[0]
            decay_p = args.params[1]

            r = MCNetsRule.getRandomRuleDecayDistribution(
                args.agents, decay_alpha, decay_p)
        else:
            pass

    if args.format == 'mtzdd':
        if args.method == 'decay':
            decay_alpha = args.params[0]
            decay_p = args.params[1]
            if args.output.name == '<stdout>':
                os.system('./bdd.py --agents ' + str(args.agents) +