[gecode-users] Updating Variables stored in a STL-Vector
Christian Schulte
cschulte at kth.se
Wed Apr 17 22:26:11 CEST 2013
I cant really see the error. What happens if you just use a single machine?
Do you really have to use cumulatives? Would cumulative work instead?
Christian
--
Christian Schulte, www.ict.kth.se/~cschulte/
From: Holmes Giovanny Salazar Osorio [mailto:hgsosorio at gmail.com]
Sent: Wednesday, April 17, 2013 3:26 PM
To: cschulte at kth.se
Cc: users at gecode.org
Subject: Re: [gecode-users] Updating Variables stored in a STL-Vector
Hello Christian,
I wrote bad the code in the mail, but in my class I update the variables in
this way,
listVarMachines[i].update(*this, share, s.listVarMachines[i]);
I'm initializing the stl-vectors that contain IntArgs in this way:
listResources.push_back(IntArgs(size, anIntegerArray));
And the stl-vectors that contain IntVarArray in this way:
for the machines:
listaVarMachines.push_back(IntVarArray(*this, size, anIntSet));
for the times of the tasks:
listVarTStart.push_back(IntVarArray(*this, size, 0, MAX-MAKESPAN));
MAX-MAKESPAN is an int. Take values > 500, it depends of the problem to
solve.
Thanks a lot for helping me. Best regards,
Holmes
2013/4/17 Christian Schulte <cschulte at kth.se>
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,
www.ict.kth.se/~cschulte/
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Holmes Giovanny Salazar Osorio
Sent: Wednesday, April 17, 2013 6:06 AM
To: users at 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á
--
"El secreto del éxito, está en la disciplina"
Holmes Giovanny Salazar Osorio
Ingeniería de Sistemas
Estudiante 10mo Semestre
Universidad del Valle - Sede Tuluá
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20130417/cbed687e/attachment-0001.html>
More information about the users
mailing list