[gecode-users] doing multiple minimising searches with the same space

Christian Schulte cschulte at kth.se
Tue Jul 21 19:15:35 CEST 2009


Hi Kish,

That's indeed C++-ish: the meaning of the assignment is defined by the
assignment operator of the left hand side... For an IntView it's quite
simple: it just redirects the left hand side IntView to point to the
variable implementation of the right hand side. Whatever was on the left
hand side will be gone. Almost like in Eclipse provided the left hand side
was a yet unbound and unconstrained var. You might want to check Section 4.1
in MwG.

Is that an answer to your question?

Cheers
Christian

--
Christian Schulte, www.ict.kth.se/~cschulte/


-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Kish Shen
Sent: Tuesday, July 21, 2009 7:08 PM
To: Guido Tack
Cc: Christian Schulte; users at gecode.org
Subject: Re: [gecode-users] doing multiple minimising searches with the same
space

Guido Tack wrote:
> Christian Schulte wrote:
>> There is special support for specialized "constrain" functions which just
>> return a cost variable, you might want to check that in "Modeling with
>> Gecode". Rather than fixing a particular cost variable you can use a cost
>> function that then decides which variable to return depending on which 
>> cost
>> variable you want use now. Remember: any problem can be solved with one
>> additional level of indirection ;-)
> 
> Exactly!  You can even use actual assignment instead of an equality 
> constraint.  I.e., your space has a member "IntVar cost" that the cost 
> function returns.  When you initialize optimization for variable x, you 
> execute "space.cost = x" instead of posting the constraint "rel(space, 
> cost, IRT_EQ, x)".  That way, you can change that assignment later when 
> you start the next search!  You just have to make sure that you actually 
> do make such an assignment before you start search, and that you update 
> cost (as usual) in the copy constructor.
> 
> Cheers,
>     Guido
> 
Hi Christian and Guido,

Thanks for your replies!

I was looking at the "Modelling with Gecode", or at least an early 
version that Guido sent me. What I wasn't aware of was that you can do a 
simple assignment between two IntVars, as in "space.cost = x". This 
probably reflect my lack of knowledge in C++, but what exactly does such 
an assignment mean?

Thanks and cheers,

Kish


-- 
This e-mail may contain confidential and privileged material for the
sole use of the intended recipient. Any review, use, distribution or
disclosure by others is strictly prohibited. If you are not the intended
recipient (or authorized to receive for the recipient), please contact
the sender by reply e-mail and delete all copies of this message.
Cisco Systems Limited (Company Number: 02558939), is registered in
England and Wales with its registered office at 1 Callaghan Square,
Cardiff, South Glamorgan CF10 5BT.

_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users





More information about the gecode-users mailing list