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

Guido Tack tack at ps.uni-sb.de
Tue Jul 21 08:27:28 CEST 2009


Hi Kish,

do I understand you correctly, you want to first minimize one cost  
variable, and then (independently) minimize another?  I.e., when the  
first one is minimized, there's potentially still variables left that  
are not assigned, and then you branch over them, minimizing the  
other?  Or is the actual cost a function of more than one variable  
(say, a weighted sum or something like that)?
If it is the latter, you can (of course) just use a single cost  
variable and post constraints that implement the cost function.
But I assume it is more like the former.  In this case, I'm not sure  
it can be done with the current Gecode search engines.  You'd probably  
have to split the search, first minimizing the first cost, then  
setting up a new problem and minimizing the second variable.
Actually, the new problem might even use the same space (the one  
returned as the optimal solution), as long as you install a new  
branching for the remaining variables and tell the cost method to  
return the new cost variable.

Cheers,
	Guido

Kish Shen wrote:

> Hi,
>
> I am now trying to add support for the minimising search engines (BAB,
> Restart) to the ECLiPSe-Gecode interface I am developing.
>
> I think I can see how to implement the cost function, which is only
> given at run-time (with the limitation that the cost is a finite  
> domain
> variable, which has must have a vlaue assigned at the end of labelling
> all the variables specified in the search), *if* the search is done  
> only
> once:
>
> In the Space class I use, I have a IntVarArray (called vInt),
> representing the problem variables. To implement the cost variable, I
> add a Cost IntVar to the space, and when the search routine is  
> called, I
> post an additional constraint
>
> Cost = vInt[i]
>
> where vInt[i] is the problem variable that is defined to be the cost
> variable.
>
> The constrain/cost member function required can then perform the right
> action using the Cost variable.
>
> However, at the ECLiPSe level, I can perform more than one minimising
> search while solving a problem, with different cost variables (and
> persumably with a different set of problem variables). I am not sure  
> how
> I can do this with what I know of Gecode's search engine interface,  
> as I
> have already posted a constraint linking Cost to the vInt[i], cost
> vafriable for the previous search.
>
> Thanks in advance for any help/suggestion for how I can program this!
>
> 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