# New Version of DRP (Genetic Programming)

**URL:** <https://www.ruby-forum.com/t/new-version-of-drp-genetic-programming/90005>\
**Category:** Ruby\
**Created:** [March 24, 2007, 10:15pm UTC](https://www.ruby-forum.com/t/new-version-of-drp-genetic-programming/90005 "2007-03-24T22:15:09Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![christophe1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b3f665/32.png) [@christophe1](https://www.ruby-forum.com/u/christophe1)\
**Post date:** [March 24, 2007, 10:15pm UTC](https://www.ruby-forum.com/t/new-version-of-drp-genetic-programming/90005/1 "2007-03-24T22:15:09Z")

</div>

hello everyone,

i’m working on the next release of DRP and was just curious if any of  
you have any suggestions/bugs/feature requests?

thus far i have added

- the ability to load rules from files
- filters on a rule basis, so you can define a method which runs after  
or before all rule methods for some rule
- a new syntax which will allow for much smarter display/navigation of  
generated programs in the future

and am working on something like attributes in attribute grammars  
although i’m not sure yet if it’ll get included.  
and also will be trying to get inheritance to work properly where  
inherited classes of an extended class not only inherit  
rule methods but can redifine them and add new ones.

a sneak peak at the new version from the symbolic regression example:

def bin\_op\_print x, y  
puts x, y  
[x,y]  
end  
pre\_rule\_filter :bin\_op, :bin\_op\_print

define\_rules :require =\> ‘math\_basic’ do # math\_basic rules in file  
loaded

```
max_depth 2..4

# using these rules from file, with current max_depth weight etc
bin_op :multiply, :subtract, :divide, :add
bin_op :exp do |x,y|
  x**y
end

# note you can still have them anonymous but you are better off

```

naming them  
# because then you can look at a stack trace and see something  
meaningful  
# plus i’ll be adding some tools for that purpose at some future  
date

```
bin_op do |x,y| ... end

expr do
  #puts "op(expr,expr)"
  bin_op(expr, expr)
end
expr do
  #puts "@input"
  @input
end
expr do
  #puts "map"
  map -5..5, :i_lin
end

```

end

---

<div class="post-metadata">

**Author:** ![christophe1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b3f665/32.png) [@christophe1](https://www.ruby-forum.com/u/christophe1)\
**Post date:** [March 25, 2007, 12:03am UTC](https://www.ruby-forum.com/t/new-version-of-drp-genetic-programming/90005/2 "2007-03-25T00:03:07Z")

</div>

christophe wrote:

> generated programs in the future
> 
> and am working on something like attributes in attribute grammars  
> although i’m not sure yet if it’ll get included.  
> and also will be trying to get inheritance to work properly where  
> inherited classes of an extended class not only inherit  
> rule methods but can redifine them and add new ones.

[snip]

Where does this project live?

–  
M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P)  
[http://borasky-research.blogspot.com/](http://borasky-research.blogspot.com/)

If God had meant for carrots to be eaten cooked, He would have given  
rabbits fire.

---

<div class="post-metadata">

**Author:** ![christophe1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b3f665/32.png) [@christophe1](https://www.ruby-forum.com/u/christophe1)\
**Post date:** [March 25, 2007, 1:28am UTC](https://www.ruby-forum.com/t/new-version-of-drp-genetic-programming/90005/3 "2007-03-25T01:28:04Z")

</div>

> Where does this project live?

[http://drp.rubyforge.org](http://drp.rubyforge.org)

i see on your blog that you are interested in music  
composition/synthesis.  
that is one of my primary motivations (along with other interactive  
design tasks), for the creation of this software. hope it is of some use  
to you.

> If God had meant for carrots to be eaten cooked, He would have given  
> rabbits fire.

funny

---

<div class="post-metadata">

**Author:** ![christophe1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b3f665/32.png) [@christophe1](https://www.ruby-forum.com/u/christophe1)\
**Post date:** [March 25, 2007, 3:32am UTC](https://www.ruby-forum.com/t/new-version-of-drp-genetic-programming/90005/4 "2007-03-25T03:32:51Z")

</div>

> Do you have examples of Directed Programming in algorithmic composition?

sorry but none that i am willing to share at this point, but i will try  
to include a sound synthesis example in the next release. probably using  
csound and maybe one also with ruby’s midilib.

the very first (unreleased) versions of drp were written in the  
supercollider sound synthesis language (which btw is ruby’s closest  
living relative), so it is a major concern of mine, the other being  
visual art. the lib is designed for ease of use and flexibility. it lets  
you choose and evolve weights and maximum recursive depths for functions  
on an individual basis assuming that you will want to tweak the  
evolutionary process one way or the other and do so easily, i.e. it  
encourages cheating whereas other more engineering oriented libs  
generally frown upon or at the very least do not facilitate it. another  
thing that i wanted to be able to do is combine independently evolved  
components of a system, which you can do with drp since it makes no  
assumptions about how you want to structure your evolutionary process.  
it is really just a mapping layer from vectors of floats to programs.

---

<div class="post-metadata">

**Author:** ![christophe1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/b3f665/32.png) [@christophe1](https://www.ruby-forum.com/u/christophe1)\
**Post date:** [March 25, 2007, 3:00am UTC](https://www.ruby-forum.com/t/new-version-of-drp-genetic-programming/90005/5 "2007-03-25T03:00:13Z")

</div>

Christophe M. wrote:

> 

Do you have examples of Directed Programming in algorithmic composition?

–  
M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P)  
[http://borasky-research.blogspot.com/](http://borasky-research.blogspot.com/)

If God had meant for carrots to be eaten cooked, He would have given  
rabbits fire.
