Equality-Constrained g2o – Extending g2o with Equality Constraint Support
ECG2O extends the open-source g2o (General Graph Optimization) framework by introducing equality constraints. This allows for the addition of equality edge factors, enabling constrained optimization within factor graphs. The library also includes an Augmented Lagrangian implementation as a benchmark for constrained optimization techniques.
ecg2o: A Seamless Extension of g2o for Equality-Constrained Factor Graph Optimization
git clone https://github.com/snt-arg/ecg2o.git
cd ecg2odocker build -t ecg2o -f docker/Dockerfile .docker run -it --rm ecg2ocd /workspace
cmake ..
make./example_gnor
./example_alor
./example_softor
./oc_testTo set up the environment without Docker, follow these steps:
-
Install Dependencies (Ubuntu 22.04)
sudo apt update sudo apt install -y \ git cmake build-essential libeigen3-dev libspdlog-dev \ libsuitesparse-dev qtdeclarative5-dev qt5-qmake \ libqglviewer-dev-qt5 libmetis-dev -
Clone and Build g2o with Patch
cd /opt git clone https://github.com/RainerKuemmerle/g2o cd g2o git checkout master
-
Apply Required Code Patch
Edit the file
g2o/core/sparse_optimizer.h:Find the line:
void update(const double* update);
Replace it with:
virtual void update(const double* update);
This change enables overriding the
updatemethod required by the BIPM extension. -
Build and Install g2o
mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DG2O_USE_OPENMP=ON -DCMAKE_CXX_FLAGS="-DEIGEN_USE_THREADS -DEIGEN_USE_OPENMP" .. make -j$(nproc) sudo make install
-
Build Your Application
Assuming you're in your app's build directory:
cmake .. make
-
**Usage
Once the library is successfully built, you can execute the provided functions for equality-constrained optimization.
./example_gnor
./example_alor
./example_softor
./oc_testEnsure that all necessary input files or configurations are correctly set up before execution.
This project is open-source and distributed under GPL-3.0 .