new code to find primitives and costs
symbolic generation of optimization code