I would like to create a Taylor expansion of an objective function but I am having trouble as the objective function is a Generic affline expression. Is there a way to use the convert () to convert the form?

This is the MWE.

```
using JuMP
using TaylorSeries
```

S and N are sets

```
N = Array(1:100);
S = ["s1","s2","s3","s4"];
```

Price is a parameter and d is a variable within the milp model.

```
profit(N::Array{Float64,1}) = sum((price[s])*(d[s,n]) for n in N for s in S if s == S[4])
```

```
∫⬩dn(p::Taylor1) = integrate(p)
```

```
function TaylorSurrogate(f, p0)
p = copy(p0)
pnew = p0 + ∫⬩dn(f(p))
while (pnew - p) != 0
p = pnew
pnew = p0 + ∫⬩dn(f(p))
end
return p
end
```

```
degree = 3
p0 = Taylor1([1.0], degree)
SurrogateApproximation = TaylorSurrogate(profit(N::Array{Float64,1}), p0)
```

The full error:

MethodError: objects of type GenericAffExpr{Float64,VariableRef} are not callable

Stacktrace:

[1] TaylorSurrogate(::GenericAffExpr{Float64,VariableRef}, ::Taylor1{Float64}) at .\In[120]:4

[2] top-level scope at In[129]:1

[3] include_string(::Function, ::Module, ::String, ::String) at .\loading.jl:1091

Is there a way to convert objects of GenericAffExpr{Float64, Variable} to a form that is callable into a function?

Thank you