[GSoC-PortA] mixed integer constraints

Brian G. Peterson brian at braverock.com
Sat Jul 13 04:57:31 CEST 2013


On 07/12/2013 02:22 PM, Ross Bennett wrote:
>
> Round Lot Constraints
> Just thinking through out loud how to incorporate this into fn_map. The
> sum of portfolio weights would still sum to near 1 for a full investment
> constraint. We would need a user input value of total wealth to
> calculate the lots.
> The constraint could be specified with something like:
> add.constraint(portfolio, type="round_lot", total_wealth=1500000)
>
> # randomly generate some weights
> set.seed(123)
> tmp <- runif(5)
> w <- tmp/sum(tmp)
>
> total_wealth <- 1200000
>
> # round the lot values to the nearest integer
> lots <- round(w * total_wealth, 0)
>
> # calculate the new weights
> new_w <- lots/sum(lots)
>
> Am I on the right track for the round lot constraints?

Round lots can be 1, 100, 10000, 100000, 1000000, etc. depending on the 
market/asset.

Weights are typically percentages, though there's no real requirement 
that they be so.

I'm not sure that total_wealth is really required, or even really 
relevant to 'round lots'.  I think we just need a rounding factor for 
base mixed integer constraints.

If you wanted to make sure that your chosen weights would scale to round 
lots from some NAV value, that seems like a different type of 
constraint, and requires both a rounding factor for the 'round lots', as 
above, and a total wealth to make sure it is properly divisible when 
turned back into percentage weights likely to be a fraction of 1.

> Cardinality Constraints
> I thought I had a good handle on cardinality constraints to set a limit
> on the maximum number of positions. This is implemented in
> random_portfolios by using fn_map and specifying max_pos as a position
> limit constraint. This is also currently working with DEoptim by using
> the optional function argument fnMap=fn_map. This is not doable with
> quadprog. This is supported in rglpk. I suppose we can use the fn_map
> function for the other solvers, pso and GenSA. Am I missing a different
> application of cardinality constraint?

No, I just missed this code, this sounds right.  I'm not in front of the 
code right now, but have a couple questions:
- is your method compatible with the one used by glpk?

- does it support both long and short cardinality constraints? (e.g. 
from the total universe, 20 long and 20 short?)

- does it support group cardinality constraints? (e.g. max 5 technology, 
max 10 consumer goods, max 5 manufacturing, etc?)

> P.S. Enjoy your trip to Alaska!

Thanks!

Brian


-- 
Brian G. Peterson
http://braverock.com/brian/
Ph: 773-459-4973
IM: bgpbraverock


More information about the GSoC-PortA mailing list