Skip to main content

Python wrapper for the GKLS generator of global optimization test functions (Giavano et al., 2003).

Project description

pyGKLS

pyGKLS is a Python wrapper for the GKLS generator of global optimization test functions (Giavano et al., 2003). 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).

Random number generator

The original GKLS generator uses a random number generator based 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.

Installation

To install pyGKLS, one needs to have Python 3.12 or later.

Run the following command:

pip install gkls

Usage

The Python interface is simple and easy to use. Here is an example of how to generate a GKLS function:

from gkls import GKLS

# Create an instance of the GKLS class with random generation (default)
gkls = GKLS(2, 2, [-1, 1], -1)

x = [0.5, 0.5]

print(f"D_f = {gkls.get_d_f(x)}")
print(f"D2_f = {gkls.get_d2_f(x)}")
print(f"ND_f = {gkls.get_nd_f(x)}")

print(f"D_grad = {gkls.get_d_grad(x)}")
print(f"D2_grad = {gkls.get_d2_grad(x)}")

print(f"D2_hessian = {gkls.get_d2_hess(x)}")

One output of the above code (stochastic) could be:

D_f = 2.0314828290164897
D2_f = 2.0314828290164897
ND_f = 2.0314828290164897
D_grad = [1.7408628759925895, 2.2572832704507357]
D2_grad = [1.7408628759925895, 2.2572832704507357]
D2_hessian = [[2.0, 0.0], [0.0, 2.0]]

Arguments can be passed to the GKLS constructor function to control the properties of the generated function. The constructor has the following signature:

GKLS(
  dim : int, # dimension of the function
  num_minima : int, # number of local minima
  domain : List[float], # domain of the function (i.e. [domain_low, domain_high])
  global_min : float # global minimum value
  global_dist=None : float, # distance from the paraboloid minimizer to the global minimizer
  global_radius=None : float, # radius of the global minimizer attraction region
  gen=None : None | "geometry" | int, # generator type. None for random, "geometry" for geometry-based, or an integer for a specific seed
)

See test.py for more examples of how to use the GKLS class.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

gkls-1.0.1.tar.gz (53.0 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

gkls-1.0.1-cp313-cp313-win_amd64.whl (70.6 kB view details)

Uploaded CPython 3.13Windows x86-64

gkls-1.0.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (105.0 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

gkls-1.0.1-cp313-cp313-macosx_11_0_arm64.whl (70.5 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

gkls-1.0.1-cp313-cp313-macosx_10_13_x86_64.whl (73.1 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

gkls-1.0.1-cp312-cp312-win_amd64.whl (71.0 kB view details)

Uploaded CPython 3.12Windows x86-64

gkls-1.0.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (106.0 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

gkls-1.0.1-cp312-cp312-macosx_11_0_arm64.whl (71.1 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

gkls-1.0.1-cp312-cp312-macosx_10_13_x86_64.whl (73.8 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

gkls-1.0.1-cp311-cp311-win_amd64.whl (70.5 kB view details)

Uploaded CPython 3.11Windows x86-64

gkls-1.0.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (105.6 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

gkls-1.0.1-cp311-cp311-macosx_11_0_arm64.whl (69.7 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

gkls-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl (71.6 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

gkls-1.0.1-cp310-cp310-win_amd64.whl (70.6 kB view details)

Uploaded CPython 3.10Windows x86-64

gkls-1.0.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (107.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

gkls-1.0.1-cp310-cp310-macosx_11_0_arm64.whl (70.1 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

gkls-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl (71.9 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

gkls-1.0.1-cp39-cp39-win_amd64.whl (58.7 kB view details)

Uploaded CPython 3.9Windows x86-64

gkls-1.0.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (108.6 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

gkls-1.0.1-cp39-cp39-macosx_11_0_arm64.whl (70.9 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

gkls-1.0.1-cp39-cp39-macosx_10_9_x86_64.whl (72.7 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

Details for the file gkls-1.0.1.tar.gz.

File metadata

  • Download URL: gkls-1.0.1.tar.gz
  • Upload date:
  • Size: 53.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for gkls-1.0.1.tar.gz
Algorithm Hash digest
SHA256 09f20f8ff7ee70eafa4ff8d94a053ea02ef058fbcbf4a83ab832ab9d70487936
MD5 5d1eedf387012de739d90f43cd234d5a
BLAKE2b-256 a3287c593de8de0a1a6e93f44807b69004433332841ea9ddcaa4acd2ee4e08bd

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: gkls-1.0.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 70.6 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for gkls-1.0.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 ebb770263624f59c873725bad49355ad1a5db524b2a56f1f16a2bdc84dad309c
MD5 1519ab4725e8998b9af97e523a904153
BLAKE2b-256 5be51b8be8f88ee03d9ba49c8eb1251fd5f2885a130d15dd55efd8e1c7beaa77

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for gkls-1.0.1-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 25c34f662415bd8cad063ccbb7d73c3adfb15d736f17252b29027445403df498
MD5 a0551fdd30e227e31e3ef6e1e0f4e6d2
BLAKE2b-256 7c7a15126db528a20143c49e1dfdbcbe29e2bc24c9662c25f2436af0b02b0ebb

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp313-cp313-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for gkls-1.0.1-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 11be970f55ec67bea062f58de5c1fd6a70f0a89b8fd2d64250bb14e3433bff92
MD5 241f013dd43578bc40f6f03018e2ad5f
BLAKE2b-256 db0809e129814bdbca4efa3efe219196af7f8a5337b820e607b389753522aad2

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp313-cp313-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for gkls-1.0.1-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 f8dcbbcac150651e6020652de83bd179eb5e737f78750a5d96ea0bcfecd77c25
MD5 58212adc7849f5b327f298ffc931ffb5
BLAKE2b-256 ba75be4f778dd6a578e544570dd45f2873c26f8f16a604e28404ed67a0c9a0a0

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: gkls-1.0.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 71.0 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for gkls-1.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 fc28cdc32e35c1112eb7db72d85c39ab50af18bcbb7b5dfe613179bf0d28dd02
MD5 deb5c3eb0e9779f363baa7d3764e931c
BLAKE2b-256 c2b25c8e9edb27eaea5818dd9d4018e4a257532c50e18f069145ba241809856c

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for gkls-1.0.1-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 755c1e0c8c9e853df12be3c2c7d6c1313000fa2b0dd079d9174a6cec8952db14
MD5 3b6b9f34f76900a52a2df35af812128c
BLAKE2b-256 f9e595e4750fe6859eef108b6ca50e6e98d7fc32b07d3d8e0f7f11240838c1e7

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp312-cp312-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for gkls-1.0.1-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 7260ba785a4897023c128a65e8151f7e48d34654e256399886d3f6cd0803f34a
MD5 149750e787939e30672b62eed405a30b
BLAKE2b-256 45caffdfa8fef7661132aadc5c4e5fb3d0d1cdbf9cffc3b7f931ff54d3c60453

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp312-cp312-macosx_10_13_x86_64.whl.

File metadata

File hashes

Hashes for gkls-1.0.1-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 fd8a193a141f657d70eaa0f6aa5935141b564a65c7b3ce0731bfeceb1843760f
MD5 042aef8a29cbf4e1d834d6a447d03bf3
BLAKE2b-256 fff6a06604f32d1beb999ad35f40214a680d43f8fbf2d3928160e39c287efc3f

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: gkls-1.0.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 70.5 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for gkls-1.0.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 889b1b4a1c8791589fe6516a40724eb30e9b0f0f40bf6640d85d588dfef087c1
MD5 bf83f97b94a193c65fd15af58604e549
BLAKE2b-256 943a8ec668251c99be445e138d857bdc3c1be7cb8edcf93927906fcce23a5d6d

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for gkls-1.0.1-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 1cbfa9a7f63d2c50acd8485c0b41a93ea4d4247bdeb8282627c28443a5d2f1c4
MD5 0a84dfe67b973ec7d8f889e673d98b89
BLAKE2b-256 23a0586b450f0c67b64c67044b208ef8a3755a47894bdc432a8bd86d19bb2ec8

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for gkls-1.0.1-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 cd7514bf94f46dafd8b1a1d334f4a3a7eea3bedb8b3a377d30619a780042369a
MD5 b5eab19b8f2f1f816cad983d96369801
BLAKE2b-256 fb8c638453c14ad8b204ebdac43d6d6d4728612f10c76a9eabb6678aca717ed9

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for gkls-1.0.1-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 7ee50dc192654442a51f725cdf2d6a5419986107946d7ce09e9c22dd48da1f45
MD5 6a44f4cb17d856c6a5ebb6de9b36b4d3
BLAKE2b-256 e9213d3d5610055c24fa9770463882bd7db78b011a472a862f1635d23bebb49e

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: gkls-1.0.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 70.6 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for gkls-1.0.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 051db65adae9dff12e6f9e1ad486faf5419b5f6b3e29530d9631dafff21878f0
MD5 b2c95b56f82d932fc4a5b4c8c7aafad6
BLAKE2b-256 1fe01afb234dbf1f4e1ac2d5ef793d631f24b034cf600b47ecf895b6170ecf8e

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for gkls-1.0.1-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 203817b222fa33be2eccea25196ce3bd492c6b3bafc02c860f426de414fa0962
MD5 616f4241ffbd636483f83c9dc2454df8
BLAKE2b-256 17aabc8e94b7ea002d9539d5b4bbc597981e912df268b3af20c97e9e645076a4

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for gkls-1.0.1-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 05a0542cfe0df474c284037f68b7c5cbbc462c1d7a032df8bd9ab5c794f91957
MD5 c0bb884c552f3a5263931622134106d4
BLAKE2b-256 a9fa26e5fb25df60e19b8c5739ec5ad54bdf5d38379c162e27d456dcb4b95cc1

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for gkls-1.0.1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 b60a5816198da732fa1bc57d1b8ec32405f914f5e83a1af7e1d526ddf703e070
MD5 d90c98dafacd6c42fe24cb0e09150a8b
BLAKE2b-256 99938b4c3fce171ff70b0aa9df78c2b3ae77d88d50bbe19645bb412326c7bfe7

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: gkls-1.0.1-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 58.7 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for gkls-1.0.1-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 0022f7a1a93610e566c92e57f4804cf414bc75ebd5af6e526ce113b37a5a1b3b
MD5 cc3b60af5b736159e4a2b0f555a83832
BLAKE2b-256 d3eb4c8839d6aed35ca79f13b9139fc443bbb5f3ea321d6404b20cf041e58390

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for gkls-1.0.1-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 03d406f5835fcf7d51c5fc45eb5ccc2bf226e8c6781a45be4b816bc44a319f8b
MD5 0bfdfb338b442544b9dd56f4757a9efb
BLAKE2b-256 91bd95a67c4bad3ebe49fd0ac0370b4335ddcc331404e75319aa5d0e809ef212

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

  • Download URL: gkls-1.0.1-cp39-cp39-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 70.9 kB
  • Tags: CPython 3.9, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for gkls-1.0.1-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 833e9ec6bdb10fb9ab963c9271f54002a7f62b8883b3d6a2097beae22577e502
MD5 f5fd50f7524b051ed89b475eee7b5678
BLAKE2b-256 f8ce5867ad951fa65e16f00a2f7640dd346c0ef16ba3c47c972e3d27ff442f2c

See more details on using hashes here.

File details

Details for the file gkls-1.0.1-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: gkls-1.0.1-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 72.7 kB
  • Tags: CPython 3.9, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for gkls-1.0.1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4d8a722453a14bc798b6dac8fa75f2f5bb5db11587cc2951371e78f1937d4e4c
MD5 27c8f4d915713d4e90d2d14b613c3355
BLAKE2b-256 c1579e5fef81cc2eab88e2915f4f74e2d5dec6ecac6965c2006325aaaaa1f9cd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page