Skip to main content

Wrapped-Optimizations

Description

wrapped_optimizations is a Python wrapper around some of SciPy's optimization functions. Instead of having one 1D array which contains all parameters to be optimized, the wrapped functions allow the parameters to be defined locally in the functions to be optimized.

Installation

To install this package, use pip:

pip install wrapped_optimizations

Usage

Here is a simple example of how to use Wrapped-Optimizations:

from wrapped_optimizations import differential_evolution, eval_function

def func(use_param, use_const, use_print=False):
    # define a named parameter
    x = use_param((2), 'x', bounds=(-5, 5))
    # define an unnamed parameter
    y = use_param((2,2), bounds=(-5, 5))

    # define a (named) constant
    # equals `N = 3`, but with the advantage that the value also gets saved to result.x
    N = use_const(3, name='N')

    V = use_param((N), bounds=(0, 20))
    if use_print:
        print(f'V: {V}')
    return np.linalg.norm(x - 1)**2 + np.linalg.norm(y - 3)**2

result = differential_evolution(func)
# result.x now contains all the parameters and constants
# {
#   'x': array([1., 1.]),
#   'param_1': array([[3., 3.], [3., 3.]]),
#   'param_2': array([ 9.49532267, 16.89317493,  9.37888973]),
#   'N': 3
# }

# `func` can now be called, also with additional parameters being forwarded to `func`:
# eval_function(func, result.x, True)

Requirements

Wrapped-Optimizations requires the following Python libraries:

  • NumPy
  • SciPy

License

This project is licensed under the MIT License.

Metadata

Release files for wrapped-optimizations 0.1.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 wrapped-optimizations 0.1.2
File Size Uploaded Provenance Actions
wrapped_optimizations-0.1.2.tar.gz 3.8 kB Without provenance Details for wrapped_optimizations-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wrapped-optimizations 0.1.2
File Interpreter ABI Platform Actions
wrapped_optimizations-0.1.2-py3-none-any.whl Python 3 none any Details for wrapped_optimizations-0.1.2-py3-none-any.whl

Total release size: 8.2 kB

Release files / wrapped_optimizations-0.1.2.tar.gz

Download URL wrapped_optimizations-0.1.2.tar.gz
Size 3.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c60beda62e441cef464ae8e195b61c2030ebf033d0ef5ce75dd8e8f91267b056
BLAKE2b-256 checksum
How to use checksums
b2636e0d9756c9a6ff687d37f044fc6b740df630048de26da15cbbfacfd33064
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.0

Release files / wrapped_optimizations-0.1.2-py3-none-any.whl

Download URL wrapped_optimizations-0.1.2-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
97244f98dee1fa3a8162a5655993b77d51f41d44b9644ffa77b51383646cbe19
BLAKE2b-256 checksum
How to use checksums
54b2118f7cc6b0e6fad41a292b1f3dd1620d4da0c50159dd8ce9af4ea03e7fd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.0

Security for wrapped-optimizations 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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