Skip to content

Add debug check for magnitude of state vector entries

Tjerk Vreeken requested to merge debug-check-scaling-output-state-magnitude into master

It can be useful to check whether the nominals for variables were chosen correctly by looking at the state output.

Solvers like CPLEX and Gurobi typically prefer to have state vector entries being no larger than 1E4. Solvers like IPOPT generally prefer them smaller than 1E2. If any state vector entry of a certain variable exceeds this tol_up threshold (1E4 by default), a message is logged.

Aside from the maximum magnitude of state vector entries, the accuracy of the solution can also be effected negatively if a too large a nominal is chosen. The added check routine can however not be sure if the solution just happened to be approximately zero, or if the nominal was chosen incorrectly. A message is logged when all state vector entries of a certain variable are smaller (in absolute terms) than the tol_down criterion.

Note that it may not be possible to both satisfy correct scaling of the coefficients in the Jacobian and the state vector entries. Sometimes a trade-off between the two would be required, i.e. a coefficient that's rather small, and state vector entries that are rather small. This is preferred over only one of the two being doubly small.

Merge request reports