setup.py 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. from setuptools import setup
  2. import distutils.command.check
  3. class TestCommand(distutils.command.check.check):
  4. """Custom test command."""
  5. def run(self):
  6. # run tests using doctest
  7. import doctest
  8. # set specific seed for pseudo-random process
  9. import random
  10. import numpy as np
  11. # discrete and continuous solutions module
  12. from macop.solutions import discrete
  13. from macop.solutions import continuous
  14. # operators module
  15. from macop.operators.discrete import mutators as discrete_mutators
  16. from macop.operators.discrete import crossovers as discrete_crossovers
  17. from macop.operators.continuous import mutators as continuous_mutators
  18. from macop.operators.continuous import crossovers as continuous_crossovers
  19. # policies module
  20. from macop.policies import classicals
  21. from macop.policies import reinforcement
  22. # evaluators module
  23. from macop.evaluators.discrete import mono as discrete_mono
  24. from macop.evaluators.discrete import multi as discrete_multi
  25. # algorithms
  26. from macop.algorithms import mono as algo_mono
  27. from macop.algorithms import multi as algo_multi
  28. # run all doctest
  29. print("==============================")
  30. print("Runs test command...")
  31. random.seed(42)
  32. np.random.seed(42)
  33. # discrete solutions module
  34. doctest.testmod(discrete)
  35. doctest.testmod(continuous)
  36. random.seed(42)
  37. np.random.seed(42)
  38. # operators module
  39. doctest.testmod(discrete_mutators)
  40. doctest.testmod(discrete_crossovers)
  41. random.seed(42)
  42. np.random.seed(42)
  43. # operators module
  44. doctest.testmod(continuous_mutators)
  45. doctest.testmod(continuous_crossovers)
  46. random.seed(42)
  47. np.random.seed(42)
  48. # policies module
  49. doctest.testmod(classicals)
  50. doctest.testmod(reinforcement)
  51. random.seed(42)
  52. np.random.seed(42)
  53. # policies module
  54. doctest.testmod(discrete_mono)
  55. doctest.testmod(discrete_multi)
  56. random.seed(42)
  57. np.random.seed(42)
  58. # policies module
  59. doctest.testmod(algo_mono)
  60. doctest.testmod(algo_multi)
  61. # pass test using doctest
  62. distutils.command.check.check.run(self)
  63. setup(
  64. name='macop',
  65. version='1.0.16',
  66. description='Minimalist And Customisable Optimisation Package',
  67. long_description=open('README.md').read(),
  68. long_description_content_type='text/markdown',
  69. classifiers=[
  70. 'Development Status :: 5 - Production/Stable',
  71. 'License :: OSI Approved :: MIT License',
  72. 'Programming Language :: Python :: 3.8',
  73. 'Topic :: Scientific/Engineering',
  74. 'Topic :: Utilities'
  75. ],
  76. url='https://github.com/prise-3d/macop',
  77. author='Jérôme BUISINE',
  78. author_email='jerome.buisine@univ-littoral.fr',
  79. license='MIT',
  80. packages=['macop',
  81. 'macop.algorithms',
  82. 'macop.callbacks',
  83. 'macop.evaluators',
  84. 'macop.evaluators.discrete',
  85. 'macop.evaluators.continuous',
  86. 'macop.operators',
  87. 'macop.operators.discrete',
  88. 'macop.operators.continuous',
  89. 'macop.policies',
  90. 'macop.solutions',
  91. 'macop.utils'],
  92. install_requires=[
  93. 'numpy',
  94. ],
  95. cmdclass={
  96. 'test': TestCommand,
  97. },
  98. zip_safe=False)