Skip to main content

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

Project description

pyGKLS

CI PyPI version Code style: black

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.2.tar.gz (53.3 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.2-cp313-cp313-win_amd64.whl (70.4 kB view details)

Uploaded CPython 3.13Windows x86-64

gkls-1.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (106.9 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

gkls-1.0.2-cp313-cp313-macosx_11_0_arm64.whl (71.0 kB view details)

Uploaded CPython 3.13macOS 11.0+ ARM64

gkls-1.0.2-cp313-cp313-macosx_10_13_x86_64.whl (72.8 kB view details)

Uploaded CPython 3.13macOS 10.13+ x86-64

gkls-1.0.2-cp312-cp312-win_amd64.whl (70.6 kB view details)

Uploaded CPython 3.12Windows x86-64

gkls-1.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (107.4 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

gkls-1.0.2-cp312-cp312-macosx_11_0_arm64.whl (71.4 kB view details)

Uploaded CPython 3.12macOS 11.0+ ARM64

gkls-1.0.2-cp312-cp312-macosx_10_13_x86_64.whl (73.3 kB view details)

Uploaded CPython 3.12macOS 10.13+ x86-64

gkls-1.0.2-cp311-cp311-win_amd64.whl (70.2 kB view details)

Uploaded CPython 3.11Windows x86-64

gkls-1.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (106.1 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.17+ x86-64

gkls-1.0.2-cp311-cp311-macosx_11_0_arm64.whl (70.3 kB view details)

Uploaded CPython 3.11macOS 11.0+ ARM64

gkls-1.0.2-cp311-cp311-macosx_10_9_x86_64.whl (71.2 kB view details)

Uploaded CPython 3.11macOS 10.9+ x86-64

gkls-1.0.2-cp310-cp310-win_amd64.whl (70.4 kB view details)

Uploaded CPython 3.10Windows x86-64

gkls-1.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (106.4 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.17+ x86-64

gkls-1.0.2-cp310-cp310-macosx_11_0_arm64.whl (70.6 kB view details)

Uploaded CPython 3.10macOS 11.0+ ARM64

gkls-1.0.2-cp310-cp310-macosx_10_9_x86_64.whl (71.1 kB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

gkls-1.0.2-cp39-cp39-win_amd64.whl (58.0 kB view details)

Uploaded CPython 3.9Windows x86-64

gkls-1.0.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (106.7 kB view details)

Uploaded CPython 3.9manylinux: glibc 2.17+ x86-64

gkls-1.0.2-cp39-cp39-macosx_11_0_arm64.whl (71.1 kB view details)

Uploaded CPython 3.9macOS 11.0+ ARM64

gkls-1.0.2-cp39-cp39-macosx_10_9_x86_64.whl (71.5 kB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: gkls-1.0.2.tar.gz
  • Upload date:
  • Size: 53.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for gkls-1.0.2.tar.gz
Algorithm Hash digest
SHA256 b46b10cace3f997a3792b516f5ab97da528c7af4535b3d6928f6b478d79be06f
MD5 490c33c9ce4dd44ea624175a58c38ce5
BLAKE2b-256 5e56e650edc599a58237cb8a687c3898b2ae4888405a5c3a4e6cfc81bb542a0d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gkls-1.0.2-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 70.4 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for gkls-1.0.2-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 1e4cc306856b77701e224da8fd513da765907118eef138a7c07e2cb1aaea26d0
MD5 c2ef5fe60138dd156e50c5401d033c27
BLAKE2b-256 2bddd48cac988328335bd6f9291caebf5d86a32e3810872298d86c05089f992a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gkls-1.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 aba4920614a4a5e7e5ad08084bc6a76bc54d4a997d92c2c58e9102cdc8201fb5
MD5 774be729f084f523e2f4aae933cedcb2
BLAKE2b-256 e55eb342a9ada2f161e75a7f53332bb4f0972c69cb2721cbc99eb97d57575d18

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gkls-1.0.2-cp313-cp313-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 0abcff741746f86ef713dcd82b66497ac24f421d59478aa2df24b997a9395008
MD5 3ccf3c650287d8b083cab2a9e439429e
BLAKE2b-256 f6452f23521a0907a257a882b731ac49fbed3613dce52dae65234b6b12ac514b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gkls-1.0.2-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 6e6eacee7677389320a72e9e5dfdb63e72afb3a295503868213b3318e1f2fe89
MD5 310de8f12f2ee9707b8dc0e76e0c8569
BLAKE2b-256 e851852907c97fbaa61758c4ac989a79938aaf6595ebc9107be169e3450d7ced

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gkls-1.0.2-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 70.6 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for gkls-1.0.2-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 d0943092a3522fc6e70dd6593c00cadf1bf96499766f4ed2f3a3c0493bcaff44
MD5 5194fc17c46eedc16b87adba77674eff
BLAKE2b-256 7f3e33ccd2be9295873da461720008595bcc44c22a3c06f08ab04699952f7c6d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gkls-1.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 3319ff436317a029e31266d462f9a03c5762b7ce476fd8f29869603308887406
MD5 cde26658890175a4101cb5c76e9d3bcc
BLAKE2b-256 c8874108dc349687db85899d07c564c17943f24bb5b34e70253881c57892c0d5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gkls-1.0.2-cp312-cp312-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 af04ea055382d02da1664a89ac2b8116e01d51b54c69c40740c8362bcf424c02
MD5 9cd5ac7a2019995941a10aa84a537fdd
BLAKE2b-256 3dbaa1348a6f230914c4eedd84c22e2cad1a17061a02c41f50d3ca33bf9909d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gkls-1.0.2-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm Hash digest
SHA256 6564b5df2d3b425ad70669b16487f13481f971860aaf606255162875c09a1418
MD5 7ab433670c9e93d22b94c53239988983
BLAKE2b-256 30c4372098c03965a028d9398d42fb743b2ff9f5ba294ffc7f6e13447ebd2442

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gkls-1.0.2-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 70.2 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for gkls-1.0.2-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 2c9bebac1cfe9fea1b56d91a6ce32d8fd1d8c2055abda2556aa9249bc1a8f77e
MD5 9436b920793b0674e4667c8d26d19a5c
BLAKE2b-256 19fde1c3b34bd4608b3ba3066eca71ade6910fd19a7379af30a559ec214b2e23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gkls-1.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 919938c52efd64c0ebcb418a41105eed4d9d7a8e0f3abb4ee9dbc12daea99576
MD5 34d520aeba3d2aa2cbfa5e4177a0aa9f
BLAKE2b-256 d3fa5c8de9b1273756fc545b577132a1067daa9f091f95aaedab5d09fa5f4229

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gkls-1.0.2-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3f268d430ccf0eba91b85ec61ddb0043dcbd7123e563fe48578f91ca596072c4
MD5 6f1faf0d5c1955ae1d64af606c5d4dfd
BLAKE2b-256 f99a081c0e37f6f942421083fd260f1da59c82a9e461ef58689d3be9e97a781b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gkls-1.0.2-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f8ccefd544b86cd2dc4a6dff9a29e1283cee3b75a52f07f0daac0e6abe729165
MD5 3ae4e4157ce007d3f62d1d86c736e91d
BLAKE2b-256 8fe9d6898ce980c046c941abe60fcbfd0151cf794a916f166623d96667e4aef0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gkls-1.0.2-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 70.4 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for gkls-1.0.2-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 15d62a79450de7eb8851611dee699b7dc2ade06bba6b915add632a9f5b768bbc
MD5 a1cb65016f4cf883aa7c6906a996ea7d
BLAKE2b-256 5b0fc9b2aeffc7de468e59e93527919a364512e8d194f50adbf678dd8f62151c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gkls-1.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 34428de5e5710dc6df079a0fe0b5f9a9a3e67b84c709f7d1927e78390ec69b30
MD5 2df72ce9f72b63b1ce8f79a1243bec51
BLAKE2b-256 925eaf6f98aeee02fe0910f18621fdf8269fbee3250867851455c673ee359e48

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gkls-1.0.2-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 74d012f27092fbe407142400a2935b5e0b7ddc0ece6dc923c7c5c61d6cc58e88
MD5 7f7bfc47585d6d93627007b417e3a03d
BLAKE2b-256 f82c6cfb225e4af96ddc61e26c2b103ee5ad446f8dc2d8be13918d28fee46f8b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gkls-1.0.2-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 eef9762341bce77adb276e75c0fd839561c924ab3a72140037566586ec6f2eaa
MD5 cc96663c0a61a30d28a108826bd306a9
BLAKE2b-256 93f12e9f003d43c0e3b2d130d4d9057adb14bafb9c4b6b036f94372195a11c00

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gkls-1.0.2-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 58.0 kB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for gkls-1.0.2-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 85203e7d12c91e80dc791a1a9376e0d3460a9724a30a9c1596fd18e36ae57434
MD5 3259b7514b02cf4437d06d3da9df3494
BLAKE2b-256 2c0af6b003c3696cc8b43ab2309379a347ece3e9428e5cdaef3104b17b1c3402

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for gkls-1.0.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 87f8c59174aa0ea6b09cdff8b1b5f635481cd1b8f17032ebb287f8f4eb0374c0
MD5 f6cea4531cae1018c3d436f1a59ed458
BLAKE2b-256 4d22e872d9b274c9d6e3608e663397d9e8fb0defc6cff39cf466c766eee8c491

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gkls-1.0.2-cp39-cp39-macosx_11_0_arm64.whl
  • Upload date:
  • Size: 71.1 kB
  • Tags: CPython 3.9, macOS 11.0+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for gkls-1.0.2-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 8a84354fde92ba4d5f8f3f4dd1b21223619b87200231b6209f1d7e599d47a694
MD5 cf16ff60c88792794ee1fd463ac707e2
BLAKE2b-256 f4c780346caeea12b1cc94bd9bf061f9c2a5d331e0f670452b5b0caca9ab0ed8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for gkls-1.0.2-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 860579684d0a43b19d873709e584d8e16a8b7d6323278b7bed8807f76ab7663f
MD5 f6e0463caa3e7752d9c0496bd3ecf405
BLAKE2b-256 55ca5bbf2e7d6af8a6ebd5419c230b0797022bbae20f241f75aa17a50bb87a7b

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