{"id":19267015,"url":"https://github.com/mljs/direct","last_synced_at":"2025-04-21T19:32:34.407Z","repository":{"id":43380633,"uuid":"243529306","full_name":"mljs/direct","owner":"mljs","description":null,"archived":false,"fork":false,"pushed_at":"2024-10-30T09:55:14.000Z","size":1591,"stargazers_count":0,"open_issues_count":6,"forks_count":2,"subscribers_count":10,"default_branch":"main","last_synced_at":"2024-10-30T10:36:17.411Z","etag":null,"topics":["hacktoberfest"],"latest_commit_sha":null,"homepage":"https://mljs.github.io/direct-optimization/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mljs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-27T13:44:06.000Z","updated_at":"2024-10-22T08:52:51.000Z","dependencies_parsed_at":"2024-03-07T15:00:07.125Z","dependency_job_id":null,"html_url":"https://github.com/mljs/direct","commit_stats":{"total_commits":43,"total_committers":9,"mean_commits":4.777777777777778,"dds":0.5581395348837209,"last_synced_commit":"7239cdfa8057218f201fbe4ad1979a03a1e0be17"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fdirect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fdirect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fdirect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mljs%2Fdirect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mljs","download_url":"https://codeload.github.com/mljs/direct/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223876400,"owners_count":17218387,"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":["hacktoberfest"],"created_at":"2024-11-09T20:09:24.164Z","updated_at":"2025-04-21T19:32:34.402Z","avatar_url":"https://github.com/mljs.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ml-direct\n\n[![NPM version][npm-image]][npm-url]\n[![build status][ci-image]][ci-url]\n[![npm download][download-image]][download-url]\n\n# Direct - DIviding RECTangles algorithm.\n\nThe algorithm is intended to minimize real valued multivariate scalar fields over a hyper-rectangular region of N, theoretically the only prerequisite to achieve convergence is that the function must be continuous in the domain or at least continuous over a neighborhood of the global minimum.\n\n## Advanced example\n\n```js\nimport direct from 'ml-direct';\n\nconst options = {\n  iterations: 50,\n};\n\nconst lowerBoundaries = [-1, -1.5];\nconst upperBoundaries = [2, 6];\n\nconst predicted = direct(griewank, lowerBoundaries, upperBoundaries, options);\n\nfunction griewank(x) {\n  let d = x.length;\n  let s = 0;\n  let p = 1;\n  for (let i = 0; i \u003c d; i++) {\n    s += Math.pow(x[i], 2) / Math.sqrt(4000);\n    p *= Math.cos(x[i] / Math.sqrt(i + 1));\n  }\n  let result = s - p + 1;\n  return result;\n}\n\n// predicted.minFunctionValue = 0;\n// predicted.optima[0] = [0, 0]; This are the points where the function has minimum value\n```\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"image/griewandContourplotDirect.png\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  A tool for global optimization of real valued functions .\n\u003c/p\u003e\n\n## Installation\n\n`$ npm i ml-direct`\n\n## Usage\n\n```js\nimport direct from 'ml-direct';\n\nconst options = {\n  iterations: 25,\n};\n\n// for x we explore values between -5 and 4\n// for y we explore values between -2 and 3\n\nconst lowerBoundaries = [-5, -2];\nconst upperBoundaries = [4, 3];\n\nconst quadratic = function (parameters) {\n  const [x, y] = parameters;\n  return Math.pow(x, 2) + Math.pow(y, 2);\n};\n\nconst predicted = direct(quadratic, lowerBoundaries, upperBoundaries, options);\n\n// predicted.minFunctionValue = 0;\n// predicted.optima[0] = [0, 0];\n```\n\n## [API Documentation](https://mljs.github.io/direct/)\n\n## References\n\n- Jones, D. R., Perttunen, C. D., \u0026 Stuckman, B. E. (1993). Lipschitzian optimization without the Lipschitz constant. Journal of optimization Theory and Applications, 79(1), 157-181. https://doi.org/10.1007/BF00941892\n\n- Björkman, M., \u0026 Holmström, K. (1999). Global optimization using the DIRECT algorithm in Matlab.\n\n- Preparata, F. P., \u0026 Shamos, M. I. (2012). Computational geometry: an introduction. Springer Science \u0026 Business Media.\n\n## License\n\n[MIT](./LICENSE)\n\n[npm-image]: https://img.shields.io/npm/v/ml-direct.svg\n[npm-url]: https://www.npmjs.com/package/ml-direct\n[ci-image]: https://github.com/mljs/direct/workflows/Node.js%20CI/badge.svg?branch=main\n[ci-url]: https://github.com/mljs/direct/actions?query=workflow%3A%22Node.js+CI%22\n[download-image]: https://img.shields.io/npm/dm/ml-direct.svg\n[download-url]: https://www.npmjs.com/package/ml-direct\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmljs%2Fdirect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmljs%2Fdirect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmljs%2Fdirect/lists"}