Skip to content
Merged
Changes from all 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
19 changes: 13 additions & 6 deletions src/axiomatic/pic_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ def plot_parameter_history(parameters: List[Parameter], parameter_history: List[
plt.show()


def print_statements(statements: StatementDictionary, validation: Optional[StatementValidationDictionary] = None):
def print_statements(statements: StatementDictionary, validation: Optional[StatementValidationDictionary] = None, only_formalized: bool = False):
"""
Print a list of statements in nice readable format.
"""
Expand All @@ -231,6 +231,8 @@ def print_statements(statements: StatementDictionary, validation: Optional[State

print("-----------------------------------\n")
for cost_stmt, cost_val in zip(statements.cost_functions or [], validation.cost_functions or []):
if (cost_stmt.formalization is None or cost_stmt.formalization.mapping is None) and only_formalized:
continue
print("Type:", cost_stmt.type)
print("Statement:", cost_stmt.text)
print("Formalization:", end=" ")
Expand All @@ -256,6 +258,8 @@ def print_statements(statements: StatementDictionary, validation: Optional[State
print(val.message)
print("\n-----------------------------------\n")
for param_stmt, param_val in zip(statements.parameter_constraints or [], validation.parameter_constraints or []):
if (param_stmt.formalization is None or param_stmt.formalization.mapping is None) and only_formalized:
continue
print("Type:", param_stmt.type)
print("Statement:", param_stmt.text)
print("Formalization:", end=" ")
Expand All @@ -281,6 +285,8 @@ def print_statements(statements: StatementDictionary, validation: Optional[State
print(f"Holds: {val.holds} ({val.message})")
print("\n-----------------------------------\n")
for struct_stmt, struct_val in zip(statements.structure_constraints or [], validation.structure_constraints or []):
if struct_stmt.formalization is None and only_formalized:
continue
print("Type:", struct_stmt.type)
print("Statement:", struct_stmt.text)
print("Formalization:", end=" ")
Expand All @@ -301,11 +307,12 @@ def print_statements(statements: StatementDictionary, validation: Optional[State
print(f"Satisfiable: {val.satisfiable}")
print(f"Holds: {val.holds}")
print("\n-----------------------------------\n")
for unf_stmt in statements.unformalizable_statements or []:
print("Type:", unf_stmt.type)
print("Statement:", unf_stmt.text)
print("Formalization: UNFORMALIZABLE")
print("\n-----------------------------------\n")
if not only_formalized:
for unf_stmt in statements.unformalizable_statements or []:
print("Type:", unf_stmt.type)
print("Statement:", unf_stmt.text)
print("Formalization: UNFORMALIZABLE")
print("\n-----------------------------------\n")


def _str_units_to_float(str_units: str) -> float:
Expand Down
Loading