Skip to content

Commit

Permalink
Mco (#190)
Browse files Browse the repository at this point in the history
* Реализация решения задач MCO (#163)

* 1. Добавлены интерфейсы классов для многокритериальной оптимизации

* rename classes

* Рабочая начальная версия mco (#179)

* mco test problem & optim task

* mco test problem & optim task 2

* added mco_process, fixed convolution and added to mco to solverFactory

* mco test problem & optim task 3

* reverted optim task. shouldn't have touched in first place

* fixed bug

* mco test problem & optim task 4

* mco test problem & optim task 5

* mco test problem & optim task 6

* new problem&test, update method

* working ver

* mb work

* delete comment, add task, evolvent for init lambdas, other refac

* delete comment, add start_lambdas&is_scaling, add init_lambdas

* fix with comments

* fix with comments 1

---------

Co-authored-by: MADZEROPIE <ask_ii1@mail.ru>

* MCO rebase to main (#183)

* Benchmarks (#165)

* add benchmarks

* fix readme

* fix readme

* bolt font for arguments

* Перевод комментариев в разделе iOpt на английский для документации (#164)

* Перевод комментариев в разделе iOpt на английский для документации

* Перевод комментариев в разделе iOpt на английский для документации (с исправлениями)

* Исправление замечаний по переводу комментов iOpt

* Исправление замечаний по переводу комментов iOpt (2)

* Перевод комментариев из раздела problems

* Update .readthedocs.yml for current requirements of Read the Docs

* Update .readthedocs.yml

* Update .readthedocs.yml

* Update conf.py for English language

* I supplemented the documentation with a paragraph about the work of the framework with the optimal selection of two real and one discrete parameters. Corrected the problem code for finding real and discrete parameters. (#167)

* Fixed a bug in the calculator destructor (#168)

* Fixed a bug in the calculator destructor

* Fixed problem with process pool destruction

* The design of the example is brought to a single sample

* Correct target score (#170)

* I supplemented the documentation with a paragraph about the work of the framework with the optimal selection of two real and one discrete parameters. Corrected the problem code for finding real and discrete parameters.

* correct target score

* Grid search (#169)

* Fixed a bug in the calculator destructor

* Fixed problem with process pool destruction

* The design of the example is brought to a single sample

* Added grid search

* Fixed search

* Corrected comments

* Fix problem with pool

* Removed unnecessary field

* Corrected comments

* Построение по сеткам известных точек + исправление багов (#172)

* add graph by points

* fix double axes bug

* add lines layers by points

---------

Co-authored-by: Marina Usova <usova@itmm.unn.com>

* Асинхронная параллельная схема (#166)

* async initial

* async up

* async second

* pep8

* pep8

* switch multiprocessing to multiprocess (part of pathos)

* revert gkls example

* revert requirements.txt

* move async implementation from async_parallel_process to async_calculator

* pep8

* redundant code removed

* test for async parallel process

* gkls async example
add multiprocess to requirements

* gkls async example

* async initial

* async up

* async second

* pep8

* pep8

* switch multiprocessing to multiprocess (part of pathos)

* revert gkls example

* revert requirements.txt

* move async implementation from async_parallel_process to async_calculator

* pep8

* redundant code removed

* test for async parallel process

* gkls async example
add multiprocess to requirements

* gkls async example

* semi-fix for iter-tasks

* Fixed test for asynchronous parallel circuit (#173)

* Fixed a bug in the calculator destructor

* Fixed problem with process pool destruction

* The design of the example is brought to a single sample

* Fixed test for asynchronous parallel circuit

* add characteristic in save progress (#176)

* add characteristic in save progress

* add sol time&accuracy

* Дополнение для сохранения в JSON (#177)

* add characteristic in save progress

* add sol time&accuracy

* add Task, Parameters and creation_time for sd_item in save_progress

* change save&load

* Update method.py

* meaningless change

* add _init_ in loadProgress

* The output of the optimal solution in problems with restrictions has … (#180)

* The output of the optimal solution in problems with restrictions has been corrected
Parallel index calculator is working properly

* Update Stronginc3_example.py

* Fix bug with original optimum using (#181)

* fix bug with original optimum using

* add var for number of constraints and fix objective function value

---------

Co-authored-by: Marina Usova <usova@itmm.unn.com>

* Corrected documentation of examples (#182)

* I supplemented the documentation with a paragraph about the work of the framework with the optimal selection of two real and one discrete parameters. Corrected the problem code for finding real and discrete parameters.

* correct target score

* Append new examples. Correct documentation

* Corrected documentation of examples

* The calculator is used in trial calculation

* Added work with the calculator

* Реализация решения задач MCO (#163)

* 1. Добавлены интерфейсы классов для многокритериальной оптимизации

* rename classes

* Рабочая начальная версия mco (#179)

* mco test problem & optim task

* mco test problem & optim task 2

* added mco_process, fixed convolution and added to mco to solverFactory

* mco test problem & optim task 3

* reverted optim task. shouldn't have touched in first place

* fixed bug

* mco test problem & optim task 4

* mco test problem & optim task 5

* mco test problem & optim task 6

* new problem&test, update method

* working ver

* mb work

* delete comment, add task, evolvent for init lambdas, other refac

* delete comment, add start_lambdas&is_scaling, add init_lambdas

* fix with comments

* fix with comments 1

---------

Co-authored-by: MADZEROPIE <ask_ii1@mail.ru>

* The calculator is used in trial calculation

* Added work with the calculator

* Corrected to match the updated interface

* Added example with MCO Test1

* Fixed calculator factory

---------

Co-authored-by: dyonichhh <36537172+RodionovDenis@users.noreply.github.com>
Co-authored-by: Anton A. Shtanyuk <ashtanyuk@gmail.com>
Co-authored-by: Alexander Sysoyev <sysoyev@vmk.unn.ru>
Co-authored-by: Karchkov Denis <karchkov.denis@mail.ru>
Co-authored-by: UsovaMA <oppabang@mail.ru>
Co-authored-by: Marina Usova <usova@itmm.unn.com>
Co-authored-by: oleg-w570 <73493289+oleg-w570@users.noreply.github.com>
Co-authored-by: Yanina Kolt <43132462+YaniKolt@users.noreply.github.com>
Co-authored-by: kozinove <evgeniy.kozinov@gmail.com>
Co-authored-by: MADZEROPIE <ask_ii1@mail.ru>

* Mco (#186)

* Added support for parallel computing
mco_process.py -> mco_method_many_lambdas.py

* fix tests

* Исправлена асинхронная схема

* fix comments

* fix comment

* fix comment

* Add mco breast cancer problem (#187)

* Benchmarks (#165)

* add benchmarks

* fix readme

* fix readme

* bolt font for arguments

* Перевод комментариев в разделе iOpt на английский для документации (#164)

* Перевод комментариев в разделе iOpt на английский для документации

* Перевод комментариев в разделе iOpt на английский для документации (с исправлениями)

* Исправление замечаний по переводу комментов iOpt

* Исправление замечаний по переводу комментов iOpt (2)

* Перевод комментариев из раздела problems

* Update .readthedocs.yml for current requirements of Read the Docs

* Update .readthedocs.yml

* Update .readthedocs.yml

* Update conf.py for English language

* I supplemented the documentation with a paragraph about the work of the framework with the optimal selection of two real and one discrete parameters. Corrected the problem code for finding real and discrete parameters. (#167)

* Fixed a bug in the calculator destructor (#168)

* Fixed a bug in the calculator destructor

* Fixed problem with process pool destruction

* The design of the example is brought to a single sample

* Correct target score (#170)

* I supplemented the documentation with a paragraph about the work of the framework with the optimal selection of two real and one discrete parameters. Corrected the problem code for finding real and discrete parameters.

* correct target score

* Grid search (#169)

* Fixed a bug in the calculator destructor

* Fixed problem with process pool destruction

* The design of the example is brought to a single sample

* Added grid search

* Fixed search

* Corrected comments

* Fix problem with pool

* Removed unnecessary field

* Corrected comments

* Построение по сеткам известных точек + исправление багов (#172)

* add graph by points

* fix double axes bug

* add lines layers by points

---------

Co-authored-by: Marina Usova <usova@itmm.unn.com>

* Асинхронная параллельная схема (#166)

* async initial

* async up

* async second

* pep8

* pep8

* switch multiprocessing to multiprocess (part of pathos)

* revert gkls example

* revert requirements.txt

* move async implementation from async_parallel_process to async_calculator

* pep8

* redundant code removed

* test for async parallel process

* gkls async example
add multiprocess to requirements

* gkls async example

* async initial

* async up

* async second

* pep8

* pep8

* switch multiprocessing to multiprocess (part of pathos)

* revert gkls example

* revert requirements.txt

* move async implementation from async_parallel_process to async_calculator

* pep8

* redundant code removed

* test for async parallel process

* gkls async example
add multiprocess to requirements

* gkls async example

* semi-fix for iter-tasks

* Fixed test for asynchronous parallel circuit (#173)

* Fixed a bug in the calculator destructor

* Fixed problem with process pool destruction

* The design of the example is brought to a single sample

* Fixed test for asynchronous parallel circuit

* add characteristic in save progress (#176)

* add characteristic in save progress

* add sol time&accuracy

* Дополнение для сохранения в JSON (#177)

* add characteristic in save progress

* add sol time&accuracy

* add Task, Parameters and creation_time for sd_item in save_progress

* change save&load

* Update method.py

* meaningless change

* add _init_ in loadProgress

* The output of the optimal solution in problems with restrictions has … (#180)

* The output of the optimal solution in problems with restrictions has been corrected
Parallel index calculator is working properly

* Update Stronginc3_example.py

* Fix bug with original optimum using (#181)

* fix bug with original optimum using

* add var for number of constraints and fix objective function value

---------

Co-authored-by: Marina Usova <usova@itmm.unn.com>

* Corrected documentation of examples (#182)

* I supplemented the documentation with a paragraph about the work of the framework with the optimal selection of two real and one discrete parameters. Corrected the problem code for finding real and discrete parameters.

* correct target score

* Append new examples. Correct documentation

* Corrected documentation of examples

* The calculator is used in trial calculation

* Added work with the calculator

* Реализация решения задач MCO (#163)

* 1. Добавлены интерфейсы классов для многокритериальной оптимизации

* rename classes

* Рабочая начальная версия mco (#179)

* mco test problem & optim task

* mco test problem & optim task 2

* added mco_process, fixed convolution and added to mco to solverFactory

* mco test problem & optim task 3

* reverted optim task. shouldn't have touched in first place

* fixed bug

* mco test problem & optim task 4

* mco test problem & optim task 5

* mco test problem & optim task 6

* new problem&test, update method

* working ver

* mb work

* delete comment, add task, evolvent for init lambdas, other refac

* delete comment, add start_lambdas&is_scaling, add init_lambdas

* fix with comments

* fix with comments 1

---------

Co-authored-by: MADZEROPIE <ask_ii1@mail.ru>

* The calculator is used in trial calculation

* Added work with the calculator

* Corrected to match the updated interface

* Added example with MCO Test1

* Fixed calculator factory

* Add mco breast cancer problem

* line end character changed

* Files moved

* Corrected comments

---------

Co-authored-by: dyonichhh <36537172+RodionovDenis@users.noreply.github.com>
Co-authored-by: Anton A. Shtanyuk <ashtanyuk@gmail.com>
Co-authored-by: Alexander Sysoyev <sysoyev@vmk.unn.ru>
Co-authored-by: Karchkov Denis <karchkov.denis@mail.ru>
Co-authored-by: UsovaMA <oppabang@mail.ru>
Co-authored-by: Marina Usova <usova@itmm.unn.com>
Co-authored-by: oleg-w570 <73493289+oleg-w570@users.noreply.github.com>
Co-authored-by: Yanina Kolt <43132462+YaniKolt@users.noreply.github.com>
Co-authored-by: kozinove <evgeniy.kozinov@gmail.com>
Co-authored-by: MADZEROPIE <ask_ii1@mail.ru>

* Реализация решения задач MCO (#163)

* 1. Добавлены интерфейсы классов для многокритериальной оптимизации

* rename classes

* Рабочая начальная версия mco (#179)

* mco test problem & optim task

* mco test problem & optim task 2

* added mco_process, fixed convolution and added to mco to solverFactory

* mco test problem & optim task 3

* reverted optim task. shouldn't have touched in first place

* fixed bug

* mco test problem & optim task 4

* mco test problem & optim task 5

* mco test problem & optim task 6

* new problem&test, update method

* working ver

* mb work

* delete comment, add task, evolvent for init lambdas, other refac

* delete comment, add start_lambdas&is_scaling, add init_lambdas

* fix with comments

* fix with comments 1

---------

Co-authored-by: MADZEROPIE <ask_ii1@mail.ru>

* MCO rebase to main (#183)

* Benchmarks (#165)

* add benchmarks

* fix readme

* fix readme

* bolt font for arguments

* Перевод комментариев в разделе iOpt на английский для документации (#164)

* Перевод комментариев в разделе iOpt на английский для документации

* Перевод комментариев в разделе iOpt на английский для документации (с исправлениями)

* Исправление замечаний по переводу комментов iOpt

* Исправление замечаний по переводу комментов iOpt (2)

* Перевод комментариев из раздела problems

* Update .readthedocs.yml for current requirements of Read the Docs

* Update .readthedocs.yml

* Update .readthedocs.yml

* Update conf.py for English language

* I supplemented the documentation with a paragraph about the work of the framework with the optimal selection of two real and one discrete parameters. Corrected the problem code for finding real and discrete parameters. (#167)

* Fixed a bug in the calculator destructor (#168)

* Fixed a bug in the calculator destructor

* Fixed problem with process pool destruction

* The design of the example is brought to a single sample

* Correct target score (#170)

* I supplemented the documentation with a paragraph about the work of the framework with the optimal selection of two real and one discrete parameters. Corrected the problem code for finding real and discrete parameters.

* correct target score

* Grid search (#169)

* Fixed a bug in the calculator destructor

* Fixed problem with process pool destruction

* The design of the example is brought to a single sample

* Added grid search

* Fixed search

* Corrected comments

* Fix problem with pool

* Removed unnecessary field

* Corrected comments

* Построение по сеткам известных точек + исправление багов (#172)

* add graph by points

* fix double axes bug

* add lines layers by points

---------

Co-authored-by: Marina Usova <usova@itmm.unn.com>

* Асинхронная параллельная схема (#166)

* async initial

* async up

* async second

* pep8

* pep8

* switch multiprocessing to multiprocess (part of pathos)

* revert gkls example

* revert requirements.txt

* move async implementation from async_parallel_process to async_calculator

* pep8

* redundant code removed

* test for async parallel process

* gkls async example
add multiprocess to requirements

* gkls async example

* async initial

* async up

* async second

* pep8

* pep8

* switch multiprocessing to multiprocess (part of pathos)

* revert gkls example

* revert requirements.txt

* move async implementation from async_parallel_process to async_calculator

* pep8

* redundant code removed

* test for async parallel process

* gkls async example
add multiprocess to requirements

* gkls async example

* semi-fix for iter-tasks

* Fixed test for asynchronous parallel circuit (#173)

* Fixed a bug in the calculator destructor

* Fixed problem with process pool destruction

* The design of the example is brought to a single sample

* Fixed test for asynchronous parallel circuit

* add characteristic in save progress (#176)

* add characteristic in save progress

* add sol time&accuracy

* Дополнение для сохранения в JSON (#177)

* add characteristic in save progress

* add sol time&accuracy

* add Task, Parameters and creation_time for sd_item in save_progress

* change save&load

* Update method.py

* meaningless change

* add _init_ in loadProgress

* The output of the optimal solution in problems with restrictions has … (#180)

* The output of the optimal solution in problems with restrictions has been corrected
Parallel index calculator is working properly

* Update Stronginc3_example.py

* Fix bug with original optimum using (#181)

* fix bug with original optimum using

* add var for number of constraints and fix objective function value

---------

Co-authored-by: Marina Usova <usova@itmm.unn.com>

* Corrected documentation of examples (#182)

* I supplemented the documentation with a paragraph about the work of the framework with the optimal selection of two real and one discrete parameters. Corrected the problem code for finding real and discrete parameters.

* correct target score

* Append new examples. Correct documentation

* Corrected documentation of examples

* The calculator is used in trial calculation

* Added work with the calculator

* Реализация решения задач MCO (#163)

* 1. Добавлены интерфейсы классов для многокритериальной оптимизации

* rename classes

* Рабочая начальная версия mco (#179)

* mco test problem & optim task

* mco test problem & optim task 2

* added mco_process, fixed convolution and added to mco to solverFactory

* mco test problem & optim task 3

* reverted optim task. shouldn't have touched in first place

* fixed bug

* mco test problem & optim task 4

* mco test problem & optim task 5

* mco test problem & optim task 6

* new problem&test, update method

* working ver

* mb work

* delete comment, add task, evolvent for init lambdas, other refac

* delete comment, add start_lambdas&is_scaling, add init_lambdas

* fix with comments

* fix with comments 1

---------

Co-authored-by: MADZEROPIE <ask_ii1@mail.ru>

* The calculator is used in trial calculation

* Added work with the calculator

* Corrected to match the updated interface

* Added example with MCO Test1

* Fixed calculator factory

---------

Co-authored-by: dyonichhh <36537172+RodionovDenis@users.noreply.github.com>
Co-authored-by: Anton A. Shtanyuk <ashtanyuk@gmail.com>
Co-authored-by: Alexander Sysoyev <sysoyev@vmk.unn.ru>
Co-authored-by: Karchkov Denis <karchkov.denis@mail.ru>
Co-authored-by: UsovaMA <oppabang@mail.ru>
Co-authored-by: Marina Usova <usova@itmm.unn.com>
Co-authored-by: oleg-w570 <73493289+oleg-w570@users.noreply.github.com>
Co-authored-by: Yanina Kolt <43132462+YaniKolt@users.noreply.github.com>
Co-authored-by: kozinove <evgeniy.kozinov@gmail.com>
Co-authored-by: MADZEROPIE <ask_ii1@mail.ru>

* Mco (#186)

* Added support for parallel computing
mco_process.py -> mco_method_many_lambdas.py

* fix tests

* Исправлена асинхронная схема

* fix comments

* fix comment

* fix comment

* Add mco breast cancer problem (#187)

* Benchmarks (#165)

* add benchmarks

* fix readme

* fix readme

* bolt font for arguments

* Перевод комментариев в разделе iOpt на английский для документации (#164)

* Перевод комментариев в разделе iOpt на английский для документации

* Перевод комментариев в разделе iOpt на английский для документации (с исправлениями)

* Исправление замечаний по переводу комментов iOpt

* Исправление замечаний по переводу комментов iOpt (2)

* Перевод комментариев из раздела problems

* Update .readthedocs.yml for current requirements of Read the Docs

* Update .readthedocs.yml

* Update .readthedocs.yml

* Update conf.py for English language

* I supplemented the documentation with a paragraph about the work of the framework with the optimal selection of two real and one discrete parameters. Corrected the problem code for finding real and discrete parameters. (#167)

* Fixed a bug in the calculator destructor (#168)

* Fixed a bug in the calculator destructor

* Fixed problem with process pool destruction

* The design of the example is brought to a single sample

* Correct target score (#170)

* I supplemented the documentation with a paragraph about the work of the framework with the optimal selection of two real and one discrete parameters. Corrected the problem code for finding real and discrete parameters.

* correct target score

* Grid search (#169)

* Fixed a bug in the calculator destructor

* Fixed problem with process pool destruction

* The design of the example is brought to a single sample

* Added grid search

* Fixed search

* Corrected comments

* Fix problem with pool

* Removed unnecessary field

* Corrected comments

* Построение по сеткам известных точек + исправление багов (#172)

* add graph by points

* fix double axes bug

* add lines layers by points

---------

Co-authored-by: Marina Usova <usova@itmm.unn.com>

* Асинхронная параллельная схема (#166)

* async initial

* async up

* async second

* pep8

* pep8

* switch multiprocessing to multiprocess (part of pathos)

* revert gkls example

* revert requirements.txt

* move async implementation from async_parallel_process to async_calculator

* pep8

* redundant code removed

* test for async parallel process

* gkls async example
add multiprocess to requirements

* gkls async example

* async initial

* async up

* async second

* pep8

* pep8

* switch multiprocessing to multiprocess (part of pathos)

* revert gkls example

* revert requirements.txt

* move async implementation from async_parallel_process to async_calculator

* pep8

* redundant code removed

* test for async parallel process

* gkls async example
add multiprocess to requirements

* gkls async example

* semi-fix for iter-tasks

* Fixed test for asynchronous parallel circuit (#173)

* Fixed a bug in the calculator destructor

* Fixed problem with process pool destruction

* The design of the example is brought to a single sample

* Fixed test for asynchronous parallel circuit

* add characteristic in save progress (#176)

* add characteristic in save progress

* add sol time&accuracy

* Дополнение для сохранения в JSON (#177)

* add characteristic in save progress

* add sol time&accuracy

* add Task, Parameters and creation_time for sd_item in save_progress

* change save&load

* Update method.py

* meaningless change

* add _init_ in loadProgress

* The output of the optimal solution in problems with restrictions has … (#180)

* The output of the optimal solution in problems with restrictions has been corrected
Parallel index calculator is working properly

* Update Stronginc3_example.py

* Fix bug with original optimum using (#181)

* fix bug with original optimum using

* add var for number of constraints and fix objective function value

---------

Co-authored-by: Marina Usova <usova@itmm.unn.com>

* Corrected documentation of examples (#182)

* I supplemented the documentation with a paragraph about the work of the framework with the optimal selection of two real and one discrete parameters. Corrected the problem code for finding real and discrete parameters.

* correct target score

* Append new examples. Correct documentation

* Corrected documentation of examples

* The calculator is used in trial calculation

* Added work with the calculator

* Реализация решения задач MCO (#163)

* 1. Добавлены интерфейсы классов для многокритериальной оптимизации

* rename classes

* Рабочая начальная версия mco (#179)

* mco test problem & optim task

* mco test problem & optim task 2

* added mco_process, fixed convolution and added to mco to solverFactory

* mco test problem & optim task 3

* reverted optim task. shouldn't have touched in first place

* fixed bug

* mco test problem & optim task 4

* mco test problem & optim task 5

* mco test problem & optim task 6

* new problem&test, update method

* working ver

* mb work

* delete comment, add task, evolvent for init lambdas, other refac

* delete comment, add start_lambdas&is_scaling, add init_lambdas

* fix with comments

* fix with comments 1

---------

Co-authored-by: MADZEROPIE <ask_ii1@mail.ru>

* The calculator is used in trial calculation

* Added work with the calculator

* Corrected to match the updated interface

* Added example with MCO Test1

* Fixed calculator factory

* Add mco breast cancer problem

* line end character changed

* Files moved

* Corrected comments

---------

Co-authored-by: dyonichhh <36537172+RodionovDenis@users.noreply.github.com>
Co-authored-by: Anton A. Shtanyuk <ashtanyuk@gmail.com>
Co-authored-by: Alexander Sysoyev <sysoyev@vmk.unn.ru>
Co-authored-by: Karchkov Denis <karchkov.denis@mail.ru>
Co-authored-by: UsovaMA <oppabang@mail.ru>
Co-authored-by: Marina Usova <usova@itmm.unn.com>
Co-authored-by: oleg-w570 <73493289+oleg-w570@users.noreply.github.com>
Co-authored-by: Yanina Kolt <43132462+YaniKolt@users.noreply.github.com>
Co-authored-by: kozinove <evgeniy.kozinov@gmail.com>
Co-authored-by: MADZEROPIE <ask_ii1@mail.ru>

* Corrected design

* Fixed a bug in task connection

* Fixed examples of optimizing the launch of a genetic algorithm

* Corrected comments

* Corrected design

* Corrected comments

---------

Co-authored-by: kozinove <evgeniy.kozinov@gmail.com>
Co-authored-by: Yanina Kolt <43132462+YaniKolt@users.noreply.github.com>
Co-authored-by: MADZEROPIE <ask_ii1@mail.ru>
Co-authored-by: dyonichhh <36537172+RodionovDenis@users.noreply.github.com>
Co-authored-by: Anton A. Shtanyuk <ashtanyuk@gmail.com>
Co-authored-by: Alexander Sysoyev <sysoyev@vmk.unn.ru>
Co-authored-by: Karchkov Denis <karchkov.denis@mail.ru>
Co-authored-by: UsovaMA <oppabang@mail.ru>
Co-authored-by: Marina Usova <usova@itmm.unn.com>
Co-authored-by: oleg-w570 <73493289+oleg-w570@users.noreply.github.com>
  • Loading branch information
11 people committed May 8, 2024
1 parent 0f04ac4 commit be52caa
Show file tree
Hide file tree
Showing 48 changed files with 2,322 additions and 153 deletions.
1 change: 0 additions & 1 deletion examples/GKLS_async_example.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from iOpt.output_system.listeners.console_outputers import ConsoleOutputListener
from iOpt.output_system.listeners.static_painters import StaticPainterNDListener
from iOpt.solver import Solver
from iOpt.solver_parametrs import SolverParameters
from problems.GKLS import GKLS
Expand Down
1 change: 0 additions & 1 deletion examples/GKLS_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@

# Решение задачи
solver.solve()

Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ def calculate(self, point: Point, function_value: FunctionValue) -> FunctionValu
:param function_value: объект хранения значения целевой функции в точке
"""
mutation_prob = point.float_variables[0]
ga_tsp = GA_TSP(func=self.calc_total_distance,
ga_tsp = GA_TSP(func=lambda x: self.calc_total_distance(x),
n_dim=self.n_dim, size_pop=self.populationSize,
max_iter=self.numberOfIterations, prob_mut=mutation_prob)
best_points, best_distance = ga_tsp.run()
function_value.value = best_distance[0]
# print(best_distance[0])
return function_value
return function_value
5 changes: 2 additions & 3 deletions examples/Genetic_algorithm/TSP/_2D/Problems/ga_tsp_2d.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import numpy as np
from iOpt.trial import Point
from iOpt.trial import FunctionValue
from iOpt.trial import Trial
from iOpt.problem import Problem
from sko.GA import GA_TSP
from typing import Dict
Expand Down Expand Up @@ -73,10 +72,10 @@ def calculate(self, point: Point, function_value: FunctionValue) -> FunctionValu
if num_population % 2 != 0:
num_population -= 1

ga_tsp = GA_TSP(func=self.calc_total_distance,
ga_tsp = GA_TSP(func=lambda x: self.calc_total_distance(x),
n_dim=self.n_dim, size_pop=num_population,
max_iter=int(self.numberOfIterations), prob_mut=mutation_prob)
best_points, best_distance = ga_tsp.run()
function_value.value = best_distance[0]
print(best_distance[0])
#print(best_distance[0])
return function_value
40 changes: 40 additions & 0 deletions examples/MCO_Grishagin_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from problems.grishagin_mco import Grishagin_mco
from iOpt.solver import Solver
from iOpt.solver_parametrs import SolverParameters
from iOpt.output_system.listeners.console_outputers import ConsoleOutputListener
import matplotlib.pyplot as plt

if __name__ == "__main__":

problem = Grishagin_mco(2, [3, 2])

params = SolverParameters(r=2.5, eps=0.01, iters_limit=16000,
number_of_lambdas=50, start_lambdas=[[0, 1]],
is_scaling=False, number_of_parallel_points=2,
async_scheme=True)

solver = Solver(problem=problem, parameters=params)

cfol = ConsoleOutputListener(mode='full')
solver.add_listener(cfol)

sol = solver.solve()

# output of the Pareto set (coordinates - function values)
var = [trial.point.float_variables for trial in sol.best_trials]
val = [[trial.function_values[i].value for i in range(2)] for trial in sol.best_trials]
print("size pareto set: ", len(var))
for fvar, fval in zip(var, val):
print(fvar, fval)

x1 = [trial.point.float_variables[0] for trial in sol.best_trials]
x2 = [trial.point.float_variables[1] for trial in sol.best_trials]

plt.plot(x1, x2, 'ro')
plt.show()

fv1 = [trial.function_values[0].value for trial in sol.best_trials]
fv2 = [trial.function_values[1].value for trial in sol.best_trials]

plt.plot(fv1, fv2, 'ro')
plt.show()
49 changes: 49 additions & 0 deletions examples/MCO_Test1_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
from problems.mco_test1 import mco_test1
from iOpt.solver import Solver
from iOpt.solver_parametrs import SolverParameters

from iOpt.output_system.listeners.console_outputers import ConsoleOutputListener
import matplotlib.pyplot as plt

if __name__ == "__main__":
"""
Минимизация тестовой функции #1 многокритериальной оптимизации
"""

# Создаем объект задачи
problem = mco_test1()

# Формируем параметры решателя
params = SolverParameters(r=3.0, eps=0.01, iters_limit=16000, number_of_lambdas=50,
start_lambdas=[[0, 1]], is_scaling=False)

# Создаем решатель
solver = Solver(problem=problem, parameters=params)

# Добавляем вывод результатов в консоль
cfol = ConsoleOutputListener(mode='full')
solver.add_listener(cfol)

# Решаем задачу
sol = solver.solve()

# Выводим множество Парето
var = [trial.point.float_variables for trial in sol.best_trials]
val = [[trial.function_values[i].value for i in range(2)] for trial in sol.best_trials]
print("size pareto set: ", len(var))
for fvar, fval in zip(var, val):
print(fvar, fval)

# Точки для построения
# x1 = [trial.point.float_variables[0] for trial in sol.best_trials]
# x2 = [trial.point.float_variables[1] for trial in sol.best_trials]

# plt.plot(x1, x2, 'ro')
# plt.show()

# Точки для построения графика множества Парето y[0]-y[1]
fv1 = [trial.function_values[0].value for trial in sol.best_trials]
fv2 = [trial.function_values[1].value for trial in sol.best_trials]

plt.plot(fv1, fv2, 'ro')
plt.show()
73 changes: 73 additions & 0 deletions examples/Machine_learning/SVC/_2D/MCO_breast_cancer_example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
from Problems.mco_breast_cancer import mco_breast_cancer

from iOpt.solver import Solver
from iOpt.solver_parametrs import SolverParameters
from iOpt.output_system.listeners.console_outputers import ConsoleOutputListener
import matplotlib.pyplot as plt
from sklearn.datasets import load_breast_cancer
from sklearn.model_selection import train_test_split

# Для построения HV индекса
#from pymoo.util.misc import stack
#from pymoo.indicators.hv import HV
#import numpy as np

if __name__ == "__main__":
"""
Пробный пример многокритериальной оптимизации
"""

# Загружаем датасет
X, y = load_breast_cancer(return_X_y=True)

# Разбиваем датасет на тренировочную и проверочную части
X_train, X_valid, y_train, y_valid = train_test_split(X, y)

# Создаем объект задачи
problem = mco_breast_cancer(X, y, X_train, y_train)

# Формируем параметры решателя
params = SolverParameters(r=3.0, eps=0.01, iters_limit=200, number_of_lambdas=50,
start_lambdas=[[0, 1]], is_scaling=False)

# Создаем решатель
solver = Solver(problem=problem, parameters=params)

# Добавляем вывод результатов в консоль
cfol = ConsoleOutputListener(mode='full')
solver.add_listener(cfol)

# Решаем задачу
sol = solver.solve()

# Выводим множество Парето (координаты - значения функций)
var = [trial.point.float_variables for trial in sol.best_trials]
val = [[-trial.function_values[i].value for i in range(2)] for trial in sol.best_trials]

print("size pareto set: ", len(var))
for fvar, fval in zip(var, val):
print(fvar, fval)

# Строим график множества Парето z[0]-z[1]
fv1 = [-trial.function_values[0].value for trial in sol.best_trials]
fv2 = [-trial.function_values[1].value for trial in sol.best_trials]
plt.plot(fv1, fv2, 'ro')
plt.show()

########################################################################
## Вычисляем HV индекс
########################################################################

## Вычисляем отраженное Парето множество
#data = 1-np.array(val)
#ref_point = np.array([1.0, 1.0])
#print("reference point:")
#print(ref_point)
#print("Pareto set:")
#print(data)

## Создаем объект для подсчета HV индекса
#ind = HV(ref_point=ref_point)

## Считаем и выводим HV индекс
#print("HV", ind(data))
67 changes: 67 additions & 0 deletions examples/Machine_learning/SVC/_2D/Problems/mco_breast_cancer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import numpy as np

from iOpt.trial import Point
from iOpt.trial import FunctionValue
from iOpt.trial import Trial
from iOpt.problem import Problem

from sklearn.model_selection import cross_val_score

from sklearn.svm import SVC


class mco_breast_cancer(Problem):

def __init__(self, X, y, X_train, y_train):
"""
Конструктор класса breast_cancer problem.
"""

super(mco_breast_cancer, self).__init__()

self.X = X
self.y = y
self.X_train = X_train
self.y_train = y_train

self.name = "mco_test1"
self.dimension = 2
self.number_of_float_variables = 2
self.number_of_discrete_variables = 0
self.number_of_objectives = 2
self.number_of_constraints = 0

self.float_variable_names = np.ndarray(shape=(self.number_of_float_variables,), dtype=object)

for i in range(self.number_of_float_variables):
self.float_variable_names[i] = str(i)

self.lower_bound_of_float_variables = np.array([1, -7], dtype=np.double)
self.upper_bound_of_float_variables = np.array([6, -3], dtype=np.double)

self.known_optimum = np.ndarray(shape=(1,), dtype=Trial)

def calculate(self, point: Point, function_value: FunctionValue) -> FunctionValue:
"""
Вычисление значения выбранной функции в заданной точке.
:param point: координаты точки испытания, в которой будет вычислено значение функции
:param function_value: объект, определяющий номер функции в задаче и хранящий значение функции
:return: вычисленное значение функции в точке point
"""
result: np.double = 0
x = point.float_variables

svc_c = 10 ** x[0]
gamma = 10 ** x[1]

classifier_obj = SVC(C=svc_c, gamma=gamma)
classifier_obj.fit(self.X_train, self.y_train)

if function_value.functionID == 0: # OBJECTIV 1
result = - cross_val_score(classifier_obj, self.X, self.y, n_jobs=4, scoring='precision').mean()
elif function_value.functionID == 1: # OBJECTIV 2
result = - cross_val_score(classifier_obj, self.X, self.y, n_jobs=4, scoring='recall').mean()

function_value.value = result
return function_value
3 changes: 1 addition & 2 deletions examples/grid_search_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
cfol = ConsoleOutputListener(mode='full')
solver2.add_listener(cfol)


solver2.load_progress(log)

solver2.release_all_listener()
solver2.release_all_listener()
1 change: 1 addition & 0 deletions iOpt/method/async_calculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def _take_calculated_point(
self, block: bool
) -> tuple[SearchDataItem, SearchDataItem]:
newpoint = self.done_queue.get(block=block)
self.evaluate_method.copy_functionals(newpoint, newpoint)
oldpoint = self.waiting_oldpoints.pop(newpoint.get_x())
oldpoint.blocked = False
return newpoint, oldpoint
Expand Down
10 changes: 6 additions & 4 deletions iOpt/method/async_parallel_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@

from iOpt.evolvent.evolvent import Evolvent
from iOpt.method.async_calculator import AsyncCalculator
from iOpt.method.index_method_calculator import IndexMethodCalculator
from iOpt.method.listener import Listener
from iOpt.method.method import Method
from iOpt.method.optim_task import OptimizationTask
from iOpt.method.process import Process
from iOpt.method.search_data import SearchData
from iOpt.solution import Solution
from iOpt.solver_parametrs import SolverParameters
from iOpt.method.calculator import Calculator


class AsyncParallelProcess(Process):
Expand All @@ -22,18 +22,20 @@ def __init__(
search_data: SearchData,
method: Method,
listeners: list[Listener],
calculator: Calculator = None
):
super(AsyncParallelProcess, self).__init__(
parameters, task, evolvent, search_data, method, listeners
parameters, task, evolvent, search_data, method, listeners, calculator
)
self.calculator = AsyncCalculator(IndexMethodCalculator(task), parameters)
from iOpt.method.solverFactory import SolverFactory
self.calculator = AsyncCalculator(SolverFactory.create_evaluate_method(task), parameters)

def do_global_iteration(self, number: int = 1) -> None:
done_trials = []
if self._first_iteration is True:
for listener in self._listeners:
listener.before_method_start(self.method)
done_trials = self.method.first_iteration(self.calculator)
done_trials = self.method.first_iteration()
self._first_iteration = False
number -= 1

Expand Down
Loading

0 comments on commit be52caa

Please sign in to comment.