[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] Gecode/R 0.5.0

Andreas Launila

7/11/2007 6:31:00 PM

Gecode/R version 0.5.0 has been released.

http://gecoder.ruby...

It's still in the development, so don't expect any form of backwards
compatibility (things will change left and right if needed to).


== What is Gecode/R? ==

Gecode/R is a Ruby interface to Gecode[1] which allows you to use
constraint programming in Ruby. It's typically useful for problems where
you otherwise have to do a search through various assignments to find a
solution. All you have to do is describe the properties of solutions to
a problem and Gecode will find them.


== Installation ==

First install Gecode 1.3.1 (see installation[4] for links). And then do

gem install gecoder


== Features ==

See the website[5] for a more detailed list.
* Finite domain integers, booleans and finite set variables.
* Supports many of Gecode's integer constraints, all of the boolean
constraints and some of the set constraints.
* Reification and propagation strength.


== Example ==

send+more=money is one of the many examples[2].

send
+ more
------
money

The following assigns digits to each letter so that the above equation
holds when the letter are substituted with the assigned digits. No two
letters are assigned the same digit and the first letter of a word is
not assigned 0 (so that no number starts with 0).


class SendMoreMoney < Gecode::Model
def initialize
# Set up the variables, 8 letters with domain 0..9.
s,e,n,d,m,o,r,y = @letters = int_var_array(8, 0..9)

# Set up the constraints.
# The equation must hold.
(equation_row(s, e, n, d) + equation_row(m, o, r, e)).must ==
equation_row(m, o, n, e, y)

# The initial letters may not be 0.
s.must_not == 0
m.must_not == 0

# All letters must be assigned different digits.
@letters.must_be.distinct

# Set the branching.
branch_on @letters, :variable => :smallest_size, :value => :min
end

def to_s
%w{s e n d m o r y}.zip(@letters).map do |text, letter|
"#{text}: #{letter.val}"
end.join(', ')
end

private

# A helper to make the linear equation a bit tidier. Takes a number of
# variables and computes the linear combination as if the variable
# were digits in a base 10 number. E.g. x,y,z becomes
# 100*x + 10*y + z .
def equation_row(*variables)
variables.inject{ |result, variable| variable + result*10 }
end
end

puts SendMoreMoney.new.solve!.to_s


Output: s: 9, e: 5, n: 6, d: 7, m: 1, o: 0, r: 8, y: 2


== Learning more ==

The documentation[3] lists examples of all the available constraints and
features (which in combination with the examples should get you going).
Questions are welcome.


== Changes since last announcement ==

=== Version 0.5.0 / 11 July 2007 ===
This release adds set variables and some of their constraints, along
with the last of the boolean constraints.

* 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.

=== Version 0.4.0 / 3 July 2007 ===
This release adds most of the integer variable constraints supported by
Gecode.

* [#11861] Fixed a bug stopping the creation 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://www.g...
[2] http://gecoder.ruby...examples.html
[3] http://gecoder.ruby...documentation/
[4] http://gecoder.ruby...installation.html
[5] http://gecoder.ruby...features.html

--
Andreas Launila


2 Answers

The Peeler

9/11/2010 6:15:00 PM

0

On Sat, 11 Sep 2010 19:56:01 +0800, Delirious The Retard, the resident
psychopath of sci and scj, IMPERSONATING his master, The Peeler, wrote:

>>>>
>>>>24 minutes....better, but not great. You'd better shape up, missy.
>>>
>>> Here comes the next dump, jewboy! Right on your head!
>>
>>Only 8 minutes to formulate another literary masterpiece. The lease [sic]
>>is quite short.........
>
> You'll have to be quicker than that, jewboy. You don't want to wait
> all day for that dump to land on your head, do you? And what the
> fuck does your lease have to do with anything, you illiterate asshole?

So tetchy again, you hysterical cunt? What happened in your miserable
"life"? Same thing as every day: absolutely NOTHING? Or are the batteries
for your favourite dildo dead again? LMAO!

--
Retarded, subnormal and extremely proud of it: our resident psychopath, The
Retard!

Stewart

9/11/2010 7:21:00 PM

0


"The Peeler" <peelingthe@invalid.admin> wrote in message
news:3hrm86dvnhen8guaj4uk2h11n6t6832424@4ax.com...
> On Sat, 11 Sep 2010 07:34:23 -0400, "Stewfart" <got_anus@gmail.com>
> wrote:
>
>>
>>"The Peeler" <peelingthe@invalid.admin> wrote in message
>>news:r0si86p1nfbv5ggbkegba485jh0eq3pbni@4ax.com...
>>> On Thu, 9 Sep 2010 19:31:57 -0400, "Stewfart" <got_anus@gmail.com>
>>> wrote:
>>>
>>>>
>>>>"The Peeler" <peelingthe@invalid.admin> wrote in message
>>>>news:9o6g86lpapd0t1aqqiorhhpkt4btn2mbse@4ax.com...
>>>>> On Wed, 8 Sep 2010 19:00:28 -0400, "Stewfart"
>>>>> <got_anus@gmail.com>
>>>>> wrote:
>>>>>
>>>>>>
>>>>>>"The Peeler" <peelingthe@invalid.admin> wrote in message
>>>>>>news:utqe8695ri8m5sk4c4q5iuubd7dv8a9ubi@4ax.com...
>>>>>>> On Tue, 7 Sep 2010 19:23:56 -0400, "Stewfart"
>>>>>>> <got_anus@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>>
>>>>>>>>"The Peeler" <peelingthe@invalid.admin> wrote in message
>>>>>>>>news:v62b86lkqp1dluhejllpnrolmu25imsf85@4ax.com...
>>>>>>>>> On Mon, 6 Sep 2010 16:43:40 -0400, "Stewfart"
>>>>>>>>> <got_anus@gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>"The Peeler" <peelingthe@invalid.admin> wrote in message
>>>>>>>>>>news:ebt9861o9nmi2m2q0dsqdqidt1aq58rt2u@4ax.com...
>>>>>>>>>>> On Mon, 6 Sep 2010 09:50:51 -0400, "Stewfart"
>>>>>>>>>>> <got_anus@gmail.com>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>"The Peeler" <peelingthe@invalid.admin> wrote in message
>>>>>>>>>>>>news:4c828fd8$3@news.x-privat.org...
>>>>>>>>>>>>> On Sat, 04 Sep 2010 22:23:26 +0800, Hallucinating The
>>>>>>>>>>>>> Retard,
>>>>>>>>>>>>> the
>>>>>>>>>>>>> resident
>>>>>>>>>>>>> psychopath of sci and scj, IMPERSONATING his master, The
>>>>>>>>>>>>> Peeler,
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>>>You do not have the skill set necessary for passing
>>>>>>>>>>>>>>>judgments
>>>>>>>>>>>>>>>of
>>>>>>>>>>>>>>>literacy.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> You do not have the literacy necessary for passing
>>>>>>>>>>>>>> judgments
>>>>>>>>>>>>>> on
>>>>>>>>>>>>>> skill
>>>>>>>>>>>>>> sets, jewboy. Shabbat shalom!
>>>>>>>>>>>>>
>>>>>>>>>>>>> You were waiting for his post all day long, eh, poor
>>>>>>>>>>>>> miserable
>>>>>>>>>>>>> housebound
>>>>>>>>>>>>> The Retard. You are simply incredible! But there you
>>>>>>>>>>>>> are:
>>>>>>>>>>>>> in
>>>>>>>>>>>>> all
>>>>>>>>>>>>> your
>>>>>>>>>>>>> retardation and "splendour" !!!!
>>>>>>>>>>>>>
>>>>>>>>>>>>> ROTFLOL
>>>>>>>>>>>>
>>>>>>>>>>>>I've got her down to 7 minute responses now. A very
>>>>>>>>>>>>silly,
>>>>>>>>>>>>little
>>>>>>>>>>>>person she is.
>>>>>>>>>>>
>>>>>>>>>>> All the faster to shit all over you again, jew cunt. LOL
>>>>>>>>>>
>>>>>>>>>>17 minutes, your [sic] slipping.
>>>>>>>>>
>>>>>>>>> You're illiterate.
>>>>>>>>>
>>>>>>>>>>Still within the 20 required, but your
>>>>>>>>>>standard deviation just went up, and your process capability
>>>>>>>>>>is
>>>>>>>>>>down.
>>>>>>>>>
>>>>>>>>> You know you simply can't wait to get shat upon again,
>>>>>>>>> jewboy!
>>>>>>>>> Quit
>>>>>>>>> kvetching already!
>>>>>>>>
>>>>>>>>Almost 4 hours....you must remember your training,
>>>>>>>>grasshopper.
>>>>>>>
>>>>>>> Anxious to get shat upon again, jewboy?
>>>>>>
>>>>>>Almost 12 hours. Your standard deviation is rising, young lady.
>>>>>
>>>>> Really anxious to get shat upon again, jewboy? You know it
>>>>> makes
>>>>> sense!
>>>>
>>>>24 minutes....better, but not great. You'd better shape up,
>>>>missy.
>>>
>>> Here comes the next dump, jewboy! Right on your head!
>>
>>Only 8 minutes to formulate another literary masterpiece. The lease
>>[sic]
>>is quite short.........
>
> You'll have to be quicker than that, jewboy.

No, not really. You're the one that seems to care enough to formulate
a rapid response, no matter how ignorant it may be. It is like you
just can't wait to show off how little you know.

> You don't want to wait
> all day for that dump to land on your head, do you? And what the
> fuck does your lease have to do with anything, you illiterate
> asshole?

Your lease of intelligence, it seems you should have kept it for a
longer term.