@symbolic_optimizable

symbolic_optimizable(optimizable)

A decorator for defining an optimization problem with Sympy expressions. Only the objective and constraint functions need to be specified, their derivatives being obtained with symbolic differentiation.

Usage:

python
from sympy import sqrt   

@symbolic_optimizable
class Problem(EuclideanOptimizable):  
     def x0(self):   
         return [1,1] 

     def J(self, x): 
         return x[1]+3/sqrt(x[2])

     def H(self, x): 
         return (x[1]*x[0]-2)**2 -1

     # No need to defined dJ and dH which are computed by symbolic   
     # differentiation !

A strong assumption of the decorator is that the optimization variable x is a numpy array or list with a fixed dimension. In the definitions of J and H, the variable x is a symbolic IndexedBase object. The implementation of the class is compatible with the use of symbolic Sympy operators as illustrated above with the square root function sqrt.