# Difference of convex functions optimization problem in R

I am seeking of any already written R package which could help in an optimization technique which is called Difference of convex functions. This technique is sketched here and could be very useful for reinforcement learning processes.

Does anyone know something, that could be helpful? I have found package called cccp, but it is all about conic optimization and I don't understand now how could it be used for such a problem.

I would like to solve the following (a bit simplified) minimization problem, which decomposes in difference of two convex functions:

$$\min_\mathbf{w} S(\mathbf{w}) =\min_\mathbf{w} \sum_{i=1}^{n} \min ( \dfrac{|X_i\mathbf{w}|}{\phi}, 1) = \min_\mathbf{w}~ (S_1(\mathbf{w}) - S_2(\mathbf{w}))$$

$$S_1(\mathbf{w}) = \sum_{i=1}^{n} \dfrac{|X_i\mathbf{w}|}{\phi}$$

$$S_2(\mathbf{w}) = \sum_{i=1}^{n} \left( \dfrac{|X_i\mathbf{w}|}{\phi} - 1 \right)^+$$

where $$(x)^+ = \max(x, 0)$$

If you have any suggestions or useful related links with any examples, they would be very appreciated.

PS. I have found that difference of convex functions optimization problem is closely related with "concave-convex optimization procedure" (CCCP). If anyone has thoughts of how the aforementioned problem could be solved by CCCP, please share!