{"id":13936567,"url":"https://github.com/eyounx/ZOOpt","last_synced_at":"2025-07-19T22:30:56.975Z","repository":{"id":48126973,"uuid":"79076232","full_name":"eyounx/ZOOpt","owner":"eyounx","description":"A python package of Zeroth-Order Optimization (ZOOpt)","archived":false,"fork":false,"pushed_at":"2022-06-02T04:48:49.000Z","size":12789,"stargazers_count":396,"open_issues_count":1,"forks_count":100,"subscribers_count":26,"default_branch":"master","last_synced_at":"2024-08-08T23:23:57.585Z","etag":null,"topics":["derivative-free","machine-learning","optimization"],"latest_commit_sha":null,"homepage":"https://github.com/polixir/ZOOpt","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eyounx.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-16T02:41:05.000Z","updated_at":"2024-07-20T15:32:56.000Z","dependencies_parsed_at":"2022-08-12T19:10:37.748Z","dependency_job_id":null,"html_url":"https://github.com/eyounx/ZOOpt","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyounx%2FZOOpt","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyounx%2FZOOpt/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyounx%2FZOOpt/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eyounx%2FZOOpt/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eyounx","download_url":"https://codeload.github.com/eyounx/ZOOpt/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226686729,"owners_count":17666928,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["derivative-free","machine-learning","optimization"],"created_at":"2024-08-07T23:02:47.693Z","updated_at":"2024-11-27T04:31:12.460Z","avatar_url":"https://github.com/eyounx.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"The maintenance of ZOOpt has shifted to https://github.com/polixir/ZOOpt . The new version is compatible with [Ray](https://github.com/ray-project/ray).\n\n# ZOOpt\n\n[![license](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000)](https://github.com/eyounx/ZOOpt/blob/master/LICENSE.txt) [![Build Status](https://www.travis-ci.org/eyounx/ZOOpt.svg?branch=master)](https://www.travis-ci.org/eyounx/ZOOpt) [![Documentation Status](https://readthedocs.org/projects/zoopt/badge/?version=latest)](https://zoopt.readthedocs.io/en/latest/?badge=latest) [![codecov](https://codecov.io/gh/AlexLiuyuren/ZOOpt/branch/master/graph/badge.svg)](https://codecov.io/gh/AlexLiuyuren/ZOOpt)\n\nZOOpt is a python package for Zeroth-Order Optimization. \n\nZeroth-order optimization (a.k.a. derivative-free optimization/black-box optimization) does not rely on the gradient of the objective function, but instead, learns from samples of the search space. It is suitable for optimizing functions that are nondifferentiable, with many local minima, or even unknown but only testable.\n\nZOOpt implements some state-of-the-art zeroth-order optimization methods and their parallel versions. Users only need to add several keywords to use parallel optimization on a single machine. For large-scale distributed optimization across multiple machines, please refer to [Distributed ZOOpt](https://github.com/eyounx/ZOOsrv).  \n\n**Documents**: [Tutorial of ZOOpt](http://zoopt.readthedocs.io/en/latest/index.html)\n\n**Citation**: \n\n\u003e **Yu-Ren Liu, Yi-Qi Hu, Hong Qian, Chao Qian, Yang Yu. ZOOpt: Toolbox for Derivative-Free Optimization**. SCIENCE CHINA Information Sciences, 2022. [CORR abs/1801.00329](https://arxiv.org/abs/1801.00329)\n\n(Features in this article are from version 0.2)\n\n## Installation \n\nThe easiest way to install ZOOpt is to type `pip install zoopt` in the terminal/command line.\n\nAlternatively, to install ZOOpt by source code, download this repository and sequentially run following commands in your terminal/command line.\n\n```\n$ python setup.py build\n$ python setup.py install\n```\n\n## A simple example\n\nWe define the Ackley function for minimization (note that this function is for arbitrary dimensions, determined by the solution)\n\n```python\nimport numpy as np\ndef ackley(solution):\n    x = solution.get_x()\n    bias = 0.2\n    value = -20 * np.exp(-0.2 * np.sqrt(sum([(i - bias) * (i - bias) for i in x]) / len(x))) - \\\n            np.exp(sum([np.cos(2.0*np.pi*(i-bias)) for i in x]) / len(x)) + 20.0 + np.e\n    return value\n```\n\nAckley function is a classical function with many local minima. In 2-dimension, it looks like (from wikipedia)\n\n\u003ctable border=0\u003e\u003ctr\u003e\u003ctd width=\"400px\"\u003e\u003cimg src=\"https://upload.wikimedia.org/wikipedia/commons/thumb/9/98/Ackley%27s_function.pdf/page1-400px-Ackley%27s_function.pdf.jpg\" alt=\"Ackley function\"/\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\n Then, use ZOOpt to optimize a 100-dimension Ackley function:\n\n```python\nfrom zoopt import Dimension, ValueType, Dimension2, Objective, Parameter, Opt, ExpOpt\n\ndim_size = 100  # dimension size\ndim = Dimension(dim_size, [[-1, 1]]*dim_size, [True]*dim_size)  # dim = Dimension2([(ValueType.CONTINUOUS, [-1, 1], 1e-6)]*dim_size)\nobj = Objective(ackley, dim)\n# perform optimization\nsolution = Opt.min(obj, Parameter(budget=100*dim_size))\n# print the solution\nprint(solution.get_x(), solution.get_value())\n# parallel optimization for time-consuming tasks\nsolution = Opt.min(obj, Parameter(budget=100*dim_size, parallel=True, server_num=3))\n```\n\nFor a few seconds, the optimization is done. Then, we can visualize the optimization progress\n\n```python\nimport matplotlib.pyplot as plt\nplt.plot(obj.get_history_bestsofar())\nplt.savefig('figure.png')\n```\n\nwhich looks like\n\n\u003ctable border=0\u003e\u003ctr\u003e\u003ctd width=\"400px\"\u003e\u003cimg src=\"https://github.com/eyounx/ZOOpt/blob/dev/img/quick_start.png?raw=true\" alt=\"Expeirment results\"/\u003e\u003c/td\u003e\u003c/tr\u003e\u003c/table\u003e\nWe can also use `ExpOpt` to repeat the optimization for performance analysis, which will calculate the mean and standard deviation of multiple optimization results while automatically visualizing the optimization progress.\n\n```python\nsolution_list = ExpOpt.min(obj, Parameter(budget=100*dim_size), repeat=3,\n                           plot=True, plot_file=\"progress.png\")\nfor solution in solution_list:\n\t\tprint(solution.get_x(), solution.get_value())\n\n```\n\nMore examples are available in the `example` fold.\n\n# Releases\n\n## [release 0.3](https://github.com/eyounx/ZOOpt/releases/tag/v0.3)\n\n- Add a parallel implementation of SRACOS, which accelarates the optimization by asynchronous parallelization.\n- Add a function that enables users to set  a customized stop criteria for the optimization.\n- Rewrite the documentation to make it easier to follow.\n\n## [release 0.2](https://github.com/eyounx/ZOOpt/releases/tag/v0.2.1)\n\n- Add the noise handling strategies Re-sampling and Value Suppression (AAAI'18), and the subset selection method with noise handling PONSS (NIPS'17)\n- Add high-dimensionality handling method Sequential Random Embedding (IJCAI'16) \n- Rewrite Pareto optimization method. Bugs fixed.\n\n## [release 0.1](https://github.com/eyounx/ZOOpt/releases/tag/v0.1)\n\n- Include the general optimization method RACOS (AAAI'16) and Sequential RACOS (AAAI'17), and the subset selection method POSS (NIPS'15).\n- The algorithm selection is automatic. See examples in the `example` fold.- Default parameters work well on many problems, while parameters are fully controllable\n- Running speed optmized for Python\n\n# Distributed ZOOpt\n\nDistributed ZOOpt is consisted of a [server project](https://github.com/eyounx/ZOOsrv) and a [client project](https://github.com/eyounx/ZOOclient.jl). Details can be found in the [Tutorial of Distributed ZOOpt](http://zoopt.readthedocs.io/en/latest/Tutorial%20of%20Distributed%20ZOOpt.html)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feyounx%2FZOOpt","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feyounx%2FZOOpt","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feyounx%2FZOOpt/lists"}