This is a list of frequently asked questions about tomSym.
- 1 Can I be sure that TOMLAB will always return a solution to my optimization problem?
- 2 TOMSYM says that "the returned solution may be incorrect". What's wrong?
- 3 How can I know when tomSym is used instead of Matlab's own routines?
- 4 The solution contains fields named "symb1", "symb2" etc. Where do these come from?
- 5 How do I set solver parameters, when using ezsolve?
Can I be sure that TOMLAB will always return a solution to my optimization problem?
-No. Although there are certain subclasses of problems, such as Linear Programming (LP) and Quadratic Programming (QP), where convergence is guaranteed (with upper bounds on the computation time), in the general case there is no guarantee that a given problem can be solved in any reasonable amount of time, nor that the returned solution is a global optimum.
However, TOMLAB has a large collection of powerful solvers, and is often able to solve problems that are considered extremely hard as long as the optimization parameters are choosen correctly. (If you run into problems, don't hesitate to contact our support team. See our website http://tomopt.comor contact info.)
TOMSYM says that "the returned solution may be incorrect". What's wrong?
TOMSYM gives this warning message whenever the numeric solver returned any kind of error or warning. Look at the output from the solver for clues.
If the solver says that the problem was ïnfeasible", then there is likely a problem with the constraints. Try removing or relaxing constraints one at a time to pinpoint the problem. The feasibilitycheck function can also be useful in diagnosing the problem and finding a feasible initial point.
If the solver determines that the problem is ünbounded", then there are either not enough constraints, or the objective function is incorrect. Remember that TOMSYM alwasy assumes a minimization problem, so for maximization problems a minus sign must be put in front of the objective.
If the solver stoped because the maximum number of iterations was exceeded, then there is likely something wrong with the scaling of the problem. Are some variables/equations thousands of times larger than others? Setting options.scale = 'auto' might help. Another likely cause of the problem is that the initial guess is not good enough. Try supplying a better guess.
If the solver "terminated during ... evaluation" then your objective or equations (or their derivatives) has a numeric problem, such as division by zero. Try to rewrite your code to avoid division by zero, set stricter bounds so that this does not occur, or switch to a more robust solver.
How can I know when tomSym is used instead of Matlab's own routines?
TomSym routines are overloaded which means that they will be used whenever a tomSym object is part of a function call. For example, if x is a tomSym symbol (or expression), then a function call such as sin(x) will use the tomSym version of the sin function, and the returned object will be another tomSym expression.
On the other hand, calling sin(0.5) will use Matlab's own sin function, even if TOMLAB is installed.
The solution contains fields named "symb1", "symb2" etc. Where do these come from?
The symb* fields appear because ezsolve calls the function rewriteV to rewrite some non-linear functions, like abs, as linear equations using extra variables and constraints. This can make convergence much faster. You can safely ignore the symb* values in the solution.
Variables named symb* can also appear when a matrix inequality is converted for use with a regular NLP solver. In this case the new variable represents a square root of the positive definite matrix.
How do I set solver parameters, when using ezsolve?
Any options that can be given to tomRun in the Prob stucture can also be used with ezsolve. Just set the corresponding field in the OPTIONS.Prob substructure. See How to set SNOPT tolerances with ezsolve.