From 7651c91c9eda6f208f345f825076d0676740c091 Mon Sep 17 00:00:00 2001 From: Jingru Feng Date: Mon, 22 Jan 2024 13:13:08 +0100 Subject: [PATCH] Fix the bug in program, the last second validation function is working --- core/src/create.jl | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/core/src/create.jl b/core/src/create.jl index a76d7259f..b9ab781c8 100644 --- a/core/src/create.jl +++ b/core/src/create.jl @@ -704,13 +704,21 @@ function User(db::DB, config::Config)::User first_row = time[first_row_idx] is_active = true else - @error "User node #$node_id data not in any table." + @error "User node $node_id data not in any table." errors = true end - if !all(all.(>(0), eachcol(interpolations))) - error("Demand should be a non-negative number") + for (col, id) in zip(interpolations, node_ids) + for (demand_p_itp, p_itp) in zip(col, priorities) + if any(demand_p_itp.u .< 0.0) + @error "Demand of user node $id with priority #$p_itp should be non-negative" + errors = true + end + end end + #if !all(all.(>=(0.0), eachcol(interpolations))) + # error("Demand should be a non-negative number") + #end if !isnothing(first_row) min_level_ = coalesce(first_row.min_level, 0.0)