Yes, the update is definitely wrong, the code you sent should not even compile, it must be:
listVarMachines[i].update(*this, share, s.listVarMachines[i]); instead of listVarMachines.update(*this, share, s.listVarMachines[i]); and so on. Then, do you initialize the variable and integer arrays properly? Christian -- Christian Schulte, Professor of Computer Science, KTH, <http://www.ict.kth.se/~cschulte/> www.ict.kth.se/~cschulte/ From: users-boun...@gecode.org [mailto:users-boun...@gecode.org] On Behalf Of Holmes Giovanny Salazar Osorio Sent: Wednesday, April 17, 2013 6:06 AM To: users@gecode.org Subject: [gecode-users] Updating Variables stored in a STL-Vector Hello all, I have Gecode 3.7.3 on Ubuntu. I'm working in a scheduling problem with optmization, therefore, I'm using MaximizeScript and the cumulatives constraint. Right now, I'm having problems with the cumulatives constraint, because, It doesn't works properly. I have something like take into account that: size = listVarMachines.size = listVarTStarts = listVarTEnds = listDuration = listResources = listMachinesCapacity for(int i = 0; i < size; i++){ cumulatives( *this, listVarMachines[i], listVarTStarts[i], listDuration[i], listVarTEnds[i], listResources[i], listMachinesCapacity[i], true, ICL_BND); } where listVarMachines, listVarTStarts, listVarTEnds are declared in this way -> vector<IntVarArray> listVar... And listDuration, listResources and listMachinesCapacity are declared in this way -> vector<IntArgs> list... When I force the elements in the vector listMachinesCapacity to take a value of 1. The program assign more than 1 task at the same time. This is wrong, because with the Limit of resource equals to 1, the cumulatives constraint should assign one and only one task in the same unit of time. I think that the problems is that the cumulatives constraint isn't being propagated for any reason. And I have doubts with the way in that the variables are being updated. In the update function I have something like this: MyClass(bool share, MyClasss) : MaximizeScript(share, s) { listVarMachines = s.listVarMachines; listVarTStarts = s.listVarTStarts; listVarTEnds = s.listVarTEnds; for( int i=0; i < size; i++) { listVarMachines.update(*this, share, s.listVarMachines[i]); listVarTStarts.update(*this, share, s.listVarTStarts[i]); listVarTEnds .update(*this, share, s.listVarTEnds[i]); } } Dou you think that the problem can be the way of I'm updating the variables, or do you have another idea? Thank you in advance!. Best regards, Holmes -- "El secreto del éxito, está en la disciplina" Holmes Giovanny Salazar Osorio Ingeniería de Sistemas Estudiante 10mo Semestre Universidad del Valle - Sede Tuluá
_______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users