Skip to content

Commit

Permalink
fixing a bug in data generation, a type of error of cvxpy was not cat…
Browse files Browse the repository at this point in the history
…ch properly
  • Loading branch information
BDonnot committed May 30, 2022
1 parent 201e586 commit 10b7c89
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion chronix2grid/grid2op_utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -600,13 +600,19 @@ def _adjust_gens(all_loss_orig,
try:
prob.solve()
except cp.error.SolverError as exc_:
error_ = RuntimeError(f"Pypsa failed to find a solution at iteration {iter_num}, error {exc_}")
error_ = RuntimeError(f"cvxpy failed to find a solution at iteration {iter_num}, error {exc_}")
res_gen_p = None
quality_ = None
break

# assign the generators
gen_p_after_optim = real_p.value
if gen_p_after_optim is None:
error_ = RuntimeError(f"cvxpy failed to find a solution at iteration {iter_num}, and returned None.")
res_gen_p = None
quality_ = None
break

id_redisp = 0
for gen_id, gen_nm in enumerate(env_for_loss.name_gen):
if env_for_loss.gen_redispatchable[gen_id]:
Expand Down

0 comments on commit 10b7c89

Please sign in to comment.