diff --git a/examples/python/hidato_table.py b/examples/python/hidato_table.py index 6a936ba9f6..52405e43e6 100644 --- a/examples/python/hidato_table.py +++ b/examples/python/hidato_table.py @@ -42,18 +42,11 @@ def BuildPairs(rows, cols): rows: the number of rows in the grid cols: the number of columns in the grid """ - results = [] - for x in range(rows): - for y in range(cols): - for dx in (-1, 0, 1): - for dy in (-1, 0, 1): - if (x + dx >= 0 and - x + dx < rows and - y + dy >= 0 and - y + dy < cols and - (dx != 0 or dy != 0)): - results.append((x * cols + y, (x + dx) * cols + (y + dy))) - return results + return [(x * cols + y, (x + dx) * cols + (y + dy)) + for x in range(rows) for y in range(cols) + for dx in (-1, 0, 1) for dy in (-1, 0, 1) + if (x + dx >= 0 and x + dx < rows and + y + dy >= 0 and y + dy < cols and (dx != 0 or dy != 0))] def main(unused_argv): diff --git a/examples/python/steel.py b/examples/python/steel.py index 8fea75688b..a7a048866c 100644 --- a/examples/python/steel.py +++ b/examples/python/steel.py @@ -18,7 +18,7 @@ from constraint_solver import pywrapcp FLAGS = gflags.FLAGS -gflags.DEFINE_string('data', 'python/data/steel_mill/steel_mill_slab.txt', +gflags.DEFINE_string('data', 'data/steel_mill/steel_mill_slab.txt', 'path to data file') #----------------helper for binpacking posting---------------- diff --git a/examples/python/steel_lns.py b/examples/python/steel_lns.py index acd1e88ca7..421a31f569 100644 --- a/examples/python/steel_lns.py +++ b/examples/python/steel_lns.py @@ -20,7 +20,7 @@ import random FLAGS = gflags.FLAGS gflags.DEFINE_string('data', - 'python/data/steel_mill/steel_mill_slab.txt', + 'data/steel_mill/steel_mill_slab.txt', 'path to data file') gflags.DEFINE_integer('lns_fragment_size', 10, @@ -150,6 +150,9 @@ class SteelLns(object): self.__random = rand self.__size = size + def InitFragments(self): + pass + def NextFragment(self, fragment, values): counter = 0 while counter < self.__size: