Troubleshooting Guide for APMonitor

This is a page dedicated to describing common error messages in APMonitor and the remedies to fix them. Please consider posting a message with the exact application needed to reproduce the error to the Discussion Group if the solution is not found here, in the discussion group archive, or in the documentation. A search dialog is available on the sidebar to search the documentation for keywords or below in a custom Google search bar that is tailored to APMonitor topics.


Question: The program does not produce a solution. What is the source of the error?

Solution: A good first place to look is in output from APMonitor where an error message may point to the problem. To view the error message, display the output of the solve command.

 % in MATLAB
 output = apm(s,a,'solve');
 disp(output)

 # in Python
 output = apm(s,a,'solve');
 print(output)

Question: The program stops with an error that points to a specific line in the model. What is wrong with the expression?

Solution: When APMonitor can't compile an expression, it returns an error message with a question mark (?) underneath the specific point where it found the error. Missing parenthesis, duplicate variable names, uninitialized intermediate variables out of order, and inconsistent vectors indices are some of the common errors. For complicated expressions, it can be helpful to break the expression into multiple smaller expressions to find the source. APMonitor is not case sensitive (lower and upper case are equal) and spaces are removed before compiling equations. Reserved keywords that form mathematical expressions will give an error if used to start a variable name.


Question: Why does the MATLAB or Python function

 result = apm_tag(s,a,'variable.option')

return a value of -99999 for the result?

Solution: Options can be read after the solution with the command to access a tag from the database. If the tag does not exist, a value of -99999 is returned. Refer to the web interface by opening apm_web(s,a) to check if the option is available or the options documentation.


Question: The solver reports that the problem is infeasible. How can I identify the problem to achieve a successful solution?

Solution: An infeasible solution message may be the result of several causes.

  1. A variable constraint may be the source of the error.
  2. An equation may be the source of the error.
  3. The problem may be non-convex (multiple local minima are possible) and the initial guess leads the solver to an infeasible region.

An infeasibility report is generated and can be retrieved with the following command.

 apm_get(s,a,'infeasibilities.txt')

The report shows a summary of possible infeasible equations and variable constraints. A good practice is to remove variable constraints until the problem becomes feasible. Another way to identify an infeasible constraint is to set COLDSTART=2. This performs a block triangular decomposition of the problem to identify the subset of variables and equations that are causing the infeasible solution.