Coder Social home page Coder Social logo

Comments (6)

btracey avatar btracey commented on July 21, 2024

Not at the moment, though it's on the roadmap. For now, you can use a barrier function as a workaround.

from optimize.

 avatar commented on July 21, 2024

thanks.

from optimize.

 avatar commented on July 21, 2024

@btracey Am considering working on this. Should the bounds go in optimize.problem or optimize.settings?

from optimize.

sbinet avatar sbinet commented on July 21, 2024

@btracey I have also a student working on an optimize.problem (via go-hep.org/x/hep/fit) that would require adding constrains to the optimization process.
any pointer to what you were considering as an implementation?

from optimize.

btracey avatar btracey commented on July 21, 2024

@vladimir-ch should be brought into this as well.

The spirit of what we should have is

type Problem struct {
    Func func(x []float64) float64
    Grad func(grad []float64, x []float64)
    Hess func(hess mat64.MutableSymmetric, x []float64)
    Status func() (Status, error)

    Bounds []Bound
    Eq []func(x []float64) float64   // Equality constraints that f(x) = 0
    Ineq []func(x []float64) float64 // Inequality constraints that f(x) <= 0
}

However, this doesn't quite work, because we want to support constraints where we also know the gradient and the hessian. So we really want something like

type Function struct {
    Func func(x []float64) float64
    Grad func(grad []float64, x []float64)
    Hess func(hess mat64.MutableSymmetric, x []float64)
}

type Problem struct{
    Status func() (Status, error)
    
    Objective Function
    Bounds []Bound
    Eq []Function   // Equality constraints that f(x) = 0
    Ineq []Function // Inequality constraints that f(x) <= 0
}

I think that's how we would want to change the representation.

It's not hard to support something to handle constrained optimization. We can have a Barrier optimizer that uses a barrier/penalty method to convert the constrained problem into an unconstrained problem, and uses one of our unconstrained optimizers.

It is hard to support a real gradient-based optimizer. The typical algorithm is an SQP method (like SLSQP), which requires a QP solver, which requires an LP solver. This is why optimize/convex/lp exists, but I haven't found the desire to do all of the cases of QP yet (unconstrained, only equality, only inequality, only bounded, any combination). I've started looking into this a few times, but it'll require factoring out large parts of the Simplex solver in order to find initial feasible points. Once QP exists, then we can figure out how to do a real SQP solver.

Rewriting SLSQP into a better solver was one of my main goals at the start of Gonum, and yet here we are...

from optimize.

vladimir-ch avatar vladimir-ch commented on July 21, 2024

Closing because this repository is no longer maintained. Development has moved to https://github.com/gonum/gonum.

The follow-up issue is gonum/gonum#354

from optimize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.