Reputation: 1
I am trying to implement a multi objective optimization experiment using Anylogic Agent Based Modeling and Custom Experiment feature in Anylogic to run the model in loops with modified parameters each time. At the end of each simulation run, I check values of 3 objective functions, modify the parameters using an genetic algorithm and run again. It is said that Optimization and Paramter Variation experiments can make use of multi core processing in Anylogic. I am trying to find a way to utilize this option and make my experiment run faster. Any leads can help ! Thanks
Upvotes: 0
Views: 566
Reputation: 2517
So it looks like your question is really about how to add run parallelisation (as other AnyLogic experiment types can do) to a Custom experiment you've created to do your own particular flavour of multi-objective optimisation using genetic algorithms (GAs). (I suggest you edit your question title since it's very misleading as Ben suggested in his comment.) But I'll cover the wider angle slightly as well.
I am trying to implement a multi objective optimization experiment using [...] Custom Experiment feature in Anylogic to run the model in loops with modified parameters each time. At the end of each simulation run, I check values of 3 objective functions, modify the parameters using an genetic algorithm and run again.
Yes, if you want a particular GA-driven flavour of multi-objective 'optimisation' (which is not optimisation in the AnyLogic sense of using OptQuest's heuristic optimisation, hence the quote marks) you will need to use a Custom experiment where you can setup/interface with the GA and explicitly control the setup/creation of runs as needed.
It is said that Optimization and Paramter Variation experiments can make use of multi core processing in Anylogic. I am trying to find a way to utilize this option and make my experiment run faster.
Parallelisation in these experiments just means that runs are executed in separate Java threads so that this naturally parallelises across the CPU cores you have. You can limit the parallelism via the "Number of processors for parallel execution" setting in Tools --> Preferences --> Runtime.
So in a Custom experiment you need to explicitly handle this yourself using Java concurrency (creating your own set of Thread
objects that do the model setup and execution via the steps already included in the template Custom experiment code). You'll need to learn and be confident with these techniques if you don't already know them. (Java 8 added a lot of improved concurrency-handling techniques.) There is no higher-level AnyLogic API for dealing with it.
NB: You also have to handle how the thing controlling the selection of runs (a GA in your case) handles the parallelism. If, say, you are kicking off batches of 4 runs in parallel, will it wait for all 4 to finish (so it has full information on all objective outcomes) before deciding the next set of model parameters, or make decisions as each completes? (AnyLogic's OptQuest optimiser also has to worry about this in Optimization experiments with parallel execution turned on.)
Upvotes: 1