Comments (3)
@oni73 apologies for the delay in the reply.
As long as you are using directly the algorithm API (as you show in your example), manually pickling after every evolve based on whatever criterion you like should "just work".
Are you asking about a higher-level API? I am not sure about the added value of a higher-level facility with respect to your code snippet, but I am open to suggestions.
from pygmo2.
Hi @bluescarni ,
many thanks for your reply. Indeed, i can confirm that the proposed approach works and this way we have quite fine-grained control over the evolution process....
what i ended up using is the following:
prob=pygmo.problem()
n_iterations=100
popsize=40
algo = pygmo.algorithm(pygmo.de1220(gen=1))
pop = pygmo.population(prob, popsize)
for i in range(n_iterations):
pop = algo.evolve(pop)
if pop.champion_f < best_f:
best_f = pop.champion_f
save_population(pop, 'experiment-1', i, best_f)
where save_population and load_population are defined as:
def save_population(pop, exp_name, iteration: int, bestf: float):
pop_snapshot_fname = exp_name + '/' + 'population-' + str(iteration) + '-' + str(bestf)
np.savez_compressed(pop_snapshot_fname, x=pop.get_x(), fitnesses=pop.get_f())
def load_population(pop_snapshot_path: str, prob, popsize: int):
print('loading population snapshot', pop_snapshot_path, '...')
xfs = np.load(pop_snapshot_path)
pop = pygmo.population(prob=prob)
for i in range(popsize):
pop.push_back(x=xfs['x'][i], f=xfs['fitnesses'][i])
print('done.')
return pop
IMO, it would be beneficial to provide library support for such functionality.
from pygmo2.
Hi :)
Thank you @oni73 for sharing the code.
I have a large problem to run (weeks or months of computation).
I am concern that if something happens and the code gets interrupted (ex we loose power), I will loose all the progress made.
From the code above, I see that each evolution of the population can be saved.
So I can load the results form the last population evolution before interruption.
My question (@bluescarni) is : Is it possible to warm start a problem? I would provide the starting point and the optimization would resume from there.
from pygmo2.
Related Issues (20)
- Changing population when using decorator meta-problem HOT 2
- [BUG] Constraints are seen as non-linear in the multi-objective case HOT 1
- Unable to install pygmo using pip HOT 3
- [BUG] Can not install pymgo@Ubuntu HOT 2
- mp_island starts its own ipyparallel_bfe even when constructed with an UDBFE [BUG] HOT 3
- [BUG] pyproject.toml and setup.py missing? HOT 2
- [FEATURE] New algorithm
- Support for IDE python type hinting and autocompletion
- [BUG] Batch fitness does not work with pygmo.unconstrain()
- speeding up ipyparallel evolutions [FEATURE]
- [BUG] set_bfe()
- Having callbacks
- [BUG] pygmo interferes with pytorch on Windows system HOT 4
- Bindings for NSGA-III
- Typo in the documentation of MBH
- MBH invalid search space bounds [BUG] HOT 1
- [FEATURE]Release a new version for Python3.12 on Pypi
- The Returns of archipelago.get_champions_x() [BUG] HOT 1
- [BUG] solutions violating the bounds are declared feasible HOT 1
- [BUG] Tests are failing because of changes introduced with numpy 2.x
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pygmo2.