[FlopCpp] Indirect index in flopcpp

Eduardo F. Silva efsilva at pobox.com
Thu Aug 31 19:27:14 EDT 2006


 

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 :-(

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://list.coin-or.org/pipermail/flopcpp/attachments/20060831/741e2cb0/attachment.html


More information about the FlopCpp mailing list