Skip to content

Commit 5c355cd

Browse files
committed
remove dependency on read_demand for load_column
- ColumnVec is set up in load_columns() rather than read_demand().
1 parent e0b13bb commit 5c355cd

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

path4gmns/utils.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,7 @@ def load_columns(ui, input_dir='.'):
975975
print('read agent.csv')
976976

977977
A = ui._base_assignment
978+
cp = A.get_column_pool()
978979

979980
reader = csv.DictReader(f)
980981

@@ -1058,8 +1059,8 @@ def load_columns(ui, input_dir='.'):
10581059
# it could be empty
10591060
geo = line['geometry']
10601061

1061-
if (at, dp, oz_id, dz_id) not in A.get_column_pool().keys():
1062-
continue
1062+
if (at, dp, oz_id, dz_id) not in cp.keys():
1063+
cp[(at, dp, oz_id, dz_id)] = ColumnVec()
10631064

10641065
cv = A.get_column_vec(at, dp, oz_id, dz_id)
10651066
path_id = cv.get_column_num()
@@ -1113,6 +1114,7 @@ def load_columns(ui, input_dir='.'):
11131114
if not existing:
11141115
col.set_distance(dist)
11151116
cv.add_new_column(col)
1117+
cv.increase_volume(vol)
11161118

11171119
update_links_using_columns(ui)
11181120

tests/demo.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def test_column_generation_dtalite():
100100

101101

102102
def test_loading_columns():
103-
network = pg.read_network(load_demand=True)
103+
network = pg.read_network()
104104

105105
print('\nstart loading columns\n')
106106
st = time()
@@ -281,4 +281,4 @@ def demo_mode(mode):
281281

282282
if __name__=="__main__":
283283

284-
demo_mode(3)
284+
demo_mode(5)

0 commit comments

Comments
 (0)