Skip to content

Commit

Permalink
[docs] add links to the various data files in tutorials
Browse files Browse the repository at this point in the history
  • Loading branch information
odow committed Sep 18, 2023
1 parent 68f1cd0 commit 7e20e59
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@
# Before we get started, we need this constant to point to where the data files
# are.

const DATA_DIR = joinpath(@__DIR__, "data")
import JuMP
const DATA_DIR = joinpath(
dirname(pathof(JuMP)),
joinpath("..", "docs", "src", "tutorials", "getting_started", "data"),
);

# ## Where to get help

Expand Down
17 changes: 8 additions & 9 deletions docs/src/tutorials/linear/factory_schedule.jl
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,14 @@ import Test #src
# production and cost levels for each month. For the documentation, the file is
# located at:

factories_filename = joinpath(@__DIR__, "factory_schedule_factories.txt")
factories_filename = joinpath(@__DIR__, "factory_schedule_factories.txt");

# and it has the following contents:
# To run locally, download [`factory_schedule_factories.txt`](factory_schedule_factories.txt)
# and update `factories_filename` appropriately.

print(read(factories_filename, String))
# The file has the following contents:

# You can reproduce this tutorial locally by saving the contents to a new file
# and updating `factories_filename` appropriately.
print(read(factories_filename, String))

# We use the `CSV` and `DataFrames` packages to read it into Julia:

Expand All @@ -106,11 +106,10 @@ factory_df = CSV.read(

# The second file contains the demand data by month:

demand_filename = joinpath(@__DIR__, "factory_schedule_demand.txt")
demand_filename = joinpath(@__DIR__, "factory_schedule_demand.txt");

print(read(demand_filename, String))

#-
# To run locally, download [`factory_schedule_demand.txt`](factory_schedule_demand.txt)
# and update `demand_filename` appropriately.

demand_df = CSV.read(
demand_filename,
Expand Down
11 changes: 9 additions & 2 deletions docs/src/tutorials/linear/multi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,16 @@ const DBInterface = SQLite.DBInterface
# ## Data

# For the purpose of this tutorial, the JuMP repository contains an example
# database called `multi.sqlite`:
# database called `multi.sqlite`.

db = SQLite.DB(joinpath(@__DIR__, "multi.sqlite"))
filename = joinpath(@__DIR__, "multi.sqlite");

# To run locally, download [`multi.sqlite`](multi.sqlite) and update `filename`
# appropriately.

# Load the database using `SQLite.DB`:

db = SQLite.DB(filename)

# A quick way to see the schema of the database is via `SQLite.tables`:

Expand Down
9 changes: 8 additions & 1 deletion docs/src/tutorials/linear/multi_commodity_network.jl
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,14 @@ import Test #src
# For the purpose of this tutorial, the JuMP repository contains an example
# database called `commodity_nz.db`:

db = SQLite.DB(joinpath(@__DIR__, "commodity_nz.db"))
filename = joinpath(@__DIR__, "commodity_nz.db");

# To run locally, download [`commodity_nz.db`](commodity_nz.db) and update
# `filename` appropriately.

# Load the database using `SQLite.DB`:

db = SQLite.DB(filename)

# A quick way to see the schema of the database is via `SQLite.tables`:

Expand Down

0 comments on commit 7e20e59

Please sign in to comment.