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

Tim Hultberg Tim.Hultberg at eumetsat.int
Wed Sep 13 09:04:59 EDT 2006


FLOPC++ only handles linear problems (LPs and MIPs). Thats also why you
cant have division by expressions involving variables.
 
What you try to specify instead are quadratic contraints, since Buy,
TotalReturn and Liability are all MP_variables.

Best regrads, Tim

>>> Jia Li <jialicn81 at yahoo.com> 13/09/2006 12:59 >>>
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


More information about the FlopCpp mailing list