-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from gugarosa/dev
Merging up dev to master for newest stable release.
- Loading branch information
Showing
365 changed files
with
8,526 additions
and
11,272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
opytimizer.functions.constrained | ||
================================= | ||
|
||
.. automodule:: opytimizer.functions.constrained | ||
:members: | ||
:private-members: | ||
:special-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
opytimizer.functions | ||
========================= | ||
|
||
Instead of using raw and simple functions, why not try this module? Compose high-level abstract functions or even new function-based ideas in order to solve your problems. Note that for now, we will only support multi-objective function strategies. | ||
Instead of using raw and straightforward functions, why not try this module? Compose high-level abstract functions or even new function-based ideas in order to solve your problems. Note that for now, we will only support multi-objective function strategies. | ||
|
||
.. toctree:: | ||
opytimizer.functions.constrained | ||
opytimizer.functions.weighted | ||
|
||
|
||
.. automodule:: opytimizer.functions | ||
:members: | ||
:show-inheritance: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
opytimizer | ||
========================= | ||
=========== | ||
|
||
.. autoclass:: opytimizer.Opytimizer | ||
:members: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
docs/api/opytimizer.utils.decorator.rst → docs/api/opytimizer.utils.callback.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
opytimizer.utils.decorator | ||
opytimizer.utils.callback | ||
=========================== | ||
|
||
.. automodule:: opytimizer.utils.decorator | ||
.. automodule:: opytimizer.utils.callback | ||
:members: | ||
:private-members: | ||
:special-members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
opytimizer.utils.constant | ||
========================== | ||
|
||
.. automodule:: opytimizer.utils.constant | ||
:members: | ||
:private-members: | ||
:special-members: |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
examples/applications/additional_features/create_optimization_checkpoints.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import numpy as np | ||
from opytimark.markers.n_dimensional import Sphere | ||
|
||
from opytimizer import Opytimizer | ||
from opytimizer.core import Function | ||
from opytimizer.optimizers.swarm import PSO | ||
from opytimizer.spaces import SearchSpace | ||
from opytimizer.utils.callback import CheckpointCallback | ||
|
||
# Random seed for experimental consistency | ||
np.random.seed(0) | ||
|
||
# Number of agents and decision variables | ||
n_agents = 20 | ||
n_variables = 2 | ||
|
||
# Lower and upper bounds (has to be the same size as `n_variables`) | ||
lower_bound = [-10, -10] | ||
upper_bound = [10, 10] | ||
|
||
# Creates the space, optimizer and function | ||
space = SearchSpace(n_agents, n_variables, lower_bound, upper_bound) | ||
optimizer = PSO() | ||
function = Function(Sphere()) | ||
|
||
# Bundles every piece into Opytimizer class | ||
opt = Opytimizer(space, optimizer, function, save_agents=False) | ||
|
||
# Runs the optimization task | ||
# CheckpointCallback will snapshot the optimization every `frequency` iterations | ||
opt.start(n_iterations=10, callbacks=[CheckpointCallback(frequency=1)]) |
33 changes: 33 additions & 0 deletions
33
examples/applications/additional_features/multiple_optimization_runnings.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import numpy as np | ||
from opytimark.markers.n_dimensional import Sphere | ||
|
||
from opytimizer import Opytimizer | ||
from opytimizer.core import Function | ||
from opytimizer.optimizers.swarm import PSO | ||
from opytimizer.spaces import SearchSpace | ||
|
||
# Random seed for experimental consistency | ||
np.random.seed(0) | ||
|
||
# Number of agents and decision variables | ||
n_agents = 20 | ||
n_variables = 2 | ||
|
||
# Lower and upper bounds (has to be the same size as `n_variables`) | ||
lower_bound = [-10, -10] | ||
upper_bound = [10, 10] | ||
|
||
# Creates the space, optimizer and function | ||
space = SearchSpace(n_agents, n_variables, lower_bound, upper_bound) | ||
optimizer = PSO() | ||
function = Function(Sphere()) | ||
|
||
# Bundles every piece into Opytimizer class | ||
opt = Opytimizer(space, optimizer, function, save_agents=False) | ||
|
||
# Runs the optimization task | ||
# Every call on `start` will the continue the optimization for `n_iterations` | ||
# Note that the following lines achieves the same results as a 100-iteration running | ||
opt.start(n_iterations=50) | ||
opt.start(n_iterations=25) | ||
opt.start(n_iterations=25) |
38 changes: 38 additions & 0 deletions
38
examples/applications/additional_features/resume_optimization_from_file.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import numpy as np | ||
from opytimark.markers.n_dimensional import Sphere | ||
|
||
from opytimizer import Opytimizer | ||
from opytimizer.core import Function | ||
from opytimizer.optimizers.swarm import PSO | ||
from opytimizer.spaces import SearchSpace | ||
from opytimizer.utils.callback import CheckpointCallback | ||
|
||
# Random seed for experimental consistency | ||
np.random.seed(0) | ||
|
||
# Number of agents and decision variables | ||
n_agents = 20 | ||
n_variables = 2 | ||
|
||
# Lower and upper bounds (has to be the same size as `n_variables`) | ||
lower_bound = [-10, -10] | ||
upper_bound = [10, 10] | ||
|
||
# Creates the space, optimizer and function | ||
space = SearchSpace(n_agents, n_variables, lower_bound, upper_bound) | ||
optimizer = PSO() | ||
function = Function(Sphere()) | ||
|
||
# Bundles every piece into Opytimizer class | ||
opt = Opytimizer(space, optimizer, function, save_agents=False) | ||
|
||
# Runs the optimization task | ||
opt.start(n_iterations=10, callbacks=[CheckpointCallback(frequency=10)]) | ||
|
||
# Deletes the optimization objecs | ||
del opt | ||
|
||
# Loads the task from file and resumes it | ||
# Note that the following lines achieves the same results as a 35-iteration running | ||
opt = Opytimizer.load('iter_10_checkpoint.pkl') | ||
opt.start(n_iterations=25) |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.