A playground for University of Bologna Students and a 6-days seminar about digital tools.

Digital generative tools are a very important part of architectural education. Andrew Kudless during his conference at SimAE was telling about chinese traditional woodcraftsmen: they spend their first two years of apprentice in making their own tools. Today, we have a large pool of digital ready made tools, built to respond to more or less specific problems or tasks, while keeping a level of flexibility and personalization. The majority of these tools have hidden capabilities, which can only be accessed bypassing the conventional interface and getting close to the machine logic of programming or building parametric components which generate shapes. Thus, seriality, differentiation, complexity can be implemented in architectural projects through code, in order to exploit the power of algorithmic based complex systems which are the basis of biological systems.


But, before going through such complexity, we must start with simple tasks and simple rules. Before playing seriously we need practice. This is the playground where a bunch of students will start to practice, a pool where they will share their results and questions. Maybe the stuff here that will be posted will seem obvious or naive to the navigated code-monkey, but, as I mentioned before, we all start from the basics and this is intended as a place to start. However, any comment and contribution is appreciated.

Playground is open, let's play! _ Alessio

31.10.09

it's evolution, baby!

The purpose of this script is twofold: to study emergent systems based on simple elements, and to build a code for a self-learning system.

Imagin a family of worms sorted on a path. Every worm move randomly from previous one. This worm recive a vote based on approach to the target specified.
Coding this script I follow a very simple rule: worms that gain better vote may proliferate replacing themselves in next generations.
Every generation manifest mutation like in Darwin's theory of evolution, and environment rules define if this mutations are good or not for species.






Like human body and ant colony, later generations reduce scattering for a more accurate configuration. Studying countless generations, the family should reach the target specified.

Specifying different rules for worms should be possible to study emergent systems whose behavior is not predictable from the study of individual elements, like organic complexity L-systems.




Option Explicit
' Script written by Alessandro Zomparelli
' alessandro.zomparelli@gmail.com
' http://alessandrozompa.altervista.org/
' Script version venerdì 30 ottobre 2009 16.59.03

Call Main()
Sub Main()
Dim strTarget, arrFamily, arrTarget, n
n=Rhino.GetInteger("set number elements",20,2,100)

ReDim arrFamily(n), arrTarget(2)
arrFamily(0)=Rhino.GetObject("pick starting point")
'check for starting point
If Rhino.IsPoint(arrFamily(0))=False Then
Exit Sub
End If
strTarget=Rhino.GetObject("pick target point")
'check for target point
If Rhino.IsPoint(strTarget)=False Then
Exit Sub
End If
arrTarget=Rhino.PointCoordinates(strTarget)

Dim dblDist
dblDist=Rhino.Distance(Rhino.PointCoordinates(arrFamily(0)),arrTarget)

'defining number of generations and amount of mutation between following generations
Dim dblGen, dblMut
dblGen=Rhino.GetInteger("set number of generations",100,2,1000)
dblMut=Rhino.GetReal("set mutation value",2,0.01,100)

'defining an array to collect data about different family
Dim arrData
ReDim arrData(n)

'defining a value for better step-element of different family
Dim dblVote

'defining counters, array for data recording and an array for scattering direction
Dim i, j, arrVect, arrVect0, arrRec
ReDim arrVect(2), arrVect0(2), arrRec(1)

'defining random data for first generation
For j=1 To n
arrVect=array(rnd-rnd,rnd-rnd,rnd-rnd)
dblVote=0
arrData(j)=array(dblVote,arrVect)
Next

Dim strLine

'starting evolution system
For i=0 To dblGen-1

Call Rhino.EnableRedraw(False)
'starting family growning
For j=1 To n
arrRec=arrData(j)
arrVect0=arrRec(1)
arrVect=array(arrVect0(0)+dblMut*(dblGen-i)/dblGen*(rnd-rnd),arrVect0(1)+dblMut*(dblGen-i)/dblGen*(rnd-rnd),arrVect0(2)+dblMut*(dblGen-i)/dblGen*(rnd-rnd))
arrVect0=Rhino.VectorUnitize(arrVect)
arrVect=Rhino.VectorScale(arrVect0,dblDist/n)
'generation of new element of the family
arrFamily(j)=Rhino.CopyObject(arrFamily(j-1),arrVect)
strLine=Rhino.AddLine(Rhino.PointCoordinates(arrFamily(j-1)),Rhino.PointCoordinates(arrFamily(j)))
Call Rhino.ObjectColor(strLine, RGB(255-255/dblGen*i,0,255/dblGen*i))

If Rhino.Distance(Rhino.PointCoordinates(arrFamily(j)),arrTarget)arrRec(0) Then
arrData(j)=array(dblVote,arrVect)
End If
End If
Next
For j=1 To n
Call Rhino.DeleteObject(arrFamily(j))
Next

Call Rhino.EnableRedraw(True)
Next

End Sub