Skip to content

Add debug/verbose printing modes and make console output optional #87

@ttj

Description

@ttj

As the project has evolved, we should now standardize on output formatting and verbose printing, as there is a lot of output always print. This can decrease performance, particularly depending on the host platform and how it handles this.

Typically one would have a specialized print function, that would determine the level of output messages based on some options. For example, we could add a print_nnv() function. A globally defined option could then determine if messages get printed or not. This conditional check can add some overhead, but typically negligible relative to (or on some platforms, this can be done with constants at compile time instead of runtime). This post has some reasonable overview of how this is typically done in different projects:

https://stackoverflow.com/questions/312378/debug-levels-when-writing-an-application

E.g., something along the lines of the following:

print_nnv() {
    if global_verbose == 1:
        print() everything
    elif global_verbose == 2:
        print() only errors
    elif global_verbose == 3:
       print() errors and warnings
    etc.
}

I will add a basic version of this print message, but then we will need to update a lot of code to replace existing references to other print/display functions with this.

Related to this, I would also suggest we fully standardize the output generation of images/tables, etc. This is partly done in the codeocean, but we need to add it in for additional places. See e.g.:

https://github.com/verivital/nnv/blob/master/code/nnv/engine/utils/path_results.m

https://github.com/verivital/nnv/blob/master/code/nnv/examples/Submission/CAV2020/ACC/verify_linear_ACC.m#L144

https://github.com/verivital/nnv/blob/master/code/nnv/examples/Submission/CAV2020/ACC/plot_linear_ACC_reachSets.m#L174

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions