ATTENTION

This FlexSim Community Forum is read-only. Please post any new questions, ideas, or discussions to our new community (we call it Answers) at https://answers.flexsim.com/. Our new Question & Answer site brings a modern, mobile-friendly interface and more focus on getting answers quickly. There are a few differences between how our new Q&A community works vs. a classic, threaded-conversation-style forum like the one below, so be sure to read our Answers Best Practices.


flexsim.com

Go Back   FlexSim Community Forum > FlexSim Software > Q&A
Downloads

Q&A Using Flexsim and building models

  #1  
Old 01-23-2009
ankus d ankus d is offline
Flexsim User
 
Join Date: Jan 2009
Posts: 19
Downloads: 0
Uploads: 0
Thanks: 9
Thanked 0 Times in 0 Posts
Rep Power: 138
ankus d is on a distinguished road
Question Can embedding genetic algorithm in Flexsim ?

HI

I am newbie in Flexsim. Does anyone have experience embedding evolutionary algorithm(i.e genetic algorithm) in Flexsim for optimization ?

Could you share your experience?

Ankus
  #2  
Old 05-22-2009
Kris Geisberger Kris Geisberger is offline
Flexsim Canada, Forum Moderator
 
Join Date: Aug 2007
Location: Canada
Posts: 209
Downloads: 54
Uploads: 1
Thanks: 99
Thanked 389 Times in 133 Posts
Rep Power: 451
Kris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud ofKris Geisberger has much to be proud of
Default Order-based genetic algorithm in Flexsim

Attached is an example of integrating an order-based genetic algorithm (GA) into a Flexsim model to solve a scheduling problem. Because of its heavy reliance on statistics, if you don't have a license key this example won't really work. Plus you won't be able to modify the GA parameters or view the functions I wrote because I left them in the tree on purpose. This example is completely made-up.

Model:
-10 different order types must pass along a conveyor, then go through one of two machines
-the ProcessTimes global table dictates which orders can be done on which machines, 0 means no
-the SetupTimeMatrix global table is a From/To lookup for changeover times
-the system is stuborn in that the orders must leave the conveyor in the order they entered

Question:
How to sequence the 10 order types such that the overall time to process all is minimized?

With no restrictions on the order sequencing, this leaves us with over 3.6 million possibilities. Assuming a model run of 0.01s this could take 10hrs to try all. Ouch.

Parameters:
A "GA" folder within the Tools folder of the model tree holds everything. The first 4 nodes in that tree are managed by the GA, the 5 nodes after that are the parameters:

*popsize
size of the population, pool of possible solutions

*nrofgens
number of generations, how long to run the GA

*elitepairs
number of solutions to pass directly to the next generation without change (1=pass top 2 performers)

*crossovermode
0=uniform crossover
1-single crossover point
2-dual crossover points
...

*mutationprob
percent probability that a given gene will be mutated, although the way I implemented it, the result is actually less than this value

How the GA works:
When you click the "Initialize and Run GA" button, the GA randomly generates a population of order sequence solution possibilities called chromosomes. The first solution is loaded into the model then run (the master chromosome is used to translate the gene number into an itemtype for the Source, in this case 1=1, 2=2, etc.). When the Sink receives the 10th item it relays the model time (our only performance measure) back to the GA. The GA loads the next solution and re-runs the model... continuing until all solutions in the population are evaluated. Next the GA randomly mates parent chromosomes from the current population to create a new population (generation). The top performers are passed through unchanged (elitism). The new population is evaluated then used to create the next generation, and so on. Over time, new top performing solutions are found until the GA finds the best solution (hard to prove) or gets stuck on a sub peek solution.

Integrating a GA into a Flexsim model was straight forward, but that's not the hard part. Writing a good GA is difficult. A poor GA will perform no better than a random search. You will find that this one is not the best. If you initialize and run it a few times you should get a time of 77. I 'think' that is the best solution.
Attached Files
File Type: zip GA scheduling example.zip (49.2 KB, 295 views)
The Following 14 Users Say Thank You to Kris Geisberger For This Useful Post:
Zulay Sarmiento (02-21-2015)
  #3  
Old 05-23-2009
Shankar Narayan's Avatar
Shankar Narayan Shankar Narayan is offline
Flexsim User
 
Join Date: Oct 2007
Posts: 33
Downloads: 25
Uploads: 0
Thanks: 24
Thanked 12 Times in 5 Posts
Rep Power: 161
Shankar Narayan is on a distinguished road
Default

kris,

you continue to amaze me with your algorithmic and Flexsim skills. Nice job.
  #4  
Old 05-25-2009
ankus d ankus d is offline
Flexsim User
 
Join Date: Jan 2009
Posts: 19
Downloads: 0
Uploads: 0
Thanks: 9
Thanked 0 Times in 0 Posts
Rep Power: 138
ankus d is on a distinguished road
Default

Thank You for your effort, Kris..
I really appreciate it..
Last time, i was confuse about that..
And then to solve problem. i used 2 applications, visual c++ stand alone and flexsim.
So variables from visual c++ are sent to flexsim using csv file and then after flexsim finish send the result to csv file and vicual c++ read this as ouput. so i made the relationship between visual c++ stand alone and flexsim automatically. although much effort but it's worked for me, last time.

I am glad for your example. may be next time i will try as your method

Thank you so much

Last edited by ankus d; 05-25-2009 at 10:51 PM.
  #5  
Old 02-21-2015
Zulay Sarmiento's Avatar
Zulay Sarmiento Zulay Sarmiento is offline
Flexsim User
 
Join Date: Mar 2014
Location: Barranquilla, Colombia
Posts: 9
Downloads: 1
Uploads: 0
Thanks: 9
Thanked 3 Times in 2 Posts
Rep Power: 0
Zulay Sarmiento is on a distinguished road
Question File for download

Hi people, i am intrested in the file about Genetic Algorithms with flexsim, can you put it able for download again? Thanks
  #6  
Old 02-21-2015
arunkrmahadeva's Avatar
arunkrmahadeva arunkrmahadeva is offline
CCS, India
 
Join Date: Sep 2013
Location: India
Posts: 71
Downloads: 67
Uploads: 0
Thanks: 285
Thanked 101 Times in 51 Posts
Rep Power: 145
arunkrmahadeva is a jewel in the rougharunkrmahadeva is a jewel in the rougharunkrmahadeva is a jewel in the rougharunkrmahadeva is a jewel in the rough
Default

Dear Zulay Sarmiento,

The attached is the GA scheduling model which you are looking for.



Regards,

Arun KR
Attached Files
File Type: fsm GA scheduling example.fsm (298.0 KB, 498 views)
The Following 5 Users Say Thank You to arunkrmahadeva For This Useful Post:
Zulay Sarmiento (02-22-2015)
  #7  
Old 02-22-2015
Zulay Sarmiento's Avatar
Zulay Sarmiento Zulay Sarmiento is offline
Flexsim User
 
Join Date: Mar 2014
Location: Barranquilla, Colombia
Posts: 9
Downloads: 1
Uploads: 0
Thanks: 9
Thanked 3 Times in 2 Posts
Rep Power: 0
Zulay Sarmiento is on a distinguished road
Wink

Quote:
Originally Posted by arunkrmahadeva View Post
Dear Zulay Sarmiento,

The attached is the GA scheduling model which you are looking for.



Regards,

Arun KR
Hi,
Thanks a lot!! Greetings from Colombia
  #8  
Old 03-10-2015
Zulay Sarmiento's Avatar
Zulay Sarmiento Zulay Sarmiento is offline
Flexsim User
 
Join Date: Mar 2014
Location: Barranquilla, Colombia
Posts: 9
Downloads: 1
Uploads: 0
Thanks: 9
Thanked 3 Times in 2 Posts
Rep Power: 0
Zulay Sarmiento is on a distinguished road
Default about the model

Thanks a lot.


Thread Thread Starter Forum Replies Last Post
shortest path algorithm Vinay Mehendiratta Q&A 5 01-25-2008 11:42 AM
Embedding Videos Inside Your Posts Cliff King Q&A 0 09-19-2007 07:55 PM


All times are GMT -6.
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Copyright 1993-2018 FlexSim Software Products, Inc.