Find type of relation between variables I have time-series data of a few metrics. I know which metric is the response variable and the independent ones. I need to fit a model between them. The relationship could be linear, quadratic, logarithmic, piecewise linear, multiple linear, etc. Basically, it could be anything.

Is there any technique / properties I could use to find the relationship between the metrics and fit a model?

Right now, I have written a brute-force script in R. 
For example, I have response variable A which depends on X1, X2 and X2.


  A = C1*f1(X1)+C2*f2(X2)+C3*f3(X3) is my model.


My script tries all possible combinations of f1, f2 and f3.
By combinations, I mean that I initialy start with all linear, then one of them is quadratic, then cubic, then logarithmic, etc.

I am using lm().

I then choose the model which has the least AIC as my final model.

This obviously takes too long.

I definitely need an automated way of finding this model.

Could you suggest a better way to do this?
How about using neural networks instead of linear models? The neural net will have an easier time learning arbitrary non-linear relationships.