From rubyforge at lokorin.org Fri Apr 11 07:02:29 2008 From: rubyforge at lokorin.org (Andreas Launila) Date: Fri, 11 Apr 2008 13:02:29 +0200 Subject: [gecoder-devel] Simplifying the installation In-Reply-To: <479881FC.5040207@lokorin.org> References: <477EB20B.6080502@lokorin.org> <479881FC.5040207@lokorin.org> Message-ID: <47FF4545.8080609@lokorin.org> Andreas Launila wrote: > == Cross-compile Gecode > > This step produces the Gecode DLLs and include files. Those files are > already included in SVN, so this part should not be needed. > > Download and unpack the Gecode tarball[7] (Gecode/R is currently using > version 1.3.1). Use the following configuration (possibly with some > appropriate prefix). > > ./configure \ > --with-host-os=Windows \ > --host=i386-mingw32 \ > --build=i686-linux \ > --disable-examples > > Edit Makefile and add "--whole-archive" to DLLFLAGS, then run make. > > A number of DLLs should now have been created, copy them to > vendor/gecode/win32/lib in the Gecode/R dir. Copy the gecode folder (the > one containing all the headers) to vendor/gecode/win32/include. > You should also change ifeq "no" "yes" DLLTARGETS= \ in the Makefile to ifeq "yes" "yes" DLLTARGETS= \ to build the DLLs. There's probably some easier configuration flag to do that, but I haven't found it. -- Andreas Launila From zayenz at gmail.com Fri Apr 11 07:36:46 2008 From: zayenz at gmail.com (Mikael Zayenz Lagerkvist) Date: Fri, 11 Apr 2008 13:36:46 +0200 Subject: [gecoder-devel] Simplifying the installation In-Reply-To: <47FF4545.8080609@lokorin.org> References: <477EB20B.6080502@lokorin.org> <479881FC.5040207@lokorin.org> <47FF4545.8080609@lokorin.org> Message-ID: <63b5c8b00804110436k53988b8u46332a37e519b39e@mail.gmail.com> On Fri, Apr 11, 2008 at 1:02 PM, Andreas Launila wrote: > Andreas Launila wrote: > You should also change > > ifeq "no" "yes" > DLLTARGETS= \ > > in the Makefile to > > ifeq "yes" "yes" > DLLTARGETS= \ > > to build the DLLs. There's probably some easier configuration flag to do > that, but I haven't found it. This is controlled by the --enable-shared switch that configure uses. Cheers, Mikael Lagerkvist -- Mikael Zayenz Lagerkvist, http://www.ict.kth.se/~zayenz/ From rubyforge at lokorin.org Sat Apr 12 08:21:57 2008 From: rubyforge at lokorin.org (Andreas Launila) Date: Sat, 12 Apr 2008 14:21:57 +0200 Subject: [gecoder-devel] Syntax for extensional constraints Message-ID: <4800A965.3030305@lokorin.org> I would like to start adding support for extensional constraints[1]. The syntax for the tuple variant seems straightforward, but the DFA variant is not as simple. == Tuple variant It seems natural to use a form similar to the domain constraints for single variables. numbers.must_be.in tuple_set It would also seem natural to let tuple_set be any enumeration of integers or booleans (depending on whether the left hand side is an array of integer or boolean variables). The following would constrain the numbers to be a prime number < 10. numbers.must_be.in [2,3,5,7] == DFA variant It would probably be easiest to use MiniModel's regular expressions REG[2] to let the user define regular expressions, which are then converted to a DFA behind the scenes. I do not think that allowing the user to specify the DFA directly will add especially much. A way to make it familiar to Ruby-users would be to have a syntax similar to numbers.must.match regexp numbers.must =~ regexp where regexp is a regular expression for integers defined in some way. The least amount of work would be to more or less expose the REG operators directly. The following could then be how the regexp "(17 or, 1 followed by 5) any number of times, followed by 4711, repeated 3 to 17 times" would look. reg = ((regexp(17) | (regexp(1) + 5))* + 4711)[3,17] or (using multiple lines) tmp = regexp(1) + 5 reg = (regexp(17) | tmp)* reg += 4711 reg = reg[3,17] The most natural way would probably be to define it as a normal Ruby regexp (or just a string), which is then converted back to its source and reparsed for MiniModel. This will however not work by itself since the normal Ruby regexp is for characters, while we need a regexp for integers. I.e. %r{17} is a regexp for character '1' followed by character '7', while we might have meant the integer 17, or the integer 1 followed by 7. Adding some sort of delimiter to the string representation could be a possible solution. Using "," as delimiter would give the following. reg = /((17|1,5)*4711){3,17}/ One could also go a bit more verbose but readable route and eschew the string representation of regexps in favor of something similar to TextualRegexp[3]. The following could be how the regexp above would look. reg = regexp do repeat(3..17) do at_least_zero do any :of do integer 17 group{ integer 1; integer 5 } end end integer 4711 end end It seems to be a bit too much on the verbose side. TextualRegexp was however designed for character regexps, so one might be able to slim it down a bit by using the assumption that only integers are used and that some functionality isn't included (although one could add sugar for things such as "maybe"). It would also seem reasonable to have a look at examples where the constraint is used in practice (such as [4] and [5]) and ensure that those parts of the examples translate well. [1] http://www.gecode.org/gecode-doc-latest/group__TaskModelIntExt.html [2] http://www.gecode.org/gecode-doc-latest/classGecode_1_1REG.html [3] http://rubyforge.org/projects/texrex/ [4] http://www.gecode.org/gecode-doc-latest/classPentominoes.html [5] http://www.gecode.org/gecode-doc-latest/classNonogram.html -- Andreas Launila