Skip to main content

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.

Metadata

Release files for gkls 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gkls 1.0.2
File Size Uploaded
gkls-1.0.2.tar.gz 53.3 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for gkls 1.0.2
File
gkls-1.0.2-cp313-cp313-win_amd64.whl CPython 3.13 CPython 3.13 Windows x86-64 Details
gkls-1.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.13 CPython 3.13 Linux glibc 2.17+ x86-64 Details
gkls-1.0.2-cp313-cp313-macosx_11_0_arm64.whl CPython 3.13 CPython 3.13 macOS 11.0+ ARM64 Details
gkls-1.0.2-cp313-cp313-macosx_10_13_x86_64.whl CPython 3.13 CPython 3.13 macOS 10.13+ x86-64 Details
gkls-1.0.2-cp312-cp312-win_amd64.whl CPython 3.12 CPython 3.12 Windows x86-64 Details
gkls-1.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.12 CPython 3.12 Linux glibc 2.17+ x86-64 Details
gkls-1.0.2-cp312-cp312-macosx_11_0_arm64.whl CPython 3.12 CPython 3.12 macOS 11.0+ ARM64 Details
gkls-1.0.2-cp312-cp312-macosx_10_13_x86_64.whl CPython 3.12 CPython 3.12 macOS 10.13+ x86-64 Details
gkls-1.0.2-cp311-cp311-win_amd64.whl CPython 3.11 CPython 3.11 Windows x86-64 Details
gkls-1.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.17+ x86-64 Details
gkls-1.0.2-cp311-cp311-macosx_11_0_arm64.whl CPython 3.11 CPython 3.11 macOS 11.0+ ARM64 Details
gkls-1.0.2-cp311-cp311-macosx_10_9_x86_64.whl CPython 3.11 CPython 3.11 macOS 10.9+ x86-64 Details
gkls-1.0.2-cp310-cp310-win_amd64.whl CPython 3.10 CPython 3.10 Windows x86-64 Details
gkls-1.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.17+ x86-64 Details
gkls-1.0.2-cp310-cp310-macosx_11_0_arm64.whl CPython 3.10 CPython 3.10 macOS 11.0+ ARM64 Details
gkls-1.0.2-cp310-cp310-macosx_10_9_x86_64.whl CPython 3.10 CPython 3.10 macOS 10.9+ x86-64 Details
gkls-1.0.2-cp39-cp39-win_amd64.whl CPython 3.9 CPython 3.9 Windows x86-64 Details
gkls-1.0.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl CPython 3.9 CPython 3.9 Linux glibc 2.17+ x86-64 Details
gkls-1.0.2-cp39-cp39-macosx_11_0_arm64.whl CPython 3.9 CPython 3.9 macOS 11.0+ ARM64 Details
gkls-1.0.2-cp39-cp39-macosx_10_9_x86_64.whl CPython 3.9 CPython 3.9 macOS 10.9+ x86-64 Details

Total release size: 1.6 MB

Release files / gkls-1.0.2.tar.gz

Download URL gkls-1.0.2.tar.gz
Size 53.3 kB
Tags Source
SHA-256 checksum
How to use checksums
b46b10cace3f997a3792b516f5ab97da528c7af4535b3d6928f6b478d79be06f
BLAKE2b-256 checksum
How to use checksums
5e56e650edc599a58237cb8a687c3898b2ae4888405a5c3a4e6cfc81bb542a0d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp313-cp313-win_amd64.whl

Download URL gkls-1.0.2-cp313-cp313-win_amd64.whl
Size 70.4 kB
Tags CPython 3.13 Windows x86-64
SHA-256 checksum
How to use checksums
1e4cc306856b77701e224da8fd513da765907118eef138a7c07e2cb1aaea26d0
BLAKE2b-256 checksum
How to use checksums
2bddd48cac988328335bd6f9291caebf5d86a32e3810872298d86c05089f992a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL gkls-1.0.2-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 106.9 kB
Tags CPython 3.13 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
aba4920614a4a5e7e5ad08084bc6a76bc54d4a997d92c2c58e9102cdc8201fb5
BLAKE2b-256 checksum
How to use checksums
e55eb342a9ada2f161e75a7f53332bb4f0972c69cb2721cbc99eb97d57575d18
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp313-cp313-macosx_11_0_arm64.whl

Download URL gkls-1.0.2-cp313-cp313-macosx_11_0_arm64.whl
Size 71.0 kB
Tags CPython 3.13 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0abcff741746f86ef713dcd82b66497ac24f421d59478aa2df24b997a9395008
BLAKE2b-256 checksum
How to use checksums
f6452f23521a0907a257a882b731ac49fbed3613dce52dae65234b6b12ac514b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp313-cp313-macosx_10_13_x86_64.whl

Download URL gkls-1.0.2-cp313-cp313-macosx_10_13_x86_64.whl
Size 72.8 kB
Tags CPython 3.13 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
6e6eacee7677389320a72e9e5dfdb63e72afb3a295503868213b3318e1f2fe89
BLAKE2b-256 checksum
How to use checksums
e851852907c97fbaa61758c4ac989a79938aaf6595ebc9107be169e3450d7ced
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp312-cp312-win_amd64.whl

Download URL gkls-1.0.2-cp312-cp312-win_amd64.whl
Size 70.6 kB
Tags CPython 3.12 Windows x86-64
SHA-256 checksum
How to use checksums
d0943092a3522fc6e70dd6593c00cadf1bf96499766f4ed2f3a3c0493bcaff44
BLAKE2b-256 checksum
How to use checksums
7f3e33ccd2be9295873da461720008595bcc44c22a3c06f08ab04699952f7c6d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL gkls-1.0.2-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 107.4 kB
Tags CPython 3.12 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
3319ff436317a029e31266d462f9a03c5762b7ce476fd8f29869603308887406
BLAKE2b-256 checksum
How to use checksums
c8874108dc349687db85899d07c564c17943f24bb5b34e70253881c57892c0d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp312-cp312-macosx_11_0_arm64.whl

Download URL gkls-1.0.2-cp312-cp312-macosx_11_0_arm64.whl
Size 71.4 kB
Tags CPython 3.12 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
af04ea055382d02da1664a89ac2b8116e01d51b54c69c40740c8362bcf424c02
BLAKE2b-256 checksum
How to use checksums
3dbaa1348a6f230914c4eedd84c22e2cad1a17061a02c41f50d3ca33bf9909d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp312-cp312-macosx_10_13_x86_64.whl

Download URL gkls-1.0.2-cp312-cp312-macosx_10_13_x86_64.whl
Size 73.3 kB
Tags CPython 3.12 macOS 10.13+ x86-64
SHA-256 checksum
How to use checksums
6564b5df2d3b425ad70669b16487f13481f971860aaf606255162875c09a1418
BLAKE2b-256 checksum
How to use checksums
30c4372098c03965a028d9398d42fb743b2ff9f5ba294ffc7f6e13447ebd2442
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp311-cp311-win_amd64.whl

Download URL gkls-1.0.2-cp311-cp311-win_amd64.whl
Size 70.2 kB
Tags CPython 3.11 Windows x86-64
SHA-256 checksum
How to use checksums
2c9bebac1cfe9fea1b56d91a6ce32d8fd1d8c2055abda2556aa9249bc1a8f77e
BLAKE2b-256 checksum
How to use checksums
19fde1c3b34bd4608b3ba3066eca71ade6910fd19a7379af30a559ec214b2e23
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL gkls-1.0.2-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 106.1 kB
Tags CPython 3.11 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
919938c52efd64c0ebcb418a41105eed4d9d7a8e0f3abb4ee9dbc12daea99576
BLAKE2b-256 checksum
How to use checksums
d3fa5c8de9b1273756fc545b577132a1067daa9f091f95aaedab5d09fa5f4229
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp311-cp311-macosx_11_0_arm64.whl

Download URL gkls-1.0.2-cp311-cp311-macosx_11_0_arm64.whl
Size 70.3 kB
Tags CPython 3.11 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
3f268d430ccf0eba91b85ec61ddb0043dcbd7123e563fe48578f91ca596072c4
BLAKE2b-256 checksum
How to use checksums
f99a081c0e37f6f942421083fd260f1da59c82a9e461ef58689d3be9e97a781b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp311-cp311-macosx_10_9_x86_64.whl

Download URL gkls-1.0.2-cp311-cp311-macosx_10_9_x86_64.whl
Size 71.2 kB
Tags CPython 3.11 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
f8ccefd544b86cd2dc4a6dff9a29e1283cee3b75a52f07f0daac0e6abe729165
BLAKE2b-256 checksum
How to use checksums
8fe9d6898ce980c046c941abe60fcbfd0151cf794a916f166623d96667e4aef0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp310-cp310-win_amd64.whl

Download URL gkls-1.0.2-cp310-cp310-win_amd64.whl
Size 70.4 kB
Tags CPython 3.10 Windows x86-64
SHA-256 checksum
How to use checksums
15d62a79450de7eb8851611dee699b7dc2ade06bba6b915add632a9f5b768bbc
BLAKE2b-256 checksum
How to use checksums
5b0fc9b2aeffc7de468e59e93527919a364512e8d194f50adbf678dd8f62151c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL gkls-1.0.2-cp310-cp310-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 106.4 kB
Tags CPython 3.10 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
34428de5e5710dc6df079a0fe0b5f9a9a3e67b84c709f7d1927e78390ec69b30
BLAKE2b-256 checksum
How to use checksums
925eaf6f98aeee02fe0910f18621fdf8269fbee3250867851455c673ee359e48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp310-cp310-macosx_11_0_arm64.whl

Download URL gkls-1.0.2-cp310-cp310-macosx_11_0_arm64.whl
Size 70.6 kB
Tags CPython 3.10 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
74d012f27092fbe407142400a2935b5e0b7ddc0ece6dc923c7c5c61d6cc58e88
BLAKE2b-256 checksum
How to use checksums
f82c6cfb225e4af96ddc61e26c2b103ee5ad446f8dc2d8be13918d28fee46f8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp310-cp310-macosx_10_9_x86_64.whl

Download URL gkls-1.0.2-cp310-cp310-macosx_10_9_x86_64.whl
Size 71.1 kB
Tags CPython 3.10 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
eef9762341bce77adb276e75c0fd839561c924ab3a72140037566586ec6f2eaa
BLAKE2b-256 checksum
How to use checksums
93f12e9f003d43c0e3b2d130d4d9057adb14bafb9c4b6b036f94372195a11c00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp39-cp39-win_amd64.whl

Download URL gkls-1.0.2-cp39-cp39-win_amd64.whl
Size 58.0 kB
Tags CPython 3.9 Windows x86-64
SHA-256 checksum
How to use checksums
85203e7d12c91e80dc791a1a9376e0d3460a9724a30a9c1596fd18e36ae57434
BLAKE2b-256 checksum
How to use checksums
2c0af6b003c3696cc8b43ab2309379a347ece3e9428e5cdaef3104b17b1c3402
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl

Download URL gkls-1.0.2-cp39-cp39-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Size 106.7 kB
Tags CPython 3.9 Linux glibc 2.17+ x86-64
SHA-256 checksum
How to use checksums
87f8c59174aa0ea6b09cdff8b1b5f635481cd1b8f17032ebb287f8f4eb0374c0
BLAKE2b-256 checksum
How to use checksums
4d22e872d9b274c9d6e3608e663397d9e8fb0defc6cff39cf466c766eee8c491
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp39-cp39-macosx_11_0_arm64.whl

Download URL gkls-1.0.2-cp39-cp39-macosx_11_0_arm64.whl
Size 71.1 kB
Tags CPython 3.9 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
8a84354fde92ba4d5f8f3f4dd1b21223619b87200231b6209f1d7e599d47a694
BLAKE2b-256 checksum
How to use checksums
f4c780346caeea12b1cc94bd9bf061f9c2a5d331e0f670452b5b0caca9ab0ed8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release files / gkls-1.0.2-cp39-cp39-macosx_10_9_x86_64.whl

Download URL gkls-1.0.2-cp39-cp39-macosx_10_9_x86_64.whl
Size 71.5 kB
Tags CPython 3.9 macOS 10.9+ x86-64
SHA-256 checksum
How to use checksums
860579684d0a43b19d873709e584d8e16a8b7d6323278b7bed8807f76ab7663f
BLAKE2b-256 checksum
How to use checksums
55ca5bbf2e7d6af8a6ebd5419c230b0797022bbae20f241f75aa17a50bb87a7b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

1.0.2 This release

21 release files

1.0.0

21 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page