Skip to content

Commit

Permalink
add sample data
Browse files Browse the repository at this point in the history
  • Loading branch information
sabotack committed May 27, 2024
1 parent 96296cb commit 678832c
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 8 deletions.
3 changes: 1 addition & 2 deletions nfopt/utils/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ def readLinks():

logger.info("Reading links...")
dataCapacity = pd.read_csv(
f"{DATASET_PATH}/{DATASET_LINKS_NAME}.csv.gz",
compression="gzip",
f"{DATASET_PATH}/{DATASET_LINKS_NAME}.csv",
names=["linkStart", "linkEnd", "capacity"],
skiprows=1,
engine="pyarrow",
Expand Down
5 changes: 5 additions & 0 deletions sample-data/flow-path-day1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Mon 00:00:00,A,G,[A;B;D;G]
Mon 00:00:00,A,G,[A;B;E;G]
Mon 00:00:00,A,G,[A;C;F;G]
Mon 00:00:00,X,G,[X;C;F;G]
Mon 00:00:00,X,G,[X;Y;F;G]
2 changes: 2 additions & 0 deletions sample-data/flow-traffic-day1.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Mon 00:00:00,A,G,50.00
Mon 00:00:00,X,G,75.00
12 changes: 12 additions & 0 deletions sample-data/links.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
linkStart,linkEnd,capacity
A,B,100
A,C,100
B,D,100
B,E,100
C,F,100
D,G,100
E,G,100
F,G,100
X,C,100
X,Y,100
Y,F,100
5 changes: 1 addition & 4 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,7 @@ def runLinearOptimizationModel(
}


with gp.Env(params=options) as env, gp.Model(env=env) as m:
# Create optimization model based on the input model
m = gp.Model("network_optimization", env=env)

with gp.Env(params=options) as env, gp.Model("network_optimization", env=env) as m:
# Decision variables for path ratios for each source-destination pair
path_ratios = m.addVars(
[
Expand Down
3 changes: 1 addition & 2 deletions test2.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ def build_graph(edges):


def optMC(parserArgs, links, flowTraffic, flows, timestamp):
with gp.Env(params=options) as env, gp.Model(env=env) as m:
m = gp.Model("netflow", env=env)
with gp.Env(params=options) as env, gp.Model("netflow", env=env) as m:
# example of link data
links = {
"A;B": {"capacity": 100},
Expand Down

0 comments on commit 678832c

Please sign in to comment.