<html><head><style type="text/css"><!-- DIV {margin:0px} --></style></head><body><div style="font-family:times new roman, new york, times, serif;font-size:12pt"><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">That's what I suspected. Is there any way to tackle my original problem then? I'm stuck there...<br><br>Jia<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Message d'origine ----<br>De : Tim Hultberg &lt;Tim.Hultberg@eumetsat.int&gt;<br>À : flopcpp@list.coin-or.org; Jia Li &lt;jialicn81@yahoo.com&gt;<br>Envoyé le : Mercredi, 13 Septembre 2006, 3h04mn 59s<br>Objet&nbsp;: Re: [FlopCpp] Extension of stampl.cpp for a portfolio optimization problem<br><br><div>FLOPC++ only handles linear problems (LPs and MIPs). Thats also why you<br>cant have division by expressions involving variables.<br> <br>What you try to specify instead are quadratic contraints, since Buy,<br>TotalReturn and Liability are
 all MP_variables.<br><br>Best regrads, Tim<br><br>&gt;&gt;&gt; Jia Li &lt;jialicn81@yahoo.com&gt; 13/09/2006 12:59 &gt;&gt;&gt;<br>Hi All,<br><br>I'm working on the problem of portfolio optimization. I'm modifying the<br>stampl.cpp written by Tim. A basic feature we're adding is a MP_variable<br>Liability at each stage to denote the liability. From one year to<br>another we can compute a "total return" by<br><br>MP_variable total return = sum(new asset value)/sum(asset value<br>one-year ago)<br><br>Then we'll calculate<br><br>MP_variable Liability() = parent-&gt;Liability() * (some function based on<br>total return);<br><br>In FlopC++ the operation of division of two "sum"s is not computable,<br>so we need to circumvent it. What I did is to write it as a constraint:<br><br>MP_constraint PortfReturn( ) = sum( INSTR, parent-&gt;Buy( INSTR ) ) *<br>TotalReturn() &gt;= sum(INSTR,&nbsp;&nbsp;parent-&gt;Buy(INSTR) * Return(INSTR));<br><br>Then another constraint to compute the
 new liability:<br><br>MP_constraint NewLiability( ) = Liability( ) == parent-&gt;Liability( ) *<br>TotalReturn( );<br><br>The problem is that these two lines won't compile. For the first line<br>the error is ".\portfopt.cpp(81) : error C2678: binary '*' : no operator<br>found which takes a left-hand operand of type 'flopc::MP_expression' (or<br>there is no acceptable conversion)"; for the second is<br>".\portfopt.cpp(82) : error C2678: binary '*' : no operator found which<br>takes a left-hand operand of type 'const flopc::VariableRef' (or there<br>is no acceptable conversion)".<br><br>It seems that it's not a feasible way to describe the problem to<br>FlopC++. Could you offer any help or advice on the issue? Thanks in<br>advance.<br><br>With best regards,<br><br>Jia Li<br></div></div><br></div></div></body></html>