From aaron.feng at gmail.com Mon Jul 2 12:20:21 2007
From: aaron.feng at gmail.com (Aaron Feng)
Date: Mon, 2 Jul 2007 12:20:21 -0400
Subject: [gecoder-users] gecode/r
Message-ID: <4e3934860707020920x32980b0ch649341f9b101f3a5@mail.gmail.com>
Andreas,
I stumbled on your project when I recently discovered constraint
programming. I know this project was recently started under google's SOC.
When do you think you'll have a version ready to play around with?
Aaron
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/gecoder-users/attachments/20070702/241b2727/attachment.html
From rubyforge at lokorin.org Mon Jul 2 13:08:40 2007
From: rubyforge at lokorin.org (Andreas Launila)
Date: Mon, 02 Jul 2007 19:08:40 +0200
Subject: [gecoder-users] gecode/r
In-Reply-To: <4e3934860707020920x32980b0ch649341f9b101f3a5@mail.gmail.com>
References: <4e3934860707020920x32980b0ch649341f9b101f3a5@mail.gmail.com>
Message-ID: <46893118.401@lokorin.org>
Aaron Feng wrote:
> When do you think you'll have a version ready to play around with?
Version 0.3.0 (which is currently available, see the installation
instructions[1] for more information) contains a limited set of
functionality, but has enough to solve simple problems[2]. A version
that supports most of the finite domain integer constraints in Gecode
will probably be available tomorrow.
[1] http://gecoder.rubyforge.org/installation.html
[2] http://gecoder.rubyforge.org/examples.html
--
Andreas Launila
From aaron.feng at gmail.com Mon Jul 2 13:21:19 2007
From: aaron.feng at gmail.com (Aaron Feng)
Date: Mon, 2 Jul 2007 13:21:19 -0400
Subject: [gecoder-users] gecode/r
In-Reply-To: <46893118.401@lokorin.org>
References: <4e3934860707020920x32980b0ch649341f9b101f3a5@mail.gmail.com>
<46893118.401@lokorin.org>
Message-ID: <4e3934860707021021l5afdf231y2db06f3cf507e0d5@mail.gmail.com>
Thanks, looking forward to play around with it.
Aaron
On 7/2/07, Andreas Launila wrote:
>
> Aaron Feng wrote:
> > When do you think you'll have a version ready to play around with?
>
> Version 0.3.0 (which is currently available, see the installation
> instructions[1] for more information) contains a limited set of
> functionality, but has enough to solve simple problems[2]. A version
> that supports most of the finite domain integer constraints in Gecode
> will probably be available tomorrow.
>
> [1] http://gecoder.rubyforge.org/installation.html
> [2] http://gecoder.rubyforge.org/examples.html
>
> --
> Andreas Launila
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/gecoder-users/attachments/20070702/5c6280a2/attachment.html
From aaron.feng at gmail.com Mon Jul 2 19:33:32 2007
From: aaron.feng at gmail.com (Aaron Feng)
Date: Mon, 2 Jul 2007 19:33:32 -0400
Subject: [gecoder-users] gecode/r
In-Reply-To: <4e3934860707021021l5afdf231y2db06f3cf507e0d5@mail.gmail.com>
References: <4e3934860707020920x32980b0ch649341f9b101f3a5@mail.gmail.com>
<46893118.401@lokorin.org>
<4e3934860707021021l5afdf231y2db06f3cf507e0d5@mail.gmail.com>
Message-ID: <4e3934860707021633t363f90faua68c3affb8300915@mail.gmail.com>
I have successfully installed gecode on Mac OSX running ruby 1.8.
However I'm getting the following error when I tried to require
gecoder:
irb(main):002:0> require 'gecoder'
dyld: NSLinkModule() error
dyld: Symbol not found: __ZNK6Gecode9Exception4whatEv
Referenced from:
/usr/local/lib/ruby/gems/1.8/gems/gecoder-0.3.0/lib/gecode.bundle
Expected in: flat namespace
Thanks,
Aaron
On 7/2/07, Aaron Feng wrote:
> Thanks, looking forward to play around with it.
>
> Aaron
>
>
> On 7/2/07, Andreas Launila wrote:
> > Aaron Feng wrote:
> > > When do you think you'll have a version ready to play around with?
> >
> > Version 0.3.0 (which is currently available, see the installation
> > instructions[1] for more information) contains a limited set of
> > functionality, but has enough to solve simple problems[2]. A version
> > that supports most of the finite domain integer constraints in Gecode
> > will probably be available tomorrow.
> >
> > [1] http://gecoder.rubyforge.org/installation.html
> > [2] http://gecoder.rubyforge.org/examples.html
> >
> > --
> > Andreas Launila
> >
>
>
From rubyforge at lokorin.org Tue Jul 3 05:39:38 2007
From: rubyforge at lokorin.org (Andreas Launila)
Date: Tue, 03 Jul 2007 11:39:38 +0200
Subject: [gecoder-users] gecode/r
In-Reply-To: <4e3934860707021633t363f90faua68c3affb8300915@mail.gmail.com>
References: <4e3934860707020920x32980b0ch649341f9b101f3a5@mail.gmail.com> <46893118.401@lokorin.org> <4e3934860707021021l5afdf231y2db06f3cf507e0d5@mail.gmail.com>
<4e3934860707021633t363f90faua68c3affb8300915@mail.gmail.com>
Message-ID: <468A195A.5010604@lokorin.org>
Aaron Feng wrote:
> I have successfully installed gecode on Mac OSX running ruby 1.8.
> However I'm getting the following error when I tried to require
> gecoder:
>
> irb(main):002:0> require 'gecoder'
> dyld: NSLinkModule() error
> dyld: Symbol not found: __ZNK6Gecode9Exception4whatEv
> Referenced from:
> /usr/local/lib/ruby/gems/1.8/gems/gecoder-0.3.0/lib/gecode.bundle
> Expected in: flat namespace
>
Do the gecode examples work (for instance running
/examples/money )?
Was there anything beyond warnings during the installation of the gem?
I don't have access to a OSX machine, but I will ask around and see if I
can find someone who has successfully installed Gecode/R on one.
--
Andreas Launila
From rubyforge at lokorin.org Tue Jul 3 09:02:12 2007
From: rubyforge at lokorin.org (Andreas Launila)
Date: Tue, 03 Jul 2007 15:02:12 +0200
Subject: [gecoder-users] gecode/r
In-Reply-To: <468A195A.5010604@lokorin.org>
References: <4e3934860707020920x32980b0ch649341f9b101f3a5@mail.gmail.com> <46893118.401@lokorin.org> <4e3934860707021021l5afdf231y2db06f3cf507e0d5@mail.gmail.com> <4e3934860707021633t363f90faua68c3affb8300915@mail.gmail.com>
<468A195A.5010604@lokorin.org>
Message-ID: <468A48D4.9060806@lokorin.org>
Andreas Launila wrote:
> I don't have access to a OSX machine, but I will ask around and see if I
> can find someone who has successfully installed Gecode/R on one.
>
I have found a person who has successfully installed Gecode/R (from the
0.3.0 gem) under OSX, so it's at least not impossible. He compiled both
Ruby and gecode from source, so if you didn't compile gecode from source
then that might be worth a try.
--
Andreas Launila
From rubyforge at lokorin.org Tue Jul 3 11:53:32 2007
From: rubyforge at lokorin.org (Andreas Launila)
Date: Tue, 03 Jul 2007 17:53:32 +0200
Subject: [gecoder-users] [ANN] Gecode/R 0.4.0
Message-ID: <468A70FC.8050304@lokorin.org>
Gecode/R 0.4.0 has been released.
The new release adds support for most of the integer variable
constraints supported by Gecode. The integer constraints currently
missing are general cardinality constraints, scheduling constraints and
regular constraints. If you're missing some other integer constraint
then please ask, chances are that we have missed it.
The basics of the new constraints should be covered on the website[1],
you might however need to refresh some pages. Some new examples:
sudoku[2] and magic sequence[3] have also been added.
Please ask questions and give feedback. Nothing is set in stone,
everything can be changed.
== Changes (since 0.3.0) ==
* [#11861] Fixed a bug stopping the creating of int variables with
non-range domains.
* Added domain constraints for int variables.
* Added equality constraint for int enums.
* Matrices of integer and boolean variables can now be created using
Model#int_var_matrix Model#bool_var_matrix.
* Added channel constraint for int enums.
* Added element constraints (variable array access).
* Added count constraints.
* Added sortedness constraints.
* Added arithmetic constraints (min, max, abs and variable multiplication).
[1] http://gecoder.rubyforge.org/documentation/integer-constraints.html
[2] http://gecoder.rubyforge.org/examples/sudoku.html
[3] http://gecoder.rubyforge.org/examples/magic-sequence.html
From aaron.feng at gmail.com Tue Jul 3 13:49:18 2007
From: aaron.feng at gmail.com (Aaron Feng)
Date: Tue, 3 Jul 2007 13:49:18 -0400
Subject: [gecoder-users] gecode/r
In-Reply-To: <468A48D4.9060806@lokorin.org>
References: <4e3934860707020920x32980b0ch649341f9b101f3a5@mail.gmail.com>
<46893118.401@lokorin.org>
<4e3934860707021021l5afdf231y2db06f3cf507e0d5@mail.gmail.com>
<4e3934860707021633t363f90faua68c3affb8300915@mail.gmail.com>
<468A195A.5010604@lokorin.org> <468A48D4.9060806@lokorin.org>
Message-ID: <4e3934860707031049o7315528ehd0ababc657418aad@mail.gmail.com>
I installed the Mac OSX Gecode-1.3.1.dmg and I'm running OSX 10.4.9.
The disk image installed gecode in the following location:
/Library/Frameworks/gecode.framework
/Library/Java/Extensions/libgecodej*.jnilib
/Library/Java/Extensions/GecodeJ.jar
/Library/Documentation/Help/Gecode.help
/Library/Documentation/Help/GecodeJ.help
There were no errors when I did gem install gecoder:
Bulk updating Gem source index for: http://gems.rubyforge.org
Building native extensions. This could take a while...
ruby extconf.rb install gecoder
checking for main() in -lgecodeint... no
checking for main() in -lgecodekernel... no
checking for main() in -lgecodeminimodel... no
checking for main() in -lgecodesearch... no
checking for main() in -lgecodeset... no
checking for #include
... yes
checking for #include
... yes
creating Makefile
make
g++ -I. -I. -I/usr/local/lib/ruby/1.8/i686-darwin8.8.3 -I.
-I/usr/local/lib/ruby/gems/1.8/gems/gecoder-0.4.0/vendor/rust/include
-I/usr/local/lib/ruby/gems/1.8/gems/gecoder-0.4.0/ext -fno-common -g
-O2 -pipe -fno-common -c gecode.cc
g++ -I. -I. -I/usr/local/lib/ruby/1.8/i686-darwin8.8.3 -I.
-I/usr/local/lib/ruby/gems/1.8/gems/gecoder-0.4.0/vendor/rust/include
-I/usr/local/lib/ruby/gems/1.8/gems/gecoder-0.4.0/ext -fno-common -g
-O2 -pipe -fno-common -c missing.cpp
g++ -I. -I. -I/usr/local/lib/ruby/1.8/i686-darwin8.8.3 -I.
-I/usr/local/lib/ruby/gems/1.8/gems/gecoder-0.4.0/vendor/rust/include
-I/usr/local/lib/ruby/gems/1.8/gems/gecoder-0.4.0/ext -fno-common -g
-O2 -pipe -fno-common -c vararray.cpp
cc -dynamic -bundle -undefined suppress -flat_namespace
-L"/usr/local/lib" -o gecode.bundle gecode.o missing.o vararray.o
-lpthread -ldl -lobjc
make install
/usr/bin/install -c -m 0755 gecode.bundle
/usr/local/lib/ruby/gems/1.8/gems/gecoder-0.4.0/lib
make clean
Successfully installed gecoder-0.4.0
On 7/3/07, Andreas Launila wrote:
> Andreas Launila wrote:
> > I don't have access to a OSX machine, but I will ask around and see if I
> > can find someone who has successfully installed Gecode/R on one.
> >
>
> I have found a person who has successfully installed Gecode/R (from the
> 0.3.0 gem) under OSX, so it's at least not impossible. He compiled both
> Ruby and gecode from source, so if you didn't compile gecode from source
> then that might be worth a try.
>
> --
> Andreas Launila
>
From rubyforge at lokorin.org Tue Jul 3 14:18:23 2007
From: rubyforge at lokorin.org (Andreas Launila)
Date: Tue, 03 Jul 2007 20:18:23 +0200
Subject: [gecoder-users] gecode/r
In-Reply-To: <4e3934860707031049o7315528ehd0ababc657418aad@mail.gmail.com>
References: <4e3934860707020920x32980b0ch649341f9b101f3a5@mail.gmail.com> <46893118.401@lokorin.org> <4e3934860707021021l5afdf231y2db06f3cf507e0d5@mail.gmail.com> <4e3934860707021633t363f90faua68c3affb8300915@mail.gmail.com> <468A195A.5010604@lokorin.org>
<468A48D4.9060806@lokorin.org>
<4e3934860707031049o7315528ehd0ababc657418aad@mail.gmail.com>
Message-ID: <468A92EF.4080908@lokorin.org>
Does compiling Gecode from the source code make any difference?
--
Andreas Launila
Aaron Feng wrote:
> I installed the Mac OSX Gecode-1.3.1.dmg and I'm running OSX 10.4.9.
> The disk image installed gecode in the following location:
>
From aaron.feng at gmail.com Tue Jul 3 14:35:46 2007
From: aaron.feng at gmail.com (Aaron Feng)
Date: Tue, 3 Jul 2007 14:35:46 -0400
Subject: [gecoder-users] gecode/r
In-Reply-To: <468A92EF.4080908@lokorin.org>
References: <4e3934860707020920x32980b0ch649341f9b101f3a5@mail.gmail.com>
<46893118.401@lokorin.org>
<4e3934860707021021l5afdf231y2db06f3cf507e0d5@mail.gmail.com>
<4e3934860707021633t363f90faua68c3affb8300915@mail.gmail.com>
<468A195A.5010604@lokorin.org> <468A48D4.9060806@lokorin.org>
<4e3934860707031049o7315528ehd0ababc657418aad@mail.gmail.com>
<468A92EF.4080908@lokorin.org>
Message-ID: <4e3934860707031135n75ecb79fk5104e1ae7eb24c98@mail.gmail.com>
Nope, the same error.
On 7/3/07, Andreas Launila wrote:
> Does compiling Gecode from the source code make any difference?
>
> --
> Andreas Launila
>
> Aaron Feng wrote:
> > I installed the Mac OSX Gecode-1.3.1.dmg and I'm running OSX 10.4.9.
> > The disk image installed gecode in the following location:
> >
>
>
From aaron.feng at gmail.com Tue Jul 3 14:39:44 2007
From: aaron.feng at gmail.com (Aaron Feng)
Date: Tue, 3 Jul 2007 14:39:44 -0400
Subject: [gecoder-users] gecode/r
In-Reply-To: <4e3934860707031135n75ecb79fk5104e1ae7eb24c98@mail.gmail.com>
References: <4e3934860707020920x32980b0ch649341f9b101f3a5@mail.gmail.com>
<46893118.401@lokorin.org>
<4e3934860707021021l5afdf231y2db06f3cf507e0d5@mail.gmail.com>
<4e3934860707021633t363f90faua68c3affb8300915@mail.gmail.com>
<468A195A.5010604@lokorin.org> <468A48D4.9060806@lokorin.org>
<4e3934860707031049o7315528ehd0ababc657418aad@mail.gmail.com>
<468A92EF.4080908@lokorin.org>
<4e3934860707031135n75ecb79fk5104e1ae7eb24c98@mail.gmail.com>
Message-ID: <4e3934860707031139g274a0fc9u468c88ac2a2650be@mail.gmail.com>
I tried to reinstall gecoder again, after I compiled gecode from
souce. This time it worked!
On 7/3/07, Aaron Feng wrote:
> Nope, the same error.
>
> On 7/3/07, Andreas Launila wrote:
> > Does compiling Gecode from the source code make any difference?
> >
> > --
> > Andreas Launila
> >
> > Aaron Feng wrote:
> > > I installed the Mac OSX Gecode-1.3.1.dmg and I'm running OSX 10.4.9.
> > > The disk image installed gecode in the following location:
> > >
> >
> >
>
From aaron.feng at gmail.com Tue Jul 3 17:39:22 2007
From: aaron.feng at gmail.com (Aaron Feng)
Date: Tue, 3 Jul 2007 17:39:22 -0400
Subject: [gecoder-users] operation types
Message-ID: <4e3934860707031439r6bc6be26ue7817bb0d90f6bb2@mail.gmail.com>
I noticed there are only 3 supported operation types: +, -, * . Why
not also / ? I'm trying to write a sample program that solves this
following:
A/BC + D/EF + G/HI = 1
Aaron
From rubyforge at lokorin.org Wed Jul 4 05:51:24 2007
From: rubyforge at lokorin.org (Andreas Launila)
Date: Wed, 04 Jul 2007 11:51:24 +0200
Subject: [gecoder-users] operation types
In-Reply-To: <4e3934860707031439r6bc6be26ue7817bb0d90f6bb2@mail.gmail.com>
References: <4e3934860707031439r6bc6be26ue7817bb0d90f6bb2@mail.gmail.com>
Message-ID: <468B6D9C.6060701@lokorin.org>
Aaron Feng wrote:
> I noticed there are only 3 supported operation types: +, -, * . Why
> not also / ?
Mostly because there hasn't been time to implement it yet. (x / y).must
== 1 (where both are int variables) would be implemented as sugar for
writing
x.must == y*c + r
r.must < y
c.must == 1
But the first line requires some sugar that hasn't been implemented yet
(mixing variable multipication with linear constraints). So it has to be
rewritten as
(c*y).must == tmp
x.must == tmp + r
r.must < y
c.must == 1
A more complete example:
require 'rubygems'
require 'gecoder'
class Division < Gecode::Model
def initialize(result)
c,y,x,tmp,r = @vars = int_var_array(5, 0..9)
# The division constraints
(c*y).must == tmp
x.must == tmp + r
r.must < y
c.must == result
# We don't want division by 0.
y.must_not == 0
branch_on wrap_enum([x,y])
end
def to_s
"#{@vars[2].val} / #{@vars[1].val} = #{@vars[0].val}"
end
end
Division.new(3).each_solution{ |s| puts s.to_s }
Output:
3 / 1 = 3
6 / 2 = 3
7 / 2 = 3
9 / 3 = 3
Note that this performs integer division.
> I'm trying to write a sample program that solves this following:
>
> A/BC + D/EF + G/HI = 1
>
I'm assuming all the letters are variables. To avoid having to do the
above rewriting too many times one could implement it as a method.
def div(dividend, divisor)
c,tmp,r = int_var_array(3, some_domain)
(c*divisor).must == tmp
dividend.must == tmp + r
r.must < divisor
return c
end
And then take the variable multiplications (BC, EF, HI) separatly ending
with "(div(a, b_and_c) + div(d, e_and_f) + div(g, h_and_i)).must == 1".
--
Andreas Launila
From rubyforge at lokorin.org Wed Jul 4 07:13:00 2007
From: rubyforge at lokorin.org (Andreas Launila)
Date: Wed, 04 Jul 2007 13:13:00 +0200
Subject: [gecoder-users] operation types
In-Reply-To: <468B6D9C.6060701@lokorin.org>
References: <4e3934860707031439r6bc6be26ue7817bb0d90f6bb2@mail.gmail.com>
<468B6D9C.6060701@lokorin.org>
Message-ID: <468B80BC.6090703@lokorin.org>
Andreas Launila wrote:
> Aaron Feng wrote:
>> I noticed there are only 3 supported operation types: +, -, * . Why
>> not also / ?
>
> Mostly because there hasn't been time to implement it yet. (x / y).must
> == 1 (where both are int variables) would be implemented as sugar for
> writing
>
> x.must == y*c + r
> r.must < y
> c.must == 1
>
And in the above case there's no real point in c being a variable, so we
would replace it with 1.
--
Andreas Launila
From aaron.feng at gmail.com Wed Jul 4 09:55:38 2007
From: aaron.feng at gmail.com (Aaron Feng)
Date: Wed, 4 Jul 2007 09:55:38 -0400
Subject: [gecoder-users] operation types
In-Reply-To: <468B80BC.6090703@lokorin.org>
References: <4e3934860707031439r6bc6be26ue7817bb0d90f6bb2@mail.gmail.com>
<468B6D9C.6060701@lokorin.org> <468B80BC.6090703@lokorin.org>
Message-ID: <4e3934860707040655s700b56dapcd1d3bc465a76a2d@mail.gmail.com>
> x.must == y*c + r
My math isn't so good, but maybe I'm missing something.
Above represents x/y = c, so what is r and why is it needed?
> Division.new(3).each_solution{ |s| puts s.to_s }
> 7 / 2 = 3
This is a valid output?
Aaron
On 7/4/07, Andreas Launila wrote:
>
> Andreas Launila wrote:
> > Aaron Feng wrote:
> >> I noticed there are only 3 supported operation types: +, -, * . Why
> >> not also / ?
> >
> > Mostly because there hasn't been time to implement it yet. (x / y).must
> > == 1 (where both are int variables) would be implemented as sugar for
> > writing
> >
>
> > r.must < y
> > c.must == 1
> >
>
> And in the above case there's no real point in c being a variable, so we
> would replace it with 1.
>
> --
> Andreas Launila
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/gecoder-users/attachments/20070704/5eeba161/attachment.html
From rubyforge at lokorin.org Wed Jul 4 10:04:51 2007
From: rubyforge at lokorin.org (Andreas Launila)
Date: Wed, 04 Jul 2007 16:04:51 +0200
Subject: [gecoder-users] operation types
In-Reply-To: <4e3934860707040655s700b56dapcd1d3bc465a76a2d@mail.gmail.com>
References: <4e3934860707031439r6bc6be26ue7817bb0d90f6bb2@mail.gmail.com> <468B6D9C.6060701@lokorin.org>
<468B80BC.6090703@lokorin.org>
<4e3934860707040655s700b56dapcd1d3bc465a76a2d@mail.gmail.com>
Message-ID: <468BA903.9010601@lokorin.org>
Aaron Feng wrote:
>> x.must == y*c + r
>
> My math isn't so good, but maybe I'm missing something.
> Above represents x/y = c, so what is r and why is it needed?
>
It's the remainder ( http://en.wikipedia.org/wiki/Remainder ).
>> Division.new(3).each_solution{ |s| puts s.to_s }
>> 7 / 2 = 3
>
> This is a valid output?
>
It is if our only requirement is the the quotient is 3 (i.e. integer
division, if you enter 7/2 in irb then Ruby will also give 3). We could
have the additional requirement that the remainder must be 0, in which
case we can remove r (in that case 7/2 will no longer be a solution).
--
Andreas Launila
From aaron.feng at gmail.com Wed Jul 4 10:21:25 2007
From: aaron.feng at gmail.com (Aaron Feng)
Date: Wed, 4 Jul 2007 10:21:25 -0400
Subject: [gecoder-users] operation types
In-Reply-To: <468BA903.9010601@lokorin.org>
References: <4e3934860707031439r6bc6be26ue7817bb0d90f6bb2@mail.gmail.com>
<468B6D9C.6060701@lokorin.org> <468B80BC.6090703@lokorin.org>
<4e3934860707040655s700b56dapcd1d3bc465a76a2d@mail.gmail.com>
<468BA903.9010601@lokorin.org>
Message-ID: <4e3934860707040721r394a851ay4b3884fbc139d63d@mail.gmail.com>
Sorry I didn't communicate that the reminder should be zero.
Thanks again.
Aaron
On 7/4/07, Andreas Launila wrote:
> Aaron Feng wrote:
> >> x.must == y*c + r
> >
> > My math isn't so good, but maybe I'm missing something.
> > Above represents x/y = c, so what is r and why is it needed?
> >
>
> It's the remainder ( http://en.wikipedia.org/wiki/Remainder ).
>
> >> Division.new(3).each_solution{ |s| puts s.to_s }
> >> 7 / 2 = 3
> >
> > This is a valid output?
> >
>
> It is if our only requirement is the the quotient is 3 (i.e. integer
> division, if you enter 7/2 in irb then Ruby will also give 3). We could
> have the additional requirement that the remainder must be 0, in which
> case we can remove r (in that case 7/2 will no longer be a solution).
>
> --
> Andreas Launila
>
From aaron.feng at gmail.com Wed Jul 4 23:37:43 2007
From: aaron.feng at gmail.com (Aaron Feng)
Date: Wed, 4 Jul 2007 23:37:43 -0400
Subject: [gecoder-users] operation types
In-Reply-To: <4e3934860707040721r394a851ay4b3884fbc139d63d@mail.gmail.com>
References: <4e3934860707031439r6bc6be26ue7817bb0d90f6bb2@mail.gmail.com>
<468B6D9C.6060701@lokorin.org> <468B80BC.6090703@lokorin.org>
<4e3934860707040655s700b56dapcd1d3bc465a76a2d@mail.gmail.com>
<468BA903.9010601@lokorin.org>
<4e3934860707040721r394a851ay4b3884fbc139d63d@mail.gmail.com>
Message-ID: <4e3934860707042037w35c12a81t8894d2576a0efa12@mail.gmail.com>
Andreas,
Your suggestions are helpful, however, I'm still struggling a little
bit with the problem I'm trying to solve. Let me re-iterate the
problem for clarity and completeness.
A/BC + D/EF + G/HI = 1
Where two variable next to each other is equivalent to 10 * variable1
+ variable2. For example, BC is equal to 10 * B + C. All numbers
must be unique and within the range 1..9.
Here is what I have so far, however, it doesn't work:
require 'rubygems'
require 'gecoder'
class Division < Gecode::Model
def initialize
a, b, c, d, e, f, g, h, i = @variables = int_var_array(9, 1..9)
(div(a, b, c) + div(d, e, f) + div(g, h, i)).must == 1
@variables.must_be.distinct
branch_on wrap_enum([a,b,c,d,e,f,g,h,i])
end
def to_s
"#{@variables[0].val} / #{@variables[1].val} #{@variables[2].val} +
#{@variables[3].val} / #{@variables[4].val} #{@variables[5].val} +
#{@variables[6].val} / #{@variables[7].val} #{@variables[8].val} = 1"
end
private
def div(dividend, *divisor)
tmp1 = divisor[0] * 10
tmp2 = tmp1 + divisor[1]
return tmp2
end
end
puts Division.new.solve!.to_s
Aaron
From rubyforge at lokorin.org Thu Jul 5 05:16:38 2007
From: rubyforge at lokorin.org (Andreas Launila)
Date: Thu, 05 Jul 2007 11:16:38 +0200
Subject: [gecoder-users] operation types
In-Reply-To: <4e3934860707042037w35c12a81t8894d2576a0efa12@mail.gmail.com>
References: <4e3934860707031439r6bc6be26ue7817bb0d90f6bb2@mail.gmail.com> <468B6D9C.6060701@lokorin.org>
<468B80BC.6090703@lokorin.org> <4e3934860707040655s700b56dapcd1d3bc465a76a2d@mail.gmail.com> <468BA903.9010601@lokorin.org> <4e3934860707040721r394a851ay4b3884fbc139d63d@mail.gmail.com>
<4e3934860707042037w35c12a81t8894d2576a0efa12@mail.gmail.com>
Message-ID: <468CB6F6.6010704@lokorin.org>
Aaron Feng wrote:
> Here is what I have so far, however, it doesn't work:
>
> [...]
>
> def div(dividend, *divisor)
> tmp1 = divisor[0] * 10
> tmp2 = tmp1 + divisor[1]
> return tmp2
> end
>
The lack of use of dividend in that method seems suspicious. An
additional tip is that linear expressions (i.e. without variable
multiplication) can be written without using temporary variables, so the
code in the method should work with
complete_divisor.must == divisor[0]*10 + divisor[1]
(complete_divisor * quotient).must == dividend
return quotient
where complete_divisor and quotient are integer variables created in
that method.
--
Andreas Launila
From rubyforge at lokorin.org Thu Jul 5 05:35:54 2007
From: rubyforge at lokorin.org (Andreas Launila)
Date: Thu, 05 Jul 2007 11:35:54 +0200
Subject: [gecoder-users] operation types
In-Reply-To: <4e3934860707042037w35c12a81t8894d2576a0efa12@mail.gmail.com>
References: <4e3934860707031439r6bc6be26ue7817bb0d90f6bb2@mail.gmail.com> <468B6D9C.6060701@lokorin.org>
<468B80BC.6090703@lokorin.org> <4e3934860707040655s700b56dapcd1d3bc465a76a2d@mail.gmail.com> <468BA903.9010601@lokorin.org> <4e3934860707040721r394a851ay4b3884fbc139d63d@mail.gmail.com>
<4e3934860707042037w35c12a81t8894d2576a0efa12@mail.gmail.com>
Message-ID: <468CBB7A.9080607@lokorin.org>
Aaron Feng wrote:
> Your suggestions are helpful, however, I'm still struggling a little
> bit with the problem I'm trying to solve. Let me re-iterate the
> problem for clarity and completeness.
>
> A/BC + D/EF + G/HI = 1
>
> Where two variable next to each other is equivalent to 10 * variable1
> + variable2. For example, BC is equal to 10 * B + C. All numbers
> must be unique and within the range 1..9.
>
That problem doesn't have a solution if remainders after each division
must be 0. Each term will end up as a positive integer since only
positive numbers are allowed. Since the remainder must be 0 each term
will at least be 1, meaning that the sum must at least be 3.
I'm suspecting that the problem at least requires taking remainders into
consideration. To avoid the whole problem with division I would suggest
you to rewrite the problem so that you don't have to deal with division
at all (multiplying all terms with BC * EF * HI) and then solve the
rewritten problem instead.
--
Andreas Launila
From rubyforge at lokorin.org Wed Jul 11 14:30:17 2007
From: rubyforge at lokorin.org (Andreas Launila)
Date: Wed, 11 Jul 2007 20:30:17 +0200
Subject: [gecoder-users] [ANN] Gecode/R 0.5.0
Message-ID: <469521B9.5080804@lokorin.org>
Gecode/R 0.5.0 has been released.
It adds set variables and some of their constraints[2], along with the
last of the boolean constraints[1].
== Changes (since 0.4.0) ==
* Added exclusive or and implication.
* Added conjunction and disjunction for boolean enumerations.
* Added set variables. They are created using Model{#set_var,
#set_var_array, #set_var_matrix}.
* Added domain constraints for set variables.
* Added relation constraints for set variables.
* Added set cardinality constraints.
[1] http://gecoder.rubyforge.org/documentation/boolean-constraints.html
[2] http://gecoder.rubyforge.org/documentation/set-constraints.html
--
Andreas Launila
From rubyforge at lokorin.org Wed Jul 18 14:20:26 2007
From: rubyforge at lokorin.org (Andreas Launila)
Date: Wed, 18 Jul 2007 20:20:26 +0200
Subject: [gecoder-users] [ANN] Gecode/R 0.6.0
Message-ID: <469E59EA.80408@lokorin.org>
Gecode/R 0.6.0 has been released.
It adds most of the remaining set constraints[1]. It also makes
backward-compatibility breaking changes to the way that properties of
variables are accessed, which probably means that existing scripts will
have to be updated. Backwards compatibility will be broken without
hesitation until otherwise noted.
Branch and bound search has been added, but it's very shaky at the
moment (probably shouldn't have been in this release). It works for some
examples, but can give segmentation faults for others.
== Changes (since 0.5.0) ==
* Added channel constraints involving set variables.
* Added set min and max constraints.
* Added set sum constraints (optionally weighted or substituted).
* Added include (match) constraint for sets.
* Added distinct constraints (distinct and at most one) for sets.
* Added branch and bound search (optimization search). It's quite shaky
at the moment though.
* Assigned values of variables are now always accessed using #value
instead of the various previous methods. The methods for extracting
information from set variables have been changed and renamed.
* Enumerations containing variables now provide a convenience method
#values which returns an array of the enum's values.
[1] http://gecoder.rubyforge.org/documentation/set-constraints.html
From rubyforge at lokorin.org Fri Jul 20 18:39:16 2007
From: rubyforge at lokorin.org (Andreas Launila)
Date: Sat, 21 Jul 2007 00:39:16 +0200
Subject: [gecoder-users] Trouble Installing Gecoder
In-Reply-To:
References:
Message-ID: <46A13994.8020202@lokorin.org>
What do the mkmf.log and gem_make.out files say?
I'm moving this discussion to gecoder-users as it's probably better
suited there.
--
Andreas Launila
Christopher Garcia wrote:
> Can anyone help me -- I'm having some problems installing Gecoder. I
> have installed the Gecode MSI on windows and am now trying to install
> Gecoder by using the gem as specified in the installation instructions:
>
>> gem install gecoder
>
> I get the following error -- can anyone help me resolve this?:
>
>
> C:\>gem install gecoder
> Bulk updating Gem source index for: http://gems.rubyforge.org
> Building native extensions. This could take a while...
> *** extconf.rb failed ***
> Could not create Makefile due to some reason, probably lack of
> necessary libraries and/or headers. Check the mkmf.log file for more
> details. You may need configuration options.
>
> Provided configuration options:
> --with-opt-dir
> --without-opt-dir
> --with-opt-include
> --without-opt-include=${opt-dir}/include
> --with-opt-lib
> --without-opt-lib=${opt-dir}/lib
> --with-make-prog
> --srcdir=.
> --curdir
> --ruby=c:/ruby/bin/ruby
> --with-gecodeintlib
> --without-gecodeintlib
> --with-gecodekernellib
> --without-gecodekernellib
> --with-gecodeminimodellib
> --without-gecodeminimodellib
> --with-gecodesearchlib
> --without-gecodesearchlib
> --with-gecodesetlib
> --without-gecodesetlib
>
> ERROR: While executing gem ... (RuntimeError)
> ERROR: Failed to build gem native extension.
> Gem files will remain installed in
> c:/ruby/lib/ruby/gems/1.8/gems/gecoder-0.6.0 for inspection.
>
>
> Results logged to
> c:/ruby/lib/ruby/gems/1.8/gems/gecoder-0.6.0/ext/gem_make.out
>
>
> Thanks!
>
> Chris
From rubyforge at lokorin.org Mon Jul 23 06:31:11 2007
From: rubyforge at lokorin.org (Andreas Launila)
Date: Mon, 23 Jul 2007 12:31:11 +0200
Subject: [gecoder-users] [ANN] Gecode/R 0.6.1
Message-ID: <46A4836F.4090808@lokorin.org>
Gecode/R 0.6.1 has been released.
It fixes various bugs introduced in 0.6.0 and changes the way that int
variable domains are specified (breaking backward-compatibility).
The following bugs in 0.6.0 have been found and fixed:
* Set min, max and cardinality constraints using relations other than
equality could not be satisfied unless the target was at the bound. This
was because temporary integer variables defined were defined as
int_var(min, max) when the intention was int_var(min..max). This
motivated a change in syntax for int_var.
* BAB-search was previously shaky. After hunting down a few segfaults it
now appears solid. Also temporary variables created in the optimization
block would previously cause errors, that is no longer the case.
* The domain of integer variables can no longer be specified with
variable arguments, i.e. int_var(1,3,5) is no longer valid (previously
it produced an integer variable with domain [1,3,5]. Instead the domain
always has to be specified as an enumeration[1]. In the above case that
would mean using int_var([1,3,5]) (ranges still behave as before)
== Changes (since 0.6.0) ==
* The domain for int variables can no longer be specified as several
individual elements, it has to be specified as either a single element,
a range or another enumeration.
* Fixed a bug with set cardinality, min and max constraints using
composite sugar.
* Variables can now be created inside the optimization block.
[1] http://gecoder.rubyforge.org/documentation/index.html
From rubyforge at lokorin.org Fri Jul 27 12:43:56 2007
From: rubyforge at lokorin.org (Andreas Launila)
Date: Fri, 27 Jul 2007 18:43:56 +0200
Subject: [gecoder-users] [ANN] Gecode/R 0.7.0
Message-ID: <46AA20CC.7080207@lokorin.org>
Gecode/R 0.7.0 has been released. It adds the set selection and
operation constraints.
This completes the initial round of planned features. The focus will now
shift to improving the documentation before planning additional
features. This is an excellent time to request specific documentation
improvements and new features.
== Changes (since 0.6.1) ==
* Added set selection constraints (set array access, select union,
select intersection (optionally with specified universe) and select
disjoint).
* Added set operation constraints (union, minus, disjoint_union and
intersection) on pairs of set variables or set constants with variable
or constant right hand side.
* Added set operation constraints on enumerations of sets.