Skip to main content

DFNDFL Python Package

The DFNDFL Python package provides tools for solving Direct Function Optimization (DFO) problems. The package allows users to define custom optimization problems and solve them using the algorithms DFNDFL or DFL.

Installation

The package can be installed with pip:

python3 -m pip install dfndfl

Usage

Problem definition

To use the DFNDFL package, first define an optimization problem in a Python file. The problem file should define the following variables:

  • name: string - name of the problem
  • startp: numpy array - the starting point for the continuous problem
  • lb: numpy array - the lower bounds of the continuous problem
  • ub: numpy array - the upper bounds of the continuous problem
  • nint: int - the number of discrete variables (>= 2)
  • ncont: int - the number of continuous variables (>= 2), (the variables are so intended: x[0] ... x[ncont-1] are the continuous variables and x[ncont] ... x[n-1] are the discrete variables)
  • lbmix: numpy array - the actual lower bounds of the mixed integer problem
  • ubmix: numpy array - the actual upper bounds of the mixed integer problem
  • x_initial: numpy array - the actual initial point of the mixed integer problem
  • feval: function handle - function to compute the objective function value (N.B. the point must be reconstructed through the use of reconstruct_xmix before calling feval)

Here's a sample problem definition:

import numpy as np

name      = 'MISO prob. 10'
nint   = 30
ncont  = n-nint
lb     =-15.0*np.ones(n)
ub     = 30.0*np.ones(n)
lbmix  =-15.0*np.ones(n)
ubmix  = 30.0*np.ones(n)
startp =   7.0*np.ones(n) 
x_initial =7.0*np.ones(n) 

def feval(x):  
    f = - 20*np.exp(-0.2*np.sqrt(np.sum(x**2)/15)) - np.exp(np.sum(np.cos(2*np.pi*x))/15)
    return f

Running a problem

To run a problem from the command line, use:

python3 -m dfndfl.run -p path/to/your/problem.py [options]

Command-Line Arguments

The run.py script accepts several command-line arguments to control the optimization process:

Required arguments:

  • -p PROBLEM_PATH, --problem-path PROBLEM_PATH: Path to the Python file containing the problem definition

Optional arguments:

  • -h, --help: Show an help message and exit
  • -c, --constrained: Solve constrained problems
  • -a {DFN_DFL,DFL}, --alg {DFN_DFL,DFL}: Name of algorithm to be used
  • -m MAX_FUN, --max_fun MAX_FUN: Maximum number of function evaluations
  • -o OUTLEV, --outlev OUTLEV: Output level
  • -M NM_MEMORY, --NM_memory NM_MEMORY: History size for nonmonotone linesearch

Logging

The DFNDFL package uses Python's logging module to log results and progress. The logger's name is set as dfndfl.

License

This project is licensed under the GNU General Public License - see the LICENSE for details.

Metadata

Release files for dfndfl 1.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 dfndfl 1.1.2
File Size Uploaded Provenance Actions
dfndfl-1.1.2.tar.gz 59.2 kB Without provenance Details for dfndfl-1.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dfndfl 1.1.2
File Interpreter ABI Platform Actions
dfndfl-1.1.2-py3-none-any.whl Python 3 none any Details for dfndfl-1.1.2-py3-none-any.whl

Total release size: 100.0 kB

Release files / dfndfl-1.1.2.tar.gz

Download URL dfndfl-1.1.2.tar.gz
Size 59.2 kB
Tags Source
SHA-256 checksum
How to use checksums
7ec11bcff8adeb17c3e57acf225d374013955f26b4d81f2802f11fe9e992ac10
BLAKE2b-256 checksum
How to use checksums
80011bbe3b00940fda5a29cb5a04af9a42b64fc139fca0eb50fe3aeac55e1795
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Release files / dfndfl-1.1.2-py3-none-any.whl

Download URL dfndfl-1.1.2-py3-none-any.whl
Size 40.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
57433a1f122db01ae14f5a8e089968056808a3f4dd5f843d047a67f31634b9f2
BLAKE2b-256 checksum
How to use checksums
33478f10b1b14c66c97feb6eb04e33a4712143cb29162d38612ed2301105ce3a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.6

Security for dfndfl 1.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