aarongarrett / inspyred

Python library for bio-inspired computational intelligence
MIT License
187 stars 58 forks source link

Way to `teach' NSGA-II with previous data? #18

Open jbae11 opened 4 years ago

jbae11 commented 4 years ago

Description

I am using Inspyred to run NSGA-II to do multiobjective optimization on a very computationally heavy problem. While running, my cluster crashed and I lost that run. I have 40 populations (samples and results), but it seems like I have to start all over again. Is there a way to 'feed' previously generated data into NSGA-II so that it starts off with that knowledge?

Thanks for the great tool!

aarongarrett commented 4 years ago

Yes. You can pass a list of candidates as seeds into the evolve method. For instance, suppose you had two candidates that you wanted to start from: [0, 8, 6, 7] and [5, 3, 0, 9]. Then you could make a call like this to evolve:

myec.evolve(generator=mygen, evaluator=myeval, pop_size=100, seeds=[[0, 8, 6, 7], [5, 3, 0, 9]])

Obviously, if you have lots of stuff, you'd prefer to read them from a file and build that list programmatically. Also, make sure your pop_size is at least as large as your number of seed candidates.

-- Aaron Garrett

On Mon, Aug 12, 2019 at 1:50 PM Jin Whan Bae notifications@github.com wrote:

  • inspyred version: 1.0
  • Python version: 3.7.3
  • Operating System: MAC OS

Description

I am using Inspyred to run NSGA-II to do multiobjective optimization on a very computationally heavy problem. While running, my cluster crashed and I lost that run. I have 40 populations (samples and results), but it seems like I have to start all over again. Is there a way to 'feed' previously generated data into NSGA-II so that it starts off with that knowledge?

Thanks for the great tool!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/aarongarrett/inspyred/issues/18?email_source=notifications&email_token=AALRPXMO6QGWMJG3OZJPAADQEGPGJA5CNFSM4ILDRKJ2YY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HEYXJLA, or mute the thread https://github.com/notifications/unsubscribe-auth/AALRPXL7XNMS7PA2FROSUU3QEGPGJANCNFSM4ILDRKJQ .

jbae11 commented 4 years ago

thanks for the very quick reply. Is it possible to maybe give them the 'solutions' as well? For example, if I am optimizing a multiobjective function with 4 inputs and 2 outputs, can I input 10 sets of 4 inputs and 2 outputs so that the NSGA-II starts with those datasets 'in mind'?

aarongarrett commented 4 years ago

So you also want to give it the fitness values? That's not as simple to do. We'd have to write some custom code for that. Or maybe you could load a memoized wrapper with the fitness values for your seed candidates so that the evaluator wouldn't really have to run on those...

-- Aaron Garrett

On Mon, Aug 12, 2019 at 2:41 PM Jin Whan Bae notifications@github.com wrote:

thanks for the very quick reply. Is it possible to maybe give them the 'solutions' as well? For example, if I am optimizing a multiobjective function with 4 inputs and 2 outputs, can I input 10 sets of 4 inputs and 2 outputs so that the NSGA-II starts with those datasets 'in mind'?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aarongarrett/inspyred/issues/18?email_source=notifications&email_token=AALRPXMR5IAMMYHGDQAFDHDQEGVEDA5CNFSM4ILDRKJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4DOOFY#issuecomment-520546071, or mute the thread https://github.com/notifications/unsubscribe-auth/AALRPXPTO72MUIVTHAWFWALQEGVEDANCNFSM4ILDRKJQ .

jbae11 commented 4 years ago

I see, so the best way would be to give them my best candidates for the first generation?

aarongarrett commented 4 years ago

Well, we could figure out a way to get the fitness values loaded, but it would take some coding. I guess it depends on how long your evaluations take. If they only take 30 minutes total to re-evaluate, then that would be far faster than working out a programmatic solution to your problem.

-- Aaron Garrett

On Mon, Aug 12, 2019 at 2:45 PM Jin Whan Bae notifications@github.com wrote:

I see, so the best way would be to give them my best candidates for the first generation?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aarongarrett/inspyred/issues/18?email_source=notifications&email_token=AALRPXO3W7OAH7SOTKHE5I3QEGVTBA5CNFSM4ILDRKJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4DOY7Q#issuecomment-520547454, or mute the thread https://github.com/notifications/unsubscribe-auth/AALRPXNURRYGQVALDGQLEDLQEGVTBANCNFSM4ILDRKJQ .

jbae11 commented 4 years ago

My evaluations take a couple of hours per single evaluation. But I wouldn't want to trouble you with coming up with a new developments.. I bet my use case is quite rare..?

aarongarrett commented 4 years ago

Are you able to send me your code to look at? If so, send it to aaron.lee.garrett@gmail.com

-- Aaron Garrett

On Mon, Aug 12, 2019 at 2:53 PM Jin Whan Bae notifications@github.com wrote:

My evaluations take a couple of hours per single evaluation. But I wouldn't want to trouble you with coming up with a new developments.. I bet my use case is quite rare..?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aarongarrett/inspyred/issues/18?email_source=notifications&email_token=AALRPXLY743GXQHOCB76XJ3QEGWUBA5CNFSM4ILDRKJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4DPSOQ#issuecomment-520550714, or mute the thread https://github.com/notifications/unsubscribe-auth/AALRPXMIJMHZEC537ID6UGTQEGWUBANCNFSM4ILDRKJQ .

jbae11 commented 4 years ago

I'm afraid not, it's not quite for public release. I'm sorry

jbae11 commented 4 years ago

Also, can you tell me what's the best way to cite your software? thanks

aarongarrett commented 4 years ago

Sure. This is what others have done: https://groups.google.com/d/msg/inspyred/K43UQsCLitM/7ltTXyDbAQAJ

-- Aaron Garrett

On Mon, Aug 12, 2019 at 3:05 PM Jin Whan Bae notifications@github.com wrote:

Also, can you tell me what's the best way to cite your software? thanks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/aarongarrett/inspyred/issues/18?email_source=notifications&email_token=AALRPXM63AUTJAJRGT2SIW3QEGX7TA5CNFSM4ILDRKJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD4DQSQI#issuecomment-520554817, or mute the thread https://github.com/notifications/unsubscribe-auth/AALRPXKRLYI6NLFYCWLSLJLQEGX7TANCNFSM4ILDRKJQ .