[gecode-users] Creating a function to solve CP sub-problem instances

Christian Schulte cschulte at kth.se
Mon Sep 22 14:42:14 CEST 2014


Hi Nathan,

 

I think the easiest way is to use a search engine directly as explained in
Sections  2.2, 2.5, and 9.3: they return an object that represents the
solution. Then you can do with that solution whatever you want!

 

You see I am still not really on board here, I do not see where the problem
is as you can define in fact that your script has whatever methods you
want...

 

Cheers

Christian

 

--

Christian Schulte, Professor of Computer Science, KTH,
www.gecode.org/~schulte/

 

From: Nathan Horvath [mailto:ngh423 at hotmail.com] 
Sent: Thursday, September 18, 2014 6:13 PM
To: cschulte at kth.se; users at gecode.org
Subject: RE: [gecode-users] Creating a function to solve CP sub-problem
instances

 

Hi Christian,

 

I should clarify, when I mention script in my original email, I mean an
individual file that solves an instance of my sub-problem given particular
data. I want to integrate this with other code of mine so that when the
optimal solution is found, it is not just printed to the screen, but ideally
stored in a structure of my own creation. What I want to know is where I
should be looking to implement this: is this done in my file where I defined
my constraint problem?, or do I need to make changes elsewhere in the source
code? From the examples I've seen, every single one has simply printed an
optimal solution without doing anything more, while I want to store it for
later purposes and solve another CP of the same structure with different
data.

 

Thanks,

Nathan

  _____  

From: cschulte at kth.se
To: ngh423 at hotmail.com; users at gecode.org
Subject: RE: [gecode-users] Creating a function to solve CP sub-problem
instances
Date: Mon, 15 Sep 2014 11:49:07 +0200

Hi,

 

The setup is that a script must be a sub-class of Gecode::Space. However,
you can pass these objects around, so I do not really see where the problem
is, sorry. 

 

Cheers

Christian

 

--

Christian Schulte, Professor of Computer Science, KTH,
www.gecode.org/~schulte/

 

From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Nathan Horvath
Sent: Tuesday, September 09, 2014 8:45 PM
To: users at gecode.org
Subject: [gecode-users] Creating a function to solve CP sub-problem
instances

 

Hi,

 

I'm trying to implement a tabu search algorithm that involves solving small
constraint programming sub-problems. Firstly, I used the examples found in
the Modelling and Programming Guide to develop a script to solve an instance
of a sub-problem. Now, I'm looking to expand upon this by creating a
function that consumes data to solve a sub-problem, solve it using Gecode,
and then return an optimal solution to the sub-problem in a some data
structure.

 

I'm having problems trying to turn my script into a callable function. Given
from what I've seen in the guide, it seems like it is not possible, or it's
taken as something trivial and is not glossed over, as I haven't found any
similar examples after searching on-line. What I started to do was play
around with the print function (same layout as in the SEND MOST MONEY
examples in the guide) and try replacing it with a function that interprets
the solution, but I've had no luck.

 

One could classify my experience with Gecode and C++ as very beginner (I
picked up C++ so I could use Gecode's capabilities), so I apologize if this
question comes off as ignorant or out of scope. Any help would be greatly
appreciated.

 

Cheers,

Nathan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20140922/93b90a03/attachment.html>


More information about the users mailing list