@@ -347,25 +347,28 @@ function check_time_structure(x::AbstractElement, 𝒯)
347347end
348348
349349"""
350- check_profile(fieldname, value::TimeProfile, 𝒯::TwoLevel)
351- check_profile(fieldname, value::StrategicProfile, 𝒯::TwoLevel)
352- check_profile(fieldname, value::StrategicStochasticProfile, 𝒯::TwoLevel)
350+ check_profile(fieldname, value::TimeProfile, 𝒯::TwoLevel; bool::Bool=true )
351+ check_profile(fieldname, value::StrategicProfile, 𝒯::TwoLevel; bool::Bool=true )
352+ check_profile(fieldname, value::StrategicStochasticProfile, 𝒯::TwoLevel; bool::Bool=true )
353353
354- check_profile(fieldname, value::TimeProfile, 𝒯::TwoLevelTree)
355- check_profile(fieldname, value::StrategicProfile, 𝒯::TwoLevelTree)
356- check_profile(fieldname, value::StrategicStochasticProfile, 𝒯::TwoLevelTree)
354+ check_profile(fieldname, value::TimeProfile, 𝒯::TwoLevelTree; bool::Bool=true )
355+ check_profile(fieldname, value::StrategicProfile, 𝒯::TwoLevelTree; bool::Bool=true )
356+ check_profile(fieldname, value::StrategicStochasticProfile, 𝒯::TwoLevelTree; bool::Bool=true )
357357
358358Check that an individual `TimeProfile` corresponds to the time structure `𝒯`. The individual
359359checks are depending on the profile type and the time structure.
360+
361+ The key word argument `bool` is used to identify whether subprofiles should be checked
362+ (`true` as default) or not (`false`).
360363"""
361- function check_profile (fieldname, value:: TimeProfile , 𝒯:: TwoLevel )
364+ function check_profile (fieldname, value:: TimeProfile , 𝒯:: TwoLevel ; bool :: Bool = true )
362365 𝒯ᴵⁿᵛ = strategic_periods (𝒯)
363- for t_inv ∈ 𝒯ᴵⁿᵛ
366+ bool && for t_inv ∈ 𝒯ᴵⁿᵛ
364367 p_msg = " strategic period $(t_inv. sp) "
365368 check_profile (fieldname, value, t_inv. operational, p_msg)
366369 end
367370end
368- function check_profile (fieldname, value:: StrategicProfile , 𝒯:: TwoLevel )
371+ function check_profile (fieldname, value:: StrategicProfile , 𝒯:: TwoLevel ; bool :: Bool = true )
369372 𝒯ᴵⁿᵛ = strategic_periods (𝒯)
370373
371374 len_vals = length (value. vals)
@@ -380,7 +383,7 @@ function check_profile(fieldname, value::StrategicProfile, 𝒯::TwoLevel)
380383 @assert_or_log (
381384 len_vals == len_ts, " The `TimeProfile` of field `" * string (fieldname) * message
382385 )
383- for t_inv ∈ 𝒯ᴵⁿᵛ
386+ bool && for t_inv ∈ 𝒯ᴵⁿᵛ
384387 p_msg = " strategic period $(t_inv. sp) "
385388 check_profile (
386389 fieldname,
@@ -390,7 +393,7 @@ function check_profile(fieldname, value::StrategicProfile, 𝒯::TwoLevel)
390393 )
391394 end
392395end
393- function check_profile (fieldname, value:: StrategicStochasticProfile , 𝒯:: TwoLevel )
396+ function check_profile (fieldname, value:: StrategicStochasticProfile , 𝒯:: TwoLevel ; bool :: Bool = true )
394397 @warn (
395398 " Using `StrategicStochasticProfile` with `TwoLevel` is dangerous, " *
396399 " as it may lead to unexpected behaviour. " *
@@ -401,14 +404,14 @@ function check_profile(fieldname, value::StrategicStochasticProfile, 𝒯::TwoLe
401404 prof = StrategicProfile ([op_prof[1 ] for op_prof ∈ value. vals])
402405 check_profile (fieldname, prof, 𝒯)
403406end
404- function check_profile (fieldname, value:: TimeProfile , 𝒯:: TwoLevelTree )
407+ function check_profile (fieldname, value:: TimeProfile , 𝒯:: TwoLevelTree ; bool :: Bool = true )
405408 𝒯ᴵⁿᵛ = strategic_periods (𝒯)
406- for t_inv ∈ 𝒯ᴵⁿᵛ
409+ bool && for t_inv ∈ 𝒯ᴵⁿᵛ
407410 p_msg = " branch $(t_inv. branch) in strategic period $(t_inv. sp) "
408411 check_profile (fieldname, value, t_inv. operational, p_msg)
409412 end
410413end
411- function check_profile (fieldname, value:: StrategicProfile , 𝒯:: TwoLevelTree )
414+ function check_profile (fieldname, value:: StrategicProfile , 𝒯:: TwoLevelTree ; bool :: Bool = true )
412415 𝒯ˢˢᶜ = strategic_scenarios (𝒯)
413416 t_inv_vec = []
414417
@@ -426,7 +429,7 @@ function check_profile(fieldname, value::StrategicProfile, 𝒯::TwoLevelTree)
426429 @assert_or_log (
427430 len_vals == len_ts, " The `TimeProfile` of field `" * string (fieldname) * message,
428431 )
429- for t_inv ∈ 𝒯ᴵⁿᵛ
432+ bool && for t_inv ∈ 𝒯ᴵⁿᵛ
430433 t_inv ∈ t_inv_vec && continue
431434 push! (t_inv_vec, t_inv)
432435
@@ -440,7 +443,7 @@ function check_profile(fieldname, value::StrategicProfile, 𝒯::TwoLevelTree)
440443 end
441444 end
442445end
443- function check_profile (fieldname, value:: StrategicStochasticProfile , 𝒯:: TwoLevelTree )
446+ function check_profile (fieldname, value:: StrategicStochasticProfile , 𝒯:: TwoLevelTree ; bool :: Bool = true )
444447 # Check for the number of strategic periods
445448 len_vals = length (value. vals)
446449 len_ts = n_strat_per (𝒯)
@@ -475,7 +478,7 @@ function check_profile(fieldname, value::StrategicStochasticProfile, 𝒯::TwoLe
475478 end
476479
477480 # Check the sub profiles
478- for t_inv ∈ strategic_periods (𝒯)
481+ bool && for t_inv ∈ strategic_periods (𝒯)
479482 p_msg = " branch $(t_inv. branch) in strategic period $(t_inv. sp) "
480483 sp_prof = value. vals[minimum ([t_inv. sp, length (value. vals)])]
481484 check_profile (
0 commit comments