[FlopCpp] Indirect index in flopcpp

Tim Hultberg Tim.Hultberg at eumetsat.int
Fri Sep 1 12:24:22 EDT 2006


Hi Eduardo,
 you must declare toNodes as 

MP_data toNodes(S,T)

then when you reference it you'll probably need to explicitly convert to
MP_index_exp ..

     nonAnticip(s,t,p)=  z( MP_index_exp(toNodes(S,T)),
p)==x_flow(s,t,p); // This should work - (I hope)

Let me know if it works and if it solves your problem.

Cheers, Tim


Tim Hultberg

>>> "Eduardo F. Silva" <efsilva at pobox.com> 09/01/06 1:27 AM >>>
 

Hi all,

I am playing with flopcpp and end up having some hard time to model a
indirect index for a set.  I believe that is because I am not used to
flopcpp.  May be someone could help me.

 

The problem is simple to define, each combination (s,t) refers to a node
n.
In addition, a node n can be associated to different (s,t) pairs.   

 

My goal is to define the following constraint below:

 

 nonAnticip(s,t,p)=  z(n(s,t),p)==x_flow(s,t,p);

 

Below I have inserted some additional info about one of my tentative
codes.

 

Thanks,

Eduardo.

 

 

 

      MP_set s(nScenarios),

             t(nTimePeriods),

             p(nPlants),

             n(nNodes);

 

vector<vector<int> > stToNodes(nScenarios,vector<int>(nTimePeriods,0));

 

      for(int is=0;is<nScenarios;is++){      // all scenarios

        for(int it=0;it<nTimePeriods;it++){  // all time periods

                  stToNodes[is][it]=Node->index;   //Node->index is of
type
"int"

...

                  

            

      MP_variable  x_flow(s,t,p),

                   z(n,p);

      MP_constraint  nonAnticip(s,t,p);

 

      nonAnticip(s,t,p)=  z(n(stToNodes[s][t]),p)==x_flow(s,t,p); // Not
working :-(

 




More information about the FlopCpp mailing list