Commit fa864ac3 authored by Jesse VanderWees's avatar Jesse VanderWees 🐘

make base_folder='..' default

parent f99b4ff2
......@@ -23,4 +23,4 @@ class Example(CSVMixin, ModelicaMixin, CollocatedIntegratedOptimizationProblem):
return constraints
# Run
run_optimization_problem(Example, base_folder='..')
run_optimization_problem(Example)
......@@ -96,7 +96,7 @@ class Example(GoalProgrammingMixin, ControlTreeMixin, CSVLookupTableMixin,
# end of our run.
for e_m in range(self.ensemble_size):
results = self.extract_results(e_m)
self.set_timeseries('V_storage', results['storage.V'], ensemble_member=e_m)
self.set_timeseries('V_storage', results['storage.V'], ensemble_member=e_m)
_max = self.get_timeseries('V_max', ensemble_member=e_m).values
_min = self.get_timeseries('V_min', ensemble_member=e_m).values
......@@ -131,4 +131,4 @@ class Example(GoalProgrammingMixin, ControlTreeMixin, CSVLookupTableMixin,
return options
# Run
run_optimization_problem(Example, base_folder='..')
run_optimization_problem(Example)
......@@ -92,7 +92,7 @@ class Example(GoalProgrammingMixin, CSVMixin, ModelicaMixin,
(((self.state('Q_orifice') / (w * C * d)) ** 2) / (2 * g) +
self.state('orifice.HQDown.H') - self.state('orifice.HQUp.H') -
M * (1 - self.state('is_downhill')),
-inf, 0.0))
-inf, 0.0))
return constraints
......@@ -145,4 +145,4 @@ class Example(GoalProgrammingMixin, CSVMixin, ModelicaMixin,
return options
# Run
run_optimization_problem(Example, base_folder='..')
run_optimization_problem(Example)
......@@ -64,7 +64,7 @@ class Example(GoalProgrammingMixin, CSVLookupTableMixin, CSVMixin,
# Q_in is a varying input and is defined in timeseries_import.csv
# However, if we set it again here, it will be added to the output file
self.set_timeseries('Q_in',self.get_timeseries('Q_in'))
self.set_timeseries('Q_in', self.get_timeseries('Q_in'))
# Convert our water level constraints into volume constraints
self.set_timeseries('V_max',
......@@ -116,4 +116,4 @@ class Example(GoalProgrammingMixin, CSVLookupTableMixin, CSVMixin,
return options
# Run
run_optimization_problem(Example, base_folder='..')
run_optimization_problem(Example)
......@@ -53,7 +53,7 @@ class Example(CSVMixin, ModelicaMixin, CollocatedIntegratedOptimizationProblem):
(((self.state('Q_orifice') / (w * C * d)) ** 2) / (2 * g) +
self.state('orifice.HQDown.H') - self.state('orifice.HQUp.H') -
M * (1 - self.state('is_downhill')),
-inf, 0.0))
-inf, 0.0))
return constraints
......@@ -65,4 +65,4 @@ class Example(CSVMixin, ModelicaMixin, CollocatedIntegratedOptimizationProblem):
return options
# Run
run_optimization_problem(Example, base_folder='..')
run_optimization_problem(Example)
......@@ -19,7 +19,7 @@ from optimization.pi_mixin import PIMixin
from . import __version__
def run_optimization_problem(optimization_problem_class, base_folder=None, log_level=logging.INFO, profile=False, profile_casadi=False):
def run_optimization_problem(optimization_problem_class, base_folder='..', log_level=logging.INFO, profile=False, profile_casadi=False):
"""
Sets up and solves an optimization problem.
......@@ -92,7 +92,7 @@ def run_optimization_problem(optimization_problem_class, base_folder=None, log_l
filename = os.path.join(base_folder, "profile.prof")
cProfile.runctx("prob.optimize()", globals(), locals(), filename)
s = pstats.Stats(filename)
s.strip_dirs().sort_stats("time").print_stats()
else:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment