Comments (6)
Not at the moment, though it's on the roadmap. For now, you can use a barrier function as a workaround.
from optimize.
thanks.
from optimize.
@btracey Am considering working on this. Should the bounds go in optimize.problem or optimize.settings?
from optimize.
@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.
@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.
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)
- Change from Function et al. interfaces + magic to input functions struct HOT 5
- Clearly define meaning of the various iteration types HOT 5
- Make optimize silent by default
- Method does not need ProblemInfo HOT 1
- LinesearchMethod.Iterate() is subtly wrong HOT 6
- Better name for ErrNonNegativeStepDirection
- Linesearchers should check function value before asking for gradient HOT 8
- Linesearchers should test function decrease to within a tolerance HOT 2
- Pass a copy of X to evaluation routines HOT 2
- Change the order of arguments for evaluation routines like Grad() and Hess()
- Remove Linesearcher.Finished()
- Change FunConst and GradConst to DecreaseFactor and CurvatureFactor
- [question] MajorIterations settings HOT 4
- optimize: curve-fitting - implement Levenberg-Marquardt algorithm (damped least-squares) HOT 7
- optimize: Add CMA-ES optimization algorithm HOT 3
- optimize: Repo description should not end with a "." HOT 4
- optimize: NewPrinter should accept an io.Writer HOT 1
- Update of OptLoc on every iteration causes flaky optimization runs HOT 11
- Statuser docs are not accurate
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from optimize.