[gecode-users] Advisor on a ViewArray and index of assigned variable
Christian Schulte
cschulte at kth.se
Tue Nov 10 21:03:24 CET 2015
Hi,
No, this is not at all feasible as I tried to explain: the view has (and hence the advisor) has no idea that the view is stored in a view array. Think of it as follows: the view might be stored in different arrays by different propagators. So how could the view and hence the advisor know which array we talk about?
Cheers
Christian
--
Christian Schulte, <http://www.gecode.org/~schulte> www.gecode.org/~schulte
Professor of Computer Science, KTH, <mailto:cschulte at kth.se> cschulte at kth.se
Expert Researcher, SICS, <mailto:cschulte at sics.se> cschulte at sics.se
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf Of Valentin Lemière
Sent: Tuesday, November 10, 2015 05:20 PM
To: cschulte at kth.se
Cc: users at gecode.org
Subject: Re: [gecode-users] Advisor on a ViewArray and index of assigned variable
Hi,
I see, thanks for your answer.
When an Advisor is used on a BoolView it stores the type of assignment in the delta, which can be accessed with BoolView::one and ::zero.
But couldn't an Advisor, when applied to a ViewArray, store the index in the delta and then access it with ViewArray::index?
With the index I can get the assigned value but not the other way around.
It's not the case right now I understand, but do you think this is something feasible?
Regards,
Valentin
_____
De: "Christian Schulte" <cschulte at kth.se <mailto:cschulte at kth.se> >
À: "Valentin Lemière" <valentin.lemiere at unicaen.fr <mailto:valentin.lemiere at unicaen.fr> >, users at gecode.org <mailto:users at gecode.org>
Envoyé: Lundi 9 Novembre 2015 20:20:51
Objet: RE: [gecode-users] Advisor on a ViewArray and index of assigned variable
Hi,
An advisor subscribes to a particular variable implementation through a view hence, the only information that is available by default is which advisor is executed and what is the delta.
Additional information – such as the position of an advisor in a view array – must be explicitly stored in the advisor, there is no way around it.
Cheers
Christian
--
Christian Schulte, <http://www.gecode.org/~schulte> www.gecode.org/~schulte
Professor of Computer Science, KTH, <mailto:cschulte at kth.se> cschulte at kth.se
Expert Researcher, SICS, <mailto:cschulte at sics.se> cschulte at sics.se
From: users-bounces at gecode.org <mailto:users-bounces at gecode.org> [mailto:users-bounces at gecode.org] On Behalf Of Valentin Lemière
Sent: Monday, November 9, 2015 04:56 PM
To: users at gecode.org <mailto:users at gecode.org>
Subject: [gecode-users] Advisor on a ViewArray and index of assigned variable
Hello everyone,
I am a PhD. student and I am currently looking at Gecode to see if it'll fit my needs.
I need to implement a global constraint on a large number of boolean variables. So I have extended from NaryPropagator with a view of type BoolView.
When a variable is assigned, the propagator infers some knowledge and may assign other variable(s).
To get the required information, I added an Advisor to each variable, storing its index; so I can get it in the advise method and provide it to the propagator.
But this technique is too slow and creates too much advisors.
So I tried adding an Advisor directly to the ViewArray; the advise function is correctly called and I can still get whether the variable was assigned a zero or a one with the delta.
But I don't get the index information to find the actual assigned variable.
I looked for a static method of ViewArray to convert the delta to this information but couldn't find one.
Can an Advisor on a ViewArray get the index of the assigned variable?
Or is there another way to deal with a large number of variables other than an Advisor per variable?
Regards,
Valentin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20151110/16a3dd68/attachment-0001.html>
More information about the users
mailing list