[gecode-users] users Digest, Vol 124, Issue 6

Juan Carlos Hernandez jchernandez.madrid at gmail.com
Mon Feb 1 18:24:34 CET 2016


Dear Alex and Christian,

thanks a lot! A very elegant solution - it works well, but I am now
battling with two problems

1. I get a segmentation fault when I try to run it in parallel mode (say,
using 8 threads). The error happens irregularly, but more often when I
increase the thread count. Here is what my constrain function looks like
for a maximization problem

virtual void constrain(const Space& _b){

const cpSolver& mycpSolver = static_cast<const cpSolver&>(_b);
rel(*this, objectives, IRT_GR, mycpSolver.objectives);

}

Since this does not really look like the other examples in the Gecode
manual, I guess that it is not correct. But I was unable to come up with
any other solution that rel would accept (that is, for which there is a
matching version of rel).

2. Ideally, I would like to have more than two objectives and have the
search to first try to maximize the first objective, then the second, etc.
But I do not manage, not matter which variable selection rule I use.
Typically, I get a little advancement in the first objective (say, it goes
from 0 to 1, and perhaps to two), and then the search makes progress on the
third or fourth objective in order.

Thanks,

JC


2016-01-29 12:15 GMT+01:00 Christian Schulte <cschulte at kth.se>:

> Alex is spot on here: but let me expand a little.
>
> You might have used the cost() member function for B&B. However the cost()
> member function is just implemented in terms of the constrain() member
> function. So what I would do is the following:
>  - Have a integer variable array cost containing the two cost variables you
> have in mind.
>  - implement a constrain(const Space& _b) member function: _b refers to the
> so-far best solution. Cast this to your script type, say b. Then this just
> posts
>         rel(*this, cost, IRT_LQ, b.cost);
>    This enforces that this->cost is lexicographically smaller then the so
> far best cost b.cost.
>
> That's it. More on the  constrain() function you can find in Chapter 2 of
> MPG.
>
> Cheers
> Christian
>
> --
> Christian Schulte, www.gecode.org/~schulte
> Professor of Computer Science, KTH, cschulte at kth.se
> Expert Researcher, SICS, cschulte at sics.se
>
>
> -----Original Message-----
> From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
> Of Alexander Schiendorfer
> Sent: Friday, January 29, 2016 12:06 PM
> To: users at gecode.org
> Subject: Re: [gecode-users] users Digest, Vol 124, Issue 6
>
> Hi Juan,
>
> it seems to me that you're searching for lexicographic branch-and-bound.
> There is a global constraint lex_lesseq that you might want to consider for
> posting in the constrain method of a Space.
>
> Cheers,
> Alex
>
> On 29.01.2016 12:00, users-request at gecode.org wrote:
> > Send users mailing list submissions to
> >       users at gecode.org
> >
> > To subscribe or unsubscribe via the World Wide Web, visit
> >       http://www.gecode.org/cgi-bin/mailman/listinfo/users
> > or, via email, send a message with subject or body 'help' to
> >       users-request at gecode.org
> >
> > You can reach the person managing the list at
> >       users-owner at gecode.org
> >
> > When replying, please edit your Subject line so it is more specific
> > than "Re: Contents of users digest..."
> >
> >
> > Today's Topics:
> >
> >     1. Best way to implement multi-criterion optimization     in Gecode?
> >        (Juan Carlos Hernandez)
> >
> >
> > ----------------------------------------------------------------------
> >
> > Message: 1
> > Date: Thu, 28 Jan 2016 12:30:54 +0100
> > From: Juan Carlos Hernandez <jchernandez.madrid at gmail.com>
> > To: users at gecode.org
> > Subject: [gecode-users] Best way to implement multi-criterion
> >       optimization    in Gecode?
> > Message-ID:
> >       <CAFd=
> f3EAU+XPqJo02KPT9SWibPjxkifw-F2so-4mE+x4Kv7Q5A at mail.gmail.com>
> > Content-Type: text/plain; charset="utf-8"
> >
> > Hi everyone,
> >
> >
> > I am trying to use Gecode to solve a multi-criterion problem
> >
> >
> > minimize        (F1(x,z), F2(x,z) )
> >
> > subject to       constraints on x,z
> >
> >
> > The objectives are ordered in order of importance, so I would like to
> > first solve the problem P1
> >
> >
> > minimize        F1(x,z)
> >
> > subject to       original constraints on x,z
> >
> >
> > and then consider the modified problem P2
> >
> >
> > minimize        F2(x,z)
> >
> > subject to      original constraints on x,z
> >
> >                          F1(x,z) = F1opt
> >
> >
> > where F1opt is the optimal value of P1.
> >
> >
> > What is the most efficient way to implement this in Gecode?
> >
> >
> >
> > I am now doing two completely separate searches, in the sense that I
> > create a new Space and run BAB on it for each of the problems. I am
> > sure that this cannot be the most efficient way of dealing with the
> > problem, but am unable to figure out how to do it "the right way".
> > Essentially, when solving P2 I should be able to make use of the work
> done
> while solving P1...
> >
> >
> > Any feedback is very much appreciated!
> >
> >
> > Thanks,
> >
> > JC
> > -------------- next part -------------- An HTML attachment was
> > scrubbed...
> > URL:
> > <http://www.gecode.org/pipermail/users/attachments/20160128/06e6ff75/a
> > ttachment-0001.html>
> >
> > ------------------------------
> >
> > _______________________________________________
> > Gecode users mailing list
> > users at gecode.org
> > https://www.gecode.org/mailman/listinfo/gecode-users
> >
> >
> > End of users Digest, Vol 124, Issue 6
> > *************************************
>
> --
> Alexander Schiendorfer, M.Sc.
> Institute for Software & Systems Engineering Raum 3043, Gebäude N
> Universität Augsburg
>
> Web:
>
> http://www.informatik.uni-augsburg.de/lehrstuehle/swt/se/staff/aschiendorfer
> /
> Tel.: +49 (821) 598 - 2196
> E-Mail: alexander.schiendorfer at informatik.uni-augsburg.de
>
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
>
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20160201/c76f6b07/attachment.html>


More information about the users mailing list