기본 콘텐츠로 건너뛰기

Rhino python - Automate optimization for multiple objects

How to automate the optimization process? 

It would be helpful for someone


  1. Who already knows how to set up optimization
  2. Who has plenty of objects to optimize with an identical template but in the scarce amount of human resource

Benefit

  1. As this process minimizes the manual operation, it can diminish the takt time.
  2. So the story changes from "How many human resources you have" to "How many computers you have".


Summary

 In this article, I will focus on the methodology on how to automate the optimization process in grasshopper when there are multiple objects and they comply with the identical optimization template.

Main

 During the time I served as facade consultant, there was a project which aimed to optimize several objects with identical optimization template. At the time, the main platform was CATIA(from Dassault System). Thanks to its special structure which is called Geometrical set, CATIA was eligible for the scenario; put optimizer and trigger in each Geometrical set under consecutive objects.

 After the project was finished, I wonder "Is the same scenario is possible in Rhino and Grasshopper?" If so, it can give the clue that David can defeat Goliath. Keep in mind that Rhino and Grasshopper cost only $995 and never require a maintenance fee. On the other hand, CATIA - now integrated into the 3DEXPERIENCE platform- costs you more than 10 folds of that of Rhino and Grasshopper.

Rhino pricing(From Rhino official web page)
CATIA pricing
(image from web search)

 By the conventional process of optimization with Galapagos(Native optimizer in Grasshopper), it is completely absurd to automate the process. Why? Because you have to manually activate the optimizer. So I started to wander around to find the way.
 On my journey, I bumped into Octopus(One of the third-party optimizer). And from the example they provide, I could find the key.
Galapagos typical flow.
Notice that Galapagos itself need to be activated by manual control.


 The point is by combining Anemone(Plug-in specialized for looping) and components included in Octopus and related to the genetic algorithm, it does the work without manual operation. My starting point was "Would it be possible to do the optimization work by having a loop in loop which outer loop provides the index of item and inner does the optimization?". I made an arduous journey for myself.

 Long story short, it worked. But it stops after around 1000 iteration. Some of you think that 1000 iteration is huge enough. However, in this project, although the 1000 iteration is enough for one object, as there are a number of objects(here 80) the total number of iteration becomes 1000*n.

 Bye-bye, said I to my work. There was no other way. Another rigorous test started. And thankfully, the way was in Octopus again. It can be a digression but octopus has been developed itself for a long time and added some explicit components. In a nutshell, it has a conventional optimizer and a set of new components that are based on SVM(Support Vector Machine), ANN(Artificial Neural Network), etc.

 The new components complied with my criteria which are

  1. It can be activated without a double click. 
  2. it can go through multiple objects. 


Key components

 Consecutively, they are in Octopus, Treesloth, native grasshopper components. Here is how it works. On some of the components which have "Run" as input, they usually activated by changing numbers. That means even though your input for the "Run" is not "True" but random number except for "0" it is activated. As a result, if you connected the number slider to the index of the object, more specifically to the "List item" component and Optimizer concurrently, then the optimization and selection of an item will be done at the same time.

 And I set the story to export the optimized parameters and then import it after all the work is done, components for the exporting and importing is also crucial. If you don't want to use a third-party plug-in for this process, there is another option which is using python or c-sharp so that you export parameters corresponding to objects one by one via CSV and import again. Here I used "Unpack / Pack" components included in Treesloth. Simply it was based on the fact that I misunderstood those are native.

Original grasshopper code.
   I used the python code that manipulates the "Item index + Activator" number slider. I'm not going to handle it. And hope you to refer to this web site http://designalyze.com/automate-grasshopper-python/automating-grasshopper-part-3.

 The required time for optimization will depend on a range of factors from computer speed as such to the modeling process setting that each one defines.
 After the optimization is done, the final step is to import the parameters and see the result. I'm not sure about it but some people call it phenomena for the result. 

exported parameters. It is saved as *.dat.
Final step. Import parameters and review the result.
 I'm sorry that I can't show you some direct results.
 But the general process is as explained above. I hope your comments about this; not only the technical aspect but also the linguistic. And for Korean people. I'll post the Korean version later.

댓글

이 블로그의 인기 게시물

[건축][소프트웨어] 프로그램 비교

 실무를 하면서 라이노와 그래스호퍼를 많이 쓰게된다. 그러다보니 관련 지식도 쌓이고, 나 나름대로 정리도 하며 공유를 위해 글을 쓰기 시작했다. 앞으로 계획은 라이노와 라이노 안의 파이썬 스크립트 또는 그래스호퍼 연동으로 자동화 관련해서 다루려고 한다.  그 전에 왜 라이노, 그래스호퍼 그리고 파이썬을 쓰게 되게 됬는지 프로그램들 비교 후에얘기하고자 한다. 비교하려는 프로그램들은 다음과 같다. Rhino(RobertMcNell & Associates) 3d experience (Dassault Systemes) Revit (Autodesk)  세 프로그램 모두 써볼 기회가 있었고, 사용 빈도는 다음과 같다 Rhino >= 3d experience(CATIA) >>>>Revit HTML 소프트웨어 비교 Rhino 3dExpereince Revit 가격 995$ (영구 라이센스) 9,000~65,000$(유지비 6,246$ / 년) 2,642,640원 / 년 첫 프로젝트 1994년 3월/ 25m 크기 보트 1977년 / 미라주 전투기 정확하지 않음 파라메트릭 모델링 x(그래스호퍼로 가능) O(자체 모델링 + EKL(내부언어) 등) O(자체 모델링 + Dynamo) Rhino : 최고의 가성비 프로그램 장점 : NURBs 모델링 가능, 가장 저렴한 가격, API/SDK를 통한 개발환경 제공 단

일본 / 신오쿠보 / 도장집

신오쿠보에서 도장 만들기 1. 장소이전 이미 몇몇 블로그에서 정보를 찾아서 갔다. 하지만 문제는 장소를 이전했다는 사실이다. 또한 가격도 바꼈다. 다른 블로그에서 봤을 그 3층에 있고, 돈키호테 맞은편에 있는 도장집 겸 부동산집 2. 찾아가기 위치 〒160-0021 Tōkyō-to, Shinjuku-ku, Kabukichō, 2 Chome−19−11 新宿シャロームビル9F 다음과 같다. 히가시 신주쿠 역에서 서쪽(신주쿠방향)으로 걸어오는게 제일 빠르다고 나온다. 1층에 홍콩반점이 보이면 제대로 온 것. 3. 가격 변경 가격은 다음과 같다. 다른 블로그에서 엄청 쌋던거 같은데 조금 올랐다. 나 같은경우 한자로된 3글자 도장을 만들었고, 가격은 1000엔 들었다. 가격은 다음과 같은데 잘 나온느지 모르겠다. 여튼 이렇게 도장을 해결했다.

[건축]파사드 컨설팅이야기 - 1편: 파사드 컨설팅은 왜 필요한가?

 나의 약 1년 9개월간의 파사드 컨설팅을 중심으로 파사드 컨설팅 이라는 분야를 이야기 해보겠다.  파사드 컨설팅이란?  파사드 컨설팅은 우리나라에 다소 생소한 개념이다. 우선 Facade가 무엇인지 간략히 짚고 넘어갈 필요가 있다.  구글 검색에 facade를 치면 다음과 같은 정의가 나온다.  건물의 얼굴, 열린 장소 또는 거리에서 보이는 주 입면.  아주 간단하게 건물의 입면이라고 생각하면 된다. 그럼 왜 건물 입면에 컨설팅이 필요할까?  내가 참여하게 되었던 프로젝트를 생각해보며 적어보겠다. 파사드 컨설팅이 필요한 이유 1. 복잡해지는 형태  파사드는 건물의 외관이다.   즉, 누군가 건물을 봤을때 첫인상을 좌우하게 된다. 그래서 랜드마크나 기업 사옥을 건설할때 자주 건드리는 수단이 된다. 그리고 그 방향은 주로 DDP와 같이 유기적이거나 독특한 방향으로 가는 경우가 꽤나 있다. 박스에서 형태가 조금만 벗어나도 그것을 실체화 시키는데 큰 어려움이 따르게 된다. 특히 모든 프로젝트는 정해진 예산과 시간이 있기 때문에 이 제약조건 안에서 문제를 해결하려면 기존의 방법으론 불가능한 경우가 많다. 동대문 디자인 플라자. BIM과 비정형 사례로 항상 빠지지 않는다.  이 문제를 가장 깊이 고민하게 된 프로젝트는 <동대문 디자인 플라자>가 아닐까 생각한다. 업계가 좁은지라 이 프로젝트에 연관된 몇몇 분들을 만날 기회가 있었고, 그 중 외관(Facade)을 시공한 '스틸라이프' 대표님과는 영종도 프로젝트를 한적도 있다.  좌우지간, DDP는 삼성이 시공한 것으로 알려져 있지만 그 뒤엔 비정형 패널을 제작 설치하는데 특화된 '스틸라이프' 라는 업체와 파사드 컨설팅을 한 GT(Gehry Technologies)가 있었다.  프랭크 게리와 게리 테크놀로지스   수업시간에 들어봤을지 모르겠지만 게리는 Frank Gehry의 그 게리다.    어느 공식석상에서 법규를 날린것으로 유명한 게리 아저씨는 요상한 형태를 디자인 할 뿐만 아니