Take the 2-minute tour ×
Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. It's 100% free, no registration required.

I'm interested in multistage optimization problems. Are there any good R packages around to solve such problems over time? I'm not at all an expert in it, so maybe someone knows a good paper / lecture notes to start with? I know classical optimization (linear optimization, convex optimiziation etc) but I've never had to deal with optimization over time. Any reference, theoretical and regarding the implementation are very welcome. I know that this is a very general question, but this is due to my (not yet) attained knowledge. If further clarification is needed I'm happy to share thix. Many thanks in advance

EDIT

Let's take for example the following paper, there we have a optimization problem of the form:

$$\max \sum_{i=1}^{n+1}r^L_ix_i^L$$

such that

$$ x^l_i=r^{l-1}_i x_i^{l-1}-y_i^l+z^l_i,\hspace{2pt} i=1,\dots n,l=1,\dots,L$$ $$ x^l_i=r^{l-1}_{n+1} x_{n+1}^{l-1}+\sum_{i=1}^n(1-\mu^l_i)y_i^l-\sum_{i=1}^n(1+\nu_i^l)z^l_i$$ $$y^l_i\ge 0,\hspace{2pt} i=1,\dots n,l=1,\dots,L$$ $$x^l_i\ge 0,\hspace{2pt} i=1,\dots n,l=1,\dots,L$$ $$z^l_i\ge 0,\hspace{2pt} i=1,\dots n,l=1,\dots,L$$ where some $x_i^l$ is the value (in dollar) of an asset $i$ at time $l$, $r_i^l$ is the asset return, $y^l_i$ and $z^l_i$ are the amount of asset sold and bought. $\mu^l_i $ and $\nu_i^l$ have also economical interpretation, but are not that important for the question. Assuming everthing is deterministic, we can solve this problem using interior points / simplex method since it is an "simple" LP. However the theory I'm looking for should give me ideas if it is optimal to solve at every time $l$ the subproblem (maximize $\sum_{i=1}^{n+1}r^l_ix^l_i$ under the corresponding constraints or is this not a good idea. I have heard / read that one could solve such kind of problem using stochastic programming, but still I'm interested in knowing how to subdivide (if possible) such kind of problems.

share|improve this question
    
I don't believe there is any universal package or approach for multi-period optimizing (but I'd love to be wrong). Can you be more specific what kind of problems you're trying to solve? –  Bob Jansen Aug 19 at 19:33
    
@BobJansen I added just an example I found in the web. hope my question is now clearer formulated –  user8 Aug 20 at 17:19
    
Looks good to me! –  Bob Jansen Aug 20 at 18:45

3 Answers 3

There is an approach called Model Predictive Control which optimizes the state trajectory of a system over time. There doesn't seem to be suitable R packages, but I can recommend the YALMIP package as probably being a good place to start: http://users.isy.liu.se/johanl/yalmip/

share|improve this answer
    
thanks for your answer. I will check Model Predictive Control! –  user8 Aug 20 at 17:04

PortfolioAnalytics, has the ability to optimize portfolios based on factors or whatever groups/characteristics you enter.

https://r-forge.r-project.org/R/?group_id=579

Please refer to the vignette in the package in the package PortfolioAnalytics (https://r-forge.r-project.org/scm/viewvc.php/pkg/PortfolioAnalytics/vignettes/?root=returnanalytics

I use it on a regular basis to solve problems similar to the one you posted above.

share|improve this answer
    
thanks for also answering this question. your shared link does not work (copied the whole text). Could you please fix this? Moreover, I know that we can solve this using PortfolioAnalytics. However, from a mathematical viewpoint it is not clear (and I think it is not true) that this is greedy algorithm –  user8 Sep 15 at 17:27
    
PortfolioAnalytics allows you to choose the optimizer, There are 5 (iirc) choices and one of them includes differential evolution. There is also an optimize that re balances over time. As it is all open source you can refer to the source code for the inner workings of the package. –  KKB Sep 16 at 18:51
    
I didn't know that. Many thank for the link. The option using DEoptim seems interesting. Generally and this isbrelated to our other discussion. What kind of returns does all these function expect? Log, relative etc? –  user8 Sep 17 at 6:53
    
Generally most R functions (in the returnanlytics libraries) accept continuous (e.g. log) or arithmetic returns. However PortA is highly customizable so you can modify and insert whatever you like. –  KKB Sep 17 at 14:33

What you refer to multiperiod optimization can also be classified under dynamic programming. You need to write a recursion (which can be nauseating at first) and any optimization function in R would do a nice job, if your problem is not too big.

For the second part, you may search for some sensitivity analysis literature but I am not totally sure about where to look at.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.