From 7d8ba906c3c7f3e85e2cd3abb8bb8a721c74028d Mon Sep 17 00:00:00 2001 From: Orhidea Shatri <140660448+scrappie1@users.noreply.github.com> Date: Tue, 12 May 2026 16:38:58 +0200 Subject: [PATCH] Add var_value and objective impact to SQLiteWriter.py --- SQLiteWriter.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/SQLiteWriter.py b/SQLiteWriter.py index 7547aeb..b55de38 100644 --- a/SQLiteWriter.py +++ b/SQLiteWriter.py @@ -201,10 +201,14 @@ def add_objective_decomposition_to_sqlite(filename: str, model: pyo.ConcreteMode var_names = [var.parent_component().name for var in repn.linear_vars] var_indices = [str(var.index()) for var in repn.linear_vars] coefs = list(repn.linear_coefs) + var_values = [pyo.value(var) for var in repn.linear_vars] + var_times_coefficient = [var_value * coef for var_value, coef in zip(var_values, coefs)] df_terms = pd.DataFrame({ 'var_name': var_names, 'var_index': var_indices, - 'coefficient': coefs + 'coefficient': coefs, + 'var_value': var_values, + 'var_times_coefficient': var_times_coefficient, }) df_terms.to_sql('objective_terms', cnx, if_exists='replace', index=False)