port python test examples to python3

This commit is contained in:
laurent.perron@gmail.com
2013-12-29 14:12:37 +00:00
parent d8590b2dc2
commit 96dfdf04fb
3 changed files with 6 additions and 6 deletions

View File

@@ -168,10 +168,10 @@ def Solve(model):
solver.EndSearch()
print('num_solutions:', num_solutions)
print('failures:', solver.Failures())
print('branches:', solver.Branches())
print('wall time:', solver.WallTime())
print('num_solutions: %i' % num_solutions)
print('failures: %i' % solver.Failures())
print('branches: %i' % solver.Branches())
print('wall time:%i' % solver.WallTime())
def PrintOneSolution(positions, rows, cols, num_solution):

View File

@@ -46,7 +46,7 @@ def main(unused_argv):
solver.Init(profits, weights, capacities)
computed_profit = solver.Solve()
print('optimal profit = ' + str(computed_profit) + '/' + str(optimal_profit))
print('optimal profit = %i/%i' % (computed_profit, optimal_profit))
if __name__ == '__main__':

View File

@@ -107,7 +107,7 @@ def main(_):
from_node = rand.randrange(FLAGS.tsp_size - 1)
to_node = rand.randrange(FLAGS.tsp_size - 1) + 1
if routing.NextVar(from_node).Contains(to_node):
print('Forbidding connection ' + str(from_node) + ' -> ' + str(to_node))
print('Forbidding connection %i -> %i' % (from_node, to_node))
routing.NextVar(from_node).RemoveValue(to_node)
forbidden_connections += 1