Skip to content

Commit

Permalink
Add tests on iterative method
Browse files Browse the repository at this point in the history
  • Loading branch information
Juliette-Gerbaux committed Dec 6, 2024
1 parent 43b477f commit d9f51de
Show file tree
Hide file tree
Showing 2 changed files with 791 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/multi_stock_bellman_value_calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
from tqdm import tqdm
from pathlib import Path
import juliacall
import os as os

jl = juliacall.Main

Expand Down Expand Up @@ -587,7 +588,7 @@ def Lget_costs(
load_from_protos: bool = False,
prefix: str = "",
) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
filename = f"{prefix}get_all_costs_run_{output_path[-27:]}.pkl"
filename = f"{prefix}get_all_costs_run_{output_path.replace('/','_')[-27:]}.pkl"

# Initializing the n_weeks*n_scenarios*n_controls(*n_stocks) values to fill
shape_controls = list(controls_list.shape)
Expand All @@ -609,6 +610,8 @@ def Lget_costs(
for week in week_range:
if week >= week_start:
for scenario in range(param.len_scenario):
if not (os.path.exists(output_path + "/protos")):
os.mkdir(output_path + "/protos")
proto_path = (
output_path
+ f"/protos/problem-{param.name_scenario[scenario]}-{week+1}.pkl"
Expand Down
Loading

0 comments on commit d9f51de

Please sign in to comment.