[FlopCpp] Extension of stampl.cpp for a portfolio optimization problem

Jia Li jialicn81 at yahoo.com
Wed Sep 13 06:59:10 EDT 2006


Hi All,

I'm working on the problem of portfolio optimization. I'm modifying the stampl.cpp written by Tim. A basic feature we're adding is a MP_variable Liability at each stage to denote the liability. From one year to another we can compute a "total return" by

MP_variable total return = sum(new asset value)/sum(asset value one-year ago)

Then we'll calculate

MP_variable Liability() = parent->Liability() * (some function based on total return);

In FlopC++ the operation of division of two "sum"s is not computable, so we need to circumvent it. What I did is to write it as a constraint:

MP_constraint PortfReturn( ) = sum( INSTR, parent->Buy( INSTR ) ) * TotalReturn() >= sum(INSTR,  parent->Buy(INSTR) * Return(INSTR));

Then another constraint to compute the new liability:

MP_constraint NewLiability( ) = Liability( ) == parent->Liability( ) * TotalReturn( );

The problem is that these two lines won't compile. For the first line the error is ".\portfopt.cpp(81) : error C2678: binary '*' : no operator found which takes a left-hand operand of type 'flopc::MP_expression' (or there is no acceptable conversion)"; for the second is ".\portfopt.cpp(82) : error C2678: binary '*' : no operator found which takes a left-hand operand of type 'const flopc::VariableRef' (or there is no acceptable conversion)".

It seems that it's not a feasible way to describe the problem to FlopC++. Could you offer any help or advice on the issue? Thanks in advance.

With best regards,

Jia Li
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/flopcpp/attachments/20060913/20f5d69a/attachment.html


More information about the FlopCpp mailing list