{"id":19305099,"url":"https://github.com/erikerlandson/gibbous","last_synced_at":"2025-04-22T12:34:16.588Z","repository":{"id":50043479,"uuid":"131861304","full_name":"erikerlandson/gibbous","owner":"erikerlandson","description":"Convex optimization for java and scala, built on Apache Commons Math","archived":false,"fork":false,"pushed_at":"2021-07-16T23:33:44.000Z","size":5760,"stargazers_count":20,"open_issues_count":0,"forks_count":8,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-01T23:09:03.736Z","etag":null,"topics":["commons-math","constraint-programming","convex-optimization","convex-programming","java","linear-programming","optimization","optimization-algorithms","quadratic-programming","scala"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/erikerlandson.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-05-02T14:18:15.000Z","updated_at":"2024-03-31T14:21:01.000Z","dependencies_parsed_at":"2022-09-26T16:31:14.846Z","dependency_job_id":null,"html_url":"https://github.com/erikerlandson/gibbous","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikerlandson%2Fgibbous","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikerlandson%2Fgibbous/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikerlandson%2Fgibbous/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikerlandson%2Fgibbous/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erikerlandson","download_url":"https://codeload.github.com/erikerlandson/gibbous/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250241549,"owners_count":21398000,"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":["commons-math","constraint-programming","convex-optimization","convex-programming","java","linear-programming","optimization","optimization-algorithms","quadratic-programming","scala"],"created_at":"2024-11-09T23:33:36.531Z","updated_at":"2025-04-22T12:34:15.930Z","avatar_url":"https://github.com/erikerlandson.png","language":"Java","funding_links":[],"categories":["数学库"],"sub_categories":["语音合成"],"readme":"# gibbous\nConvex optimization built on Apache Commons Math\n\nImplementation of the Barrier Method from §11.3 of _Convex Optimization_, Boyd and Vandenberghe, Cambridge University Press, 2004\n\n### Documentation\nFull API javadoc is available at: https://erikerlandson.github.io/gibbous/java/api/\n\nSome examples are included below.\n\n### How to include `gibbous` in your project\n`gibbous` is a java project, and so can be used either with java or scala.\n\nVersions prior to `gibbous 0.3.0` were published to bintray,\nwhich is no longer operative. It is now available through oss.sonatype.org\n\n`gibbous 0.3.0` is equivalent to `0.2.x`, with the exception of now including\n`\"org.apache.commons\" % \"commons-math3\" % \"3.6.1\"` as an explicit dependency.\n\n```scala\nlibraryDependencies ++= \"com.manyangled\" % \"gibbous\" % \"0.3.0\"\n```\n\n### Examples\n\n##### Minimize a convex function under constraints\n```java\nimport org.apache.commons.math3.optim.PointValuePair;\nimport org.apache.commons.math3.optim.InitialGuess;\nimport org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction;\n\nimport com.manyangled.gibbous.optim.convex.*;\n\n// create a convex objective function\nQuadraticFunction q = new QuadraticFunction(\n    new double[][] { { 1.0, 0.0 }, { 0.0, 1.0 } },\n    new double[] { 0.0, 0.0 },\n    0.0);\n\n// optimize function q with an inequality constraint and an equality constraint,\n// using the barrier method\nBarrierOptimizer barrier = new BarrierOptimizer();\nPointValuePair pvp = barrier.optimize(\n    new ObjectiveFunction(q),\n    new LinearInequalityConstraint(\n        new double[][] { { -1.0, 0.0 } }, // constraint x \u003e 1,\n        new double[] { -1.0 }),\n    new LinearEqualityConstraint(\n        new double[][] { { 0.0, 1.0 } },  // constraint y = 1,\n        new double[] { 1.0 }),\n    new InitialGuess(new double[] { 10.0, 10.0 }));\n\ndouble[] xmin = pvp.getFirst();  // { 1.0, 1.0 }\ndouble vmin = pvp.getSecond();   // 1.0\n```\n\n##### Using a feasible point solver to get a feasible initial guess\n```java\nimport org.apache.commons.math3.optim.PointValuePair;\nimport org.apache.commons.math3.optim.InitialGuess;\nimport org.apache.commons.math3.optim.nonlinear.scalar.ObjectiveFunction;\n\nimport com.manyangled.gibbous.optim.convex.*;\n\n// create a convex objective function\nQuadraticFunction q = new QuadraticFunction(\n    new double[][] { { 1.0, 0.0 }, { 0.0, 1.0 } },\n    new double[] { 0.0, 0.0 },\n    0.0);\n\n// Declare constraints separately to use for solving a feasible point\nLinearInequalityConstraint ineqc = new LinearInequalityConstraint(\n    new double[][] { { -1.0, 0.0 } }, // constraint x \u003e 1,\n    new double[] { -1.0 });\nLinearEqualityConstraint eqc = new LinearEqualityConstraint(\n    new double[][] { { 0.0, 1.0 } },  // constraint y = 1,\n    new double[] { 1.0 });\n\n// solve for a feasible point that satisfies the constraints\nPointValuePair fpvp = ConvexOptimizer.feasiblePoint(ineqc, eqc);\n// if not \u003c 0, there is no feasible point\nassert fpvp.getSecond() \u003c 0.0;\ndouble[] ig = fpvp.getFirst();\n\n// optimize function q with the same contraints, using the feasible point\n// for the initial guess\nBarrierOptimizer barrier = new BarrierOptimizer();\nPointValuePair pvp = barrier.optimize(\n    new ObjectiveFunction(q),\n    ineqc,\n    eqc,\n    new InitialGuess(ig));\n\ndouble[] xmin = pvp.getFirst();  // { 1.0, 1.0 }\ndouble vmin = pvp.getSecond();   // 1.0\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferikerlandson%2Fgibbous","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferikerlandson%2Fgibbous","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferikerlandson%2Fgibbous/lists"}