{"id":34065966,"url":"https://github.com/gaetanserre/pygkls","last_synced_at":"2025-12-14T06:05:14.259Z","repository":{"id":247976274,"uuid":"827388447","full_name":"gaetanserre/pyGKLS","owner":"gaetanserre","description":"pyGKLS is a Python wrapper for the GKLS generator of global optimization test functions (Giavano et al., 2003).","archived":false,"fork":false,"pushed_at":"2025-12-11T10:29:31.000Z","size":602,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-12-12T10:55:06.606Z","etag":null,"topics":["generator","objective-function","objective-function-optimization","objective-functions","optimization"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gaetanserre.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-07-11T15:00:16.000Z","updated_at":"2025-12-12T09:52:58.000Z","dependencies_parsed_at":"2024-11-24T21:18:08.855Z","dependency_job_id":"55251a5c-b87f-4ed1-9b13-d43318a9288e","html_url":"https://github.com/gaetanserre/pyGKLS","commit_stats":null,"previous_names":["gaetanserre/pygkls"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/gaetanserre/pyGKLS","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaetanserre%2FpyGKLS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaetanserre%2FpyGKLS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaetanserre%2FpyGKLS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaetanserre%2FpyGKLS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gaetanserre","download_url":"https://codeload.github.com/gaetanserre/pyGKLS/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gaetanserre%2FpyGKLS/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27719109,"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","status":"online","status_checked_at":"2025-12-14T02:00:11.348Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["generator","objective-function","objective-function-optimization","objective-functions","optimization"],"created_at":"2025-12-14T06:05:13.111Z","updated_at":"2025-12-14T06:05:14.251Z","avatar_url":"https://github.com/gaetanserre.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"## pyGKLS\n\n[![CI](https://github.com/gaetanserre/pyGKLS/actions/workflows/build.yml/badge.svg)](https://github.com/gaetanserre/pyGKLS/actions/workflows/build.yml)\n[![PyPI version](https://badge.fury.io/py/gkls.svg)](https://badge.fury.io/py/gkls)\n\u003ca href=\"https://github.com/psf/black\"\u003e\u003cimg alt=\"Code style: black\" src=\"https://img.shields.io/badge/code%20style-black-000000.svg\"\u003e\u003c/a\u003e\n\npyGKLS is a Python wrapper for the GKLS generator of global optimization test functions ([Giavano et al., 2003](https://dl.acm.org/doi/10.1145/962437.962444)). It uses the original C implementation of the generator and provides a Python interface using Cython to generate the test functions. pyGKLS encompass a C++ class that wraps the original C implementation to provide a more user-friendly interface that can be used in C++ projects (see `src/example.cc`) or Python projects (see `test.py`).\n\n### Random number generator\nThe original GKLS generator uses a random number generator introduced by Knuth in his book \"The Art of Computer Programming\". pyGKLS uses the Mersenne Twister random number generator from the C++ standard library to generate random numbers.\n\n### Installation\nTo install pyGKLS, one needs to have `Python 3.12` or later.\n\nRun the following command:\n```bash\npip install gkls\n```\n\n### Usage\nThe Python interface is simple and easy to use. Here is an example of how to generate a GKLS function:\n```python\nfrom gkls import GKLS\n\n# Create an instance of the GKLS class with random generation (default)\ngkls = GKLS(2, 2, [-1, 1], -1)\n\nx = [0.5, 0.5]\n\nprint(f\"D_f = {gkls.get_d_f(x)}\")\nprint(f\"D2_f = {gkls.get_d2_f(x)}\")\nprint(f\"ND_f = {gkls.get_nd_f(x)}\")\n\nprint(f\"D_grad = {gkls.get_d_grad(x)}\")\nprint(f\"D2_grad = {gkls.get_d2_grad(x)}\")\n\nprint(f\"D2_hessian = {gkls.get_d2_hess(x)}\")\n```\nOne output of the above code (stochastic) could be:\n```\nD_f = 2.0314828290164897\nD2_f = 2.0314828290164897\nND_f = 2.0314828290164897\nD_grad = [1.7408628759925895, 2.2572832704507357]\nD2_grad = [1.7408628759925895, 2.2572832704507357]\nD2_hessian = [[2.0, 0.0], [0.0, 2.0]]\n```\n\nArguments can be passed to the `GKLS` constructor function to control the properties of the generated function. The constructor has the following signature:\n```python\nGKLS(\n  dim : int, # dimension of the function\n  num_minima : int, # number of local minima\n  domain : List[float], # domain of the function (i.e. [domain_low, domain_high])\n  global_min : float # global minimum value\n  global_dist=None : float, # distance from the paraboloid minimizer to the global minimizer\n  global_radius=None : float, # radius of the global minimizer attraction region\n  gen=None : None | \"geometry\" | int, # generator type. None for random, \"geometry\" for geometry-based, or an integer for a specific seed\n)\n```\n\nSee [`test.py`](test.py) for more examples of how to use the GKLS class.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaetanserre%2Fpygkls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgaetanserre%2Fpygkls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgaetanserre%2Fpygkls/lists"}