fminl - Linux


Overview

fminl is a Linux command used to numerically minimize a nonlinear function of one variable. It utilizes the Limited-memory BFGS (L-BFGS) algorithm, a powerful optimization technique for finding local minima. fminl is particularly useful for optimizing functions that are not differentiable or have complex relationships.

Syntax

fminl [options] function parameters

Options/Flags

  • -a : Absolute tolerance. Lowerbound for the absolute size of the objective function at the minimum point.
  • -c : Cut-off. Frobenius norm of the (projected) gradient of the objective function after which the iterations are stopped.
  • -e : Output file. Writes the optimization result to a specified file.
  • -F : Function. Objective function to be minimized. Represented as a string enclosed in double quotation marks.
  • -G : Columns. Number of variables in parameters.
  • -i : Maximum number of iterations. Upperbound for the number of iterations performed by the L-BFGS algorithm.
  • -l : Lower bound. Lower bound for parameters.
  • -L : Lower bound cut-off. The L-BFGS algorithm stops if the lower bound is exceeded.
  • -m : Maximum number of corrections. Upperbound for the number of corrections.
  • -R : Rows. Number of parameters in parameters.
  • -r : Upper bound. Upper bound for parameters.
  • -R : Upper bound cut-off. The L-BFGS algorithm stops if the upper bound is exceeded.
  • -v : Verbosity. Controls the level of output verbosity. Higher values provide more detailed information.
  • -x : Initial point. Initial guesses for the minimum point specified in the form of a string.

Examples

Simple example: Minimize the function f(x) = x^2 + 1 within a range of 0 to 10.

fminl -F "x**2 + 1" -l 0 -r 10

Complex example: Minimize the Rosenbrock function f(x, y) = (1 - x)^2 + 100 * (y - x^2)^2 with initial guesses of x = 1 and y = 2.

fminl -F "(1 - x)**2 + 100 * (y - x**2)**2" -x "1 2"

Common Issues

  • Convergence issues: Ensure the objective function is well-behaved and has a unique minimum within the specified range.
  • Runtime errors: Check for incorrect function syntax or inconsistent bounds.
  • Inaccurate results: Adjust the absolute tolerance (-a) and cut-off (-c) parameters to achieve the desired precision.

Integration

fminl can be used in conjunction with other commands for advanced tasks:

  • Python: Use the SciPy Python library’s minimize function to integrate fminl with Python code.
  • Shell scripts: Combine fminl with shell commands to automate optimization tasks.
  • Other optimization tools: Connect fminl to other optimization tools, such as fmincon for constrained optimization.

Related Commands

  • fmincon: Optimization for nonlinear functions with constraints.
  • fminunc: Unconstrained optimization for nonlinear functions.
  • scipy.optimize.minimize: Python library function for general optimization tasks.