improve examples
This commit is contained in:
@@ -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):
|
||||
|
||||
@@ -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----------------
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user