{"id":19645021,"url":"https://github.com/quantecon/dfols.jl","last_synced_at":"2025-02-26T23:43:03.084Z","repository":{"id":61797721,"uuid":"160436164","full_name":"QuantEcon/DFOLS.jl","owner":"QuantEcon","description":null,"archived":false,"fork":false,"pushed_at":"2019-01-15T22:05:50.000Z","size":38,"stargazers_count":2,"open_issues_count":0,"forks_count":3,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-10-30T04:29:57.954Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Julia","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/QuantEcon.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-05T00:22:23.000Z","updated_at":"2019-02-05T17:44:56.000Z","dependencies_parsed_at":"2022-10-21T11:15:11.072Z","dependency_job_id":null,"html_url":"https://github.com/QuantEcon/DFOLS.jl","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuantEcon%2FDFOLS.jl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuantEcon%2FDFOLS.jl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuantEcon%2FDFOLS.jl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/QuantEcon%2FDFOLS.jl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/QuantEcon","download_url":"https://codeload.github.com/QuantEcon/DFOLS.jl/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240952958,"owners_count":19884019,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-11T14:31:39.828Z","updated_at":"2025-02-26T23:43:03.065Z","avatar_url":"https://github.com/QuantEcon.png","language":"Julia","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DFOLS\n\n[![Build Status](https://travis-ci.com/QuantEcon/DFOLS.jl.svg?branch=master)](https://travis-ci.com/QuantEcon/DFOLS.jl)\n\nA light wrapper around the [DFO-LS](https://numericalalgorithmsgroup.github.io/dfols) (Derivative-Free Optimizer for Least-Squares Minimization) Python package written by the Numerical Algorithms Group at Oxford University. See here for [the paper](https://arxiv.org/abs/1804.00154) and the [github repository](https://github.com/numericalalgorithmsgroup/dfols).\n\n### TOC\n\n1. Installation\n2. Usage\n3. Constraints and Stochastic Objectives\n4. Advanced Usage\n\n**Note:** This package is GPL3 licensed, to comply with the underlying Python.\n\n### Installation\n\nSimply run\n\n```\n] add DFOLS\n```\n\n**Note:** The build script assumes that `$(PyCall.pyprogramname) pip` is a valid command. This is automatically true on Windows and macOS, but needs to be verified on Linux (i.e., make sure it isn't `pip3`, or `python-pip3`, or something). You can do this by aliasing `pip=pip3` or setting up a symbolic link `pip -\u003e pip3`.\n\n### Usage\n\nWe define a type `DFOLSResults` to store the solver output.\n\n```\nstruct DFOLSResults{TI, TF}\n    x::Array{TF, 1}\n    resid::Array{TF, 1}\n    f::TF\n    jacobian::Union{Nothing, Matrix{TF}} # jacobian is nothing if convergence is immediate\n    nf::TI\n    nx::TI # differs from nf if sample averaging is used\n    nruns::TI # \u003e 1 if multiple restarts\n    flag::TI\n    msg::String\n    EXIT_SUCCESS::TI\n    EXIT_MAXFUN_WARNING::TI\n    EXIT_SLOW_WARNING::TI\n    EXIT_FALSE_SUCCESS_WARNING::TI\n    EXIT_INPUT_ERROR::TI\n    EXIT_TR_INCREASE_ERROR::TI\n    EXIT_LINALG_ERROR::TI\nend\n```\n\nAnd we define a set of convenience functions to interact with it\n\n```\nconverged, optimizer, optimum, residuals, jacobian, nf, nruns, nx, flag, msg\n```\n\nYou can run the solver by calling the `solve` function, as below\n\n```\nrosenbrock = x -\u003e [10. * (x[2]-x[1]^2), 1. - x[1]]\nsol = solve(rosenbrock, [-1.2, 1.])\n```\n\nOptions for `solve` include\n\n```\nfunction solve(objfun, x0::Array{TF, 1};\n                bounds = nothing,\n                npt = nothing,\n                rhobeg = nothing,\n                rhoend = 1e-8,\n                maxfun = nothing,\n                nsamples = nothing,\n                user_params = nothing, # see https://numericalalgorithmsgroup.github.io/dfols/build/html/advanced.html\n                objfun_has_noise = false,\n                scaling_within_bounds = false) where {TF \u003c: AbstractFloat}\n```\n\n### Constraints and Stochastic Objectives\n\nYou can impose constraints on the solution space\n\n```\nsolve(rosenbrock, x0, bounds = ([-5., -5.], [5., 5.])) # two-sided box\nsolve(rosenbrock, x0, bounds = ([-5., -5.], nothing)) # one-sided constraint\n```\n\nAnd note that the objective is stochastic\n\n```\nσ = 0.01\nμ = 1.\nrosenbrock_noisy = x -\u003e rosenbrock(x) .* (μ .+ σ*randn(2))\nsolve(rosenbrock_noisy, x0, objfun_has_noise=true)\n```\n\n**Note:** The solver will determine the stochasticity of the objective only by examining the `objfun_has_noise` flag, and not by looking at the actual function supplied.\n\n### Advanced Usage\n\nThe `user_params` should be a Julia dict (see [here](https://numericalalgorithmsgroup.github.io/dfols/build/html/advanced.html) for valid key, value pairs). For example:\n\n```\nsolve(rosenbrock, x0, user_params = Dict(\"init.random_initial_directions\" =\u003e false,\n                                        \"model.abs_tol\" =\u003e 1e-20,\n                                        \"noise.quit_on_noise_level\" =\u003e false))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquantecon%2Fdfols.jl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquantecon%2Fdfols.jl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquantecon%2Fdfols.jl/lists"}