[gecode-users] questions about ViewAdvisor

Mikael Zayenz Lagerkvist zayenz at gmail.com
Mon Dec 17 19:35:04 CET 2007


On Dec 17, 2007 7:19 PM, Pengyu Zhao <zpengyu at gmail.com> wrote:
> the advise() method declaration is:
>         advise(Space* home, Advisor* a, const Delta* d);
> One of parameter of advise() is "advisor* a", If all the advisors are
> ViewAdvisor<View>, how to fetch the "view" in ViewAdvisor by using the
> point "a"?

You can down-cast a to a ViewAdvisor, and the use the member-function
view(), as in the following snippet from
gecode/int/linear/bool-int.icc:
    ...
    ViewAdvisor<VX>* a = static_cast<ViewAdvisor<VX>*>(_a);
    if (n_s == 0)
      return ES_SUBSUMED_FIX(a,home,co);
    assert(!a->view().none());
    ...

Cheers,
Mikael

-- 
Mikael Zayenz Lagerkvist, http://www.ict.kth.se/~zayenz/




More information about the gecode-users mailing list