Skip to main content

A Mathematical Optimization Method Based on Runge-Kutta Method

Project description

RUN-Optimization-Algorithm

A Mathematical Optimization Method Based on Runge-Kutta Method

RUN: Runge Kutta Optimization Algorithm

The RUN algorithm is a metaheuristic optimization algorithm inspired by the Runge-Kutta method, primarily used for solving unconstrained or constrained optimization problems. This repository contains an implementation of the RUN algorithm with flexibility in constraint handling methods and initialization processes.

Features

  • Multi-dimensional Optimization: Capable of optimizing functions in multiple dimensions.
  • Constraint Handling: Includes options for traditional clipping constraints and random reinitialization.
  • Flexible Initialization: Supports initialization with scalar or vector bounds.
  • Verbose Output: Optional verbose mode to print the convergence progress.

Installation

  • pip install IM_RUN_optimizer

Parameters

Parameters

  • nP: Number of particles in the swarm.
  • MaxIt: Maximum number of iterations for the optimization loop.
  • lb, ub: Lower and upper bounds for the solution space, which can be scalars (applied uniformly across all dimensions) or vectors (specific to each dimension).
  • dim: Dimensionality of the optimization problem.
  • fobj: Objective function to be minimized.
  • constraint_handling: Method for constraint handling ("clip" for clipping, "RI" for random reinitialization).
  • verbose: Boolean flag to enable or disable verbose output.

Constraint Handling Methods

  • Clipping (Default): Keeps all values within the specified bounds using np.clip.

  • Random Reinitialization (RI): If a particle exceeds the bounds, its position is reinitialized randomly within the permissible range.

Run RUN Algorithm

To use the RUN algorithm, import the RUN function from the module and define your objective function. Set the parameters such as population size, maximum iterations, and bounds.

import numpy as np
from IM_RUN_optimizer import RUN

Define objective function

def sphere_function(x):
return np.sum(x**2)

Set parameters

nP = 30 # Number of particles

MaxIt = 100 # Maximum number of iterations

dim = 30 # Problem dimension

lb = -100 # Lower bound (scalar or vector)

ub = 100 # Upper bound (scalar or vector)

verbose = True # Print progress

Execute RUN algorithm

Best_Cost, Best_X, Convergence_curve = RUN(nP, MaxIt, lb, ub, dim, sphere_function, constraint_handling="RI", verbose=verbose)

print(f'Best Cost: {Best_Cost}')

print(f'Best Position: {Best_X}')

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

im_run_optimizer-2.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

IM_RUN_optimizer-2.1.0-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file im_run_optimizer-2.1.0.tar.gz.

File metadata

  • Download URL: im_run_optimizer-2.1.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.8.7

File hashes

Hashes for im_run_optimizer-2.1.0.tar.gz
Algorithm Hash digest
SHA256 81d69b41bcb3f4ade54fcce146e5ca52485e252e8ceb1561f93763b1c60faa44
MD5 3ab91e9dae0a4f4e228d8cbc2c9ab7df
BLAKE2b-256 82852c26f6a320315480619b446c0726a5f36f4751d8f9aeb8e7918f6f1cb49b

See more details on using hashes here.

File details

Details for the file IM_RUN_optimizer-2.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for IM_RUN_optimizer-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9a97d11d7b95075155412b8a2891df389051fabf5d8f97cb6cbc65f113d40e23
MD5 f86059233ea9409bf5ebecbd53a7c0ed
BLAKE2b-256 bf5fe040bfec85236ccf6752689c4bb8e822ad834bedbfdd8f079b6509ee120c

See more details on using hashes here.

Supported by

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