本文整理汇总了Python中cnfformula.cmdline.SimpleGraphHelper类的典型用法代码示例。如果您正苦于以下问题:Python SimpleGraphHelper类的具体用法?Python SimpleGraphHelper怎么用?Python SimpleGraphHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了SimpleGraphHelper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: setup_command_line
def setup_command_line(parser):
"""Setup the command line options for Perfect Matching Principle formula
Arguments:
- `parser`: parser to load with options.
"""
SimpleGraphHelper.setup_command_line(parser)
示例2: setup_command_line
def setup_command_line(parser):
"""Setup the command line options for graph automorphism formula
Arguments:
- `parser`: parser to load with options.
"""
SimpleGraphHelper.setup_command_line(parser)
示例3: setup_command_line
def setup_command_line(parser):
"""Setup the command line options for k-clique formula
Arguments:
- `parser`: parser to load with options.
"""
parser.add_argument('k',metavar='<k>',type=int,action='store',help="size of the clique to be found")
SimpleGraphHelper.setup_command_line(parser)
示例4: setup_command_line
def setup_command_line(parser):
"""Setup the command line options for k-color formula
Arguments:
- `parser`: parser to load with options.
"""
parser.add_argument('k',metavar='<k>',type=int,action='store',help="number of available colors")
SimpleGraphHelper.setup_command_line(parser)
示例5: build_cnf
def build_cnf(args):
"""Build a graph automorphism formula according to the arguments
Arguments:
- `args`: command line options
"""
G1 = SimpleGraphHelper.obtain_graph(args,suffix="1")
G2 = SimpleGraphHelper.obtain_graph(args,suffix="2")
return GraphIsomorphism(G1,G2)
示例6: setup_command_line
def setup_command_line(parser):
"""Setup the command line options for dominating set formula
Arguments:
- `parser`: parser to load with options.
"""
parser.add_argument('d',metavar='<d>',type=int,action='store',help="size of the dominating set")
parser.add_argument('--alternative','-a',action='store_true',default=False,help="produce the provably hard version")
SimpleGraphHelper.setup_command_line(parser)
示例7: setup_command_line
def setup_command_line(parser):
"""Setup the command line options for dominating set formula
Arguments:
- `parser`: parser to load with options.
"""
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--d',metavar='<d>',type=int,action='store',help="size of the cover")
group.add_argument('--rational',action='store_true',help="Set size to V/2")
group.add_argument('--no-rational',action='store_true',help="Set size to V/2-1")
SimpleGraphHelper.setup_command_line(parser)
示例8: setup_command_line
def setup_command_line(parser):
"""Setup the command line options for dominating set formula
Arguments:
- `parser`: parser to load with options.
"""
group = parser.add_mutually_exclusive_group(required=True)
group.add_argument('--d',metavar='<d>',type=int,action='store',help="size of the dominating set")
group.add_argument('--regular',action='store_true',help="Set size to V/(deg+1)")
group.add_argument('--tiling',action='store_true',help="Add tiling constraints")
parser.add_argument('--seed',action='store_true',help="Set some vertex to true")
SimpleGraphHelper.setup_command_line(parser)
示例9: setup_command_line
def setup_command_line(parser):
"""Setup the command line options for Tseitin formula
Arguments:
- `parser`: parser to load with options.
"""
parser.add_argument('--charge',metavar='<charge>',default='first',
choices=['first','random','randomodd','randomeven'],
help="""charge on the vertices.
`first' puts odd charge on first vertex;
`random' puts a random charge on vertices;
`randomodd' puts random odd charge on vertices;
`randomeven' puts random even charge on vertices.
""")
SimpleGraphHelper.setup_command_line(parser)
示例10: setup_command_line
def setup_command_line(parser):
"""Setup the command line options for Graph ordering principle formula
Arguments:
- `parser`: parser to load with options.
"""
g=parser.add_mutually_exclusive_group()
g.add_argument('--total','-t',default=False,action='store_true',help="assume a total order")
g.add_argument('--smart','-s',default=False,action='store_true',help="encode 'x<y' and 'x>y' in a single variable (implies totality)")
g.add_argument('--knuth2', action='store_const', dest='knuth',const=2,
help="transitivity axioms: \"(i<j)(j<k)->(i,k)\" only for j>i,k")
g.add_argument('--knuth3', action='store_const', dest='knuth',const=3,
help="transitivity axioms: \"(i<j)(j<k)->(i,k)\" only for k>i,j")
parser.add_argument('--plant','-p',default=False,action='store_true',help="allow a minimum element")
SimpleGraphHelper.setup_command_line(parser)
示例11: build_cnf
def build_cnf(args):
"""Build Tseitin formula according to the arguments
Arguments:
- `args`: command line options
"""
G = SimpleGraphHelper.obtain_graph(args)
if G.order()<1:
charge=None
elif args.charge=='first':
charge=[1]+[0]*(G.order()-1)
else: # random vector
charge=[random.randint(0,1) for _ in xrange(G.order()-1)]
parity=sum(charge) % 2
if args.charge=='random':
charge.append(random.randint(0,1))
elif args.charge=='randomodd':
charge.append(1-parity)
elif args.charge=='randomeven':
charge.append(parity)
else:
raise ValueError('Illegal charge specification on command line')
return TseitinFormula(G,charge)
示例12: build_cnf
def build_cnf(args):
"""Build a k-colorability formula according to the arguments
Arguments:
- `args`: command line options
"""
G = SimpleGraphHelper.obtain_graph(args)
return GraphColoringFormula(G,range(1,args.k+1))
示例13: build_cnf
def build_cnf(args):
"""Build the k-dominating set formula
Arguments:
- `args`: command line options
"""
G = SimpleGraphHelper.obtain_graph(args)
return DominatingSet(G, args.d, alternative = args.alternative )
示例14: build_cnf
def build_cnf(args):
"""Build a k-clique formula according to the arguments
Arguments:
- `args`: command line options
"""
G = SimpleGraphHelper.obtain_graph(args)
return CliqueFormula(G,args.k)
示例15: build_cnf
def build_cnf(args):
"""Build a Graph ordering principle formula according to the arguments
Arguments:
- `args`: command line options
"""
G= SimpleGraphHelper.obtain_graph(args)
return GraphOrderingPrinciple(G,args.total,args.smart,args.plant,args.knuth)