[FlopCpp] index in computation

Tim Hultberg Tim.Hultberg at eumetsat.int
Tue Mar 3 02:10:08 EST 2009


Havent checked if it works, but I would try

  balance(k) =
     z(k) == sum(K(i), (Constant(k)-Constant(i))*x(i) );

Tim

From: flopcpp-bounces at list.coin-or.org [mailto:flopcpp-bounces at list.coin-or.org] On Behalf Of Michael Chen
Sent: Tuesday, March 03, 2009 6:06 AM
To: flopcpp at list.coin-or.org
Subject: [FlopCpp] index in computation

Dear there,

I am wondering how to express this constraint in flopcpp:
const int L = 3;
MP_set K(L);
MP_variable z(K);
Mp_variable x(K);
MP_constraint balance(K);

and here is the constraint in question:
for k=1,...,K, balance(k):
z(k) = sum_{i=1}^k ( k - i ) * x(i);

The problem is that FlopC++ doesn't seem to allow MP_set in direct computation (k - i).

Sincerely Yours,
Michael




--
Best regards,
Michael Chen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/flopcpp/attachments/20090303/47497908/attachment.html 


More information about the FlopCpp mailing list