headmyshoulder / gpcxx

Genetic programming in C++
http://ambrosys.github.io/gpcxx
Boost Software License 1.0
24 stars 5 forks source link

Is there a way to save the population tree for later use? #10

Closed pizzooid closed 8 years ago

pizzooid commented 8 years ago

I would like to interrupt the control flow and only run the program by night. Is it possible to store the population in a file?

headmyshoulder commented 8 years ago

Hi, there are no ready made way, but it shouldn't be to difficult to store the population onto disk and reread it. All you have to do is to write your population via gpcxx::polish to file and reread it via read_polish.

Btw. you are one of the first users of gpcxx besides me. May I ask you for what kind of problems you are using gpcxx and which you choose it? Maybe you have also some hints for further development of even want to participate. I am really interested in getting feedback :)

gchoinka commented 8 years ago

Maybe an other solutions to your problem:

like giving your application very low priority with nice/renice, so your gpcxx application does not interfere with day work in case of CPU usage, RAM usage is still the same

you could also suppend you application with signals (still RAM usage is the same, maybe the OS is smart enough to move it to the swap area, where it does not bother you any more) http://unix.stackexchange.com/questions/2107/how-to-suspend-and-resume-processes

or application hibernating/checkpointing (freezes whole state of an application) http://dmtcp.sourceforge.net/index.html

On Thu, Feb 25, 2016 at 2:36 PM, Pietro notifications@github.com wrote:

I would like to interrupt the control flow and only run the program by night. Is it possible to store the population in a file?

— Reply to this email directly or view it on GitHub https://github.com/Ambrosys/gpcxx/issues/10.

pizzooid commented 8 years ago

Hi, thanks a lot for your answers. I am using it for a side project. I am trying to approximate a slow function in my simulation code and am trying different angles.

I also thought it would be nice to have a way of storing data in case of a computer-crash, or if I want to edit some evolutionary parameters. I am going to try gpcxx::polish.

Thanks a lot

Regarding your feedback (Maybe another Issue would be better):

I think the code is well structured and easy to use. Also the examples were self explanatory. Only sometimes it is a little hard to follow the control flow: (e.g. t.root()->eval() ) How do you navigate the code?

headmyshoulder commented 8 years ago

Hi,

'gpcxx::polish' is the way to serialize and deserialize the expressions. Have a look https://github.com/Ambrosys/gpcxx/blob/master/test/io/polish.cpp#L165 . You need to use node mapper, which create a node from a string.

Regarding you feedback. You are right, sometimes it is difficult to follow the program. At the moment the whole application is quite complicated. We have some ideas how to simplify the whole program but it is not finished yet. The library is in a really early stage and at the moment other features are more important for us.

pizzooid commented 8 years ago

Thank you, it works like a charm.