Comments (2)
Hi,
nice catch! Is it possible for you to create a pull request such that YOU get the credit for these changes?
from cppnumericalsolvers.
If you can create a patch and pull request I'd be happy to merge it.
Thanks.
On 1 Oct 2016, at 17:46, Connelly Barnes [email protected] wrote:
The example in the current README does not compile, due to:
The solver (BfgsSolver) should take as a template argument the problem class, not double.
The Vector helper has been removed from meta.
This is frustrating to new users of the library.Fixed example code:
#include
#include "cppoptlib/meta.h"
#include "cppoptlib/problem.h"
#include "cppoptlib/solver/bfgssolver.h"using namespace cppoptlib;
using Eigen::VectorXd;class Rosenbrock : public Problem {
public:
using typename cppoptlib::Problem::Scalar;
using typename cppoptlib::Problem::TVector;double value(const TVector &x) { const double t1 = (1 - x[0]); const double t2 = (x[1] - x[0] * x[0]); return t1 * t1 + 100 * t2 * t2; } void gradient(const TVector &x, TVector &grad) { grad[0] = -2 * (1 - x[0]) + 200 * (x[1] - x[0] * x[0]) * (-2 * x[0]); grad[1] = 200 * (x[1] - x[0] * x[0]); }
};
int main(int argc, char const *argv[]) {
Rosenbrock f;
BfgsSolver solver;
VectorXd x(2); x << -1, 2;
solver.minimize(f, x);
std::cout << "argmin " << x.transpose() << std::endl;
std::cout << "f in argmin " << f(x) << std::endl;
return 0;
}
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub #60, or mute the thread https://github.com/notifications/unsubscribe-auth/AKie-EO5lONW2dMoiDFw2hmoxULFJt5-ks5qvo5kgaJpZM4KLzMc.
from cppnumericalsolvers.
Related Issues (20)
- Long compilation time HOT 3
- Interference from windows.h about std::max in problem.h HOT 2
- Optimization report? HOT 1
- Can't apply constraints to the NelderMead solver HOT 1
- Constrained line search in L-BFGS-B HOT 2
- Share computation between value() and gradient() HOT 3
- L-BFGS-B doesn't work with simple example HOT 4
- Hessian of Rosenbrock function is incorrect HOT 2
- The way to calculate a finite Hessian HOT 1
- LbfgsbSolver<TProblem>::SubspaceMinimization for first iteration HOT 2
- Eigen::indexing::all not found HOT 2
- Conjugate gradient descent tries to allocate memory for hessian HOT 2
- Error C2248 occurs when starting the simple sample. HOT 3
- Including this implementation in another package with proper credits to the authors HOT 1
- Treatment of NaNs HOT 1
- Enable changing line search strategies? HOT 1
- [HELP] using CMaesB -> Eigen types issues HOT 1
- CMAESB - Make TMatrix dynamic, to avoid setting the dimension at compile time
- Setting the initial approximate Hessian? HOT 3
- neldermeadsolver for v2
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 cppnumericalsolvers.