port python test examples to python3
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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__':
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user