Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Greybox model DOF counitng in degrees_of_freedom function #1512

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 24 additions & 2 deletions idaes/core/util/model_diagnostics.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@
deactivated_objectives_set,
variables_in_activated_constraints_set,
variables_not_in_activated_constraints_set,
number_activated_greybox_equalities,
number_deactivated_greybox_equalities,
activated_greybox_block_set,
deactivated_greybox_block_set,
greybox_block_set,
unfixed_greybox_variables,
greybox_variables,
degrees_of_freedom,
large_residuals_set,
variables_near_bounds_set,
Expand Down Expand Up @@ -4402,8 +4409,8 @@ def _collect_model_statistics(model):
f"(External: {len(ext_fixed_vars_in_constraints)})"
)
stats.append(
f"{TAB}Activated Equality Constraints: {len(activated_equalities_set(model))} "
f"(Deactivated: {len(deactivated_equalities_set(model))})"
f"{TAB}Activated Equality Constraints: {len(activated_equalities_set(model))+number_activated_greybox_equalities(model)} "
f"(Deactivated: {len(deactivated_equalities_set(model))+number_deactivated_greybox_equalities(model)})"
)
stats.append(
f"{TAB}Activated Inequality Constraints: {len(activated_inequalities_set(model))} "
Expand All @@ -4414,6 +4421,21 @@ def _collect_model_statistics(model):
f"(Deactivated: {len(deactivated_objectives_set(model))})"
)

# Only show graybox info if they are present
if len(greybox_block_set(model)) != 0:
stats.append(f"{TAB}GreyBox Statistics")
stats.append(
f"{TAB* 2}Activated GreyBox models: {len(activated_greybox_block_set(model))} "
f"(Deactivated: {len(deactivated_greybox_block_set(model))})"
)
stats.append(
f"{TAB* 2}Activated GreyBox Equalities: {number_activated_greybox_equalities(model)} "
f"(Deactivated: {number_deactivated_greybox_equalities(model)})"
)
stats.append(
f"{TAB* 2}Free Variables in Activated GreyBox Equalities: {len(unfixed_greybox_variables(model))} (Fixed: {len(greybox_variables(model)-unfixed_greybox_variables(model))})"
)

return stats


Expand Down
Loading
Loading