def generateElements(csolverlb, csolver, slot_range, value_range):
elems = []
for slot in range(slot_range[0], slot_range[-1]+1):
- s1 = [ i for i in range(value_range[0],value_range[-1]+1)]
+ s1 = [ i for i in range(value_range[0],value_range[-1]+2)]
set1 = (c_long* len(s1))(*s1)
s1 = csolverlb.createSet(csolver, c_uint(11), set1, c_uint(len(s1)))
e1 = csolverlb.getElementVar(csolver,s1)
-# csolverlb.mustHaveValue(csolver, e1)
+ csolverlb.mustHaveValue(csolver, e1)
elems.append(e1)
return elems
replaceWithElemConst(csolverlb, csolver, elems, m, n)
for m in board_input.blocked_positions:
- csolverlb.addConstraint(csolver, (-Occupied(m)).getConstraint() )
+ csolverlb.addConstraint(csolver, (-Occupied( m)).getConstraint() )
print 'Creating tile placement rules...'
rules =[]
print '=== Done! Calling CSolver solver now ==='
if len(sys.argv) > 2 and sys.argv[-1] == "--dump":
- csolverlb.serialize(csolver)
+ csolverlb.serialize(csolver)
+# csolverlb.printConstraints(csolver)
if csolverlb.solve(csolver) != 1:
print '*** Got UNSAT result! ***'
sys.exit(1)