Skip to content

Commit 811369d

Browse files
committed
Finish 4.2a0
2 parents 69a3a75 + e5b928c commit 811369d

File tree

197 files changed

+7008
-1959
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+7008
-1959
lines changed

.github/workflows/build-windows.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ jobs:
2626
windows-2019-cl,
2727
]
2828

29-
build_type: [Debug, Release]
29+
build_type: [
30+
Debug,
31+
#TODO(Varun) The release build takes over 2.5 hours, need to figure out why.
32+
# Release
33+
]
3034
build_unstable: [ON]
3135
include:
3236
#TODO This build fails, need to understand why.
@@ -90,13 +94,18 @@ jobs:
9094
- name: Checkout
9195
uses: actions/checkout@v2
9296

93-
- name: Build
97+
- name: Configuration
9498
run: |
9599
cmake -E remove_directory build
96100
cmake -B build -S . -DGTSAM_BUILD_EXAMPLES_ALWAYS=OFF -DBOOST_ROOT="${env:BOOST_ROOT}" -DBOOST_INCLUDEDIR="${env:BOOST_ROOT}\boost\include" -DBOOST_LIBRARYDIR="${env:BOOST_ROOT}\lib"
97-
cmake --build build --config ${{ matrix.build_type }} --target gtsam
98-
cmake --build build --config ${{ matrix.build_type }} --target gtsam_unstable
99-
cmake --build build --config ${{ matrix.build_type }} --target wrap
100-
cmake --build build --config ${{ matrix.build_type }} --target check.base
101-
cmake --build build --config ${{ matrix.build_type }} --target check.base_unstable
102-
cmake --build build --config ${{ matrix.build_type }} --target check.linear
101+
102+
- name: Build
103+
run: |
104+
# Since Visual Studio is a multi-generator, we need to use --config
105+
# https://stackoverflow.com/a/24470998/1236990
106+
cmake --build build -j 4 --config ${{ matrix.build_type }} --target gtsam
107+
cmake --build build -j 4 --config ${{ matrix.build_type }} --target gtsam_unstable
108+
cmake --build build -j 4 --config ${{ matrix.build_type }} --target wrap
109+
cmake --build build -j 4 --config ${{ matrix.build_type }} --target check.base
110+
cmake --build build -j 4 --config ${{ matrix.build_type }} --target check.base_unstable
111+
cmake --build build -j 4 --config ${{ matrix.build_type }} --target check.linear

CMakeLists.txt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,18 @@ endif()
99

1010
# Set the version number for the library
1111
set (GTSAM_VERSION_MAJOR 4)
12-
set (GTSAM_VERSION_MINOR 1)
13-
set (GTSAM_VERSION_PATCH 1)
12+
set (GTSAM_VERSION_MINOR 2)
13+
set (GTSAM_VERSION_PATCH 0)
14+
set (GTSAM_PRERELEASE_VERSION "a0")
1415
math (EXPR GTSAM_VERSION_NUMERIC "10000 * ${GTSAM_VERSION_MAJOR} + 100 * ${GTSAM_VERSION_MINOR} + ${GTSAM_VERSION_PATCH}")
15-
set (GTSAM_VERSION_STRING "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}")
1616

17-
set (CMAKE_PROJECT_VERSION ${GTSAM_VERSION_STRING})
17+
if (${GTSAM_VERSION_PATCH} EQUAL 0)
18+
set (GTSAM_VERSION_STRING "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}${GTSAM_PRERELEASE_VERSION}")
19+
else()
20+
set (GTSAM_VERSION_STRING "${GTSAM_VERSION_MAJOR}.${GTSAM_VERSION_MINOR}.${GTSAM_VERSION_PATCH}${GTSAM_PRERELEASE_VERSION}")
21+
endif()
22+
message(STATUS "GTSAM Version: ${GTSAM_VERSION_STRING}")
23+
1824
set (CMAKE_PROJECT_VERSION_MAJOR ${GTSAM_VERSION_MAJOR})
1925
set (CMAKE_PROJECT_VERSION_MINOR ${GTSAM_VERSION_MINOR})
2026
set (CMAKE_PROJECT_VERSION_PATCH ${GTSAM_VERSION_PATCH})
@@ -87,6 +93,13 @@ if(GTSAM_BUILD_PYTHON OR GTSAM_INSTALL_MATLAB_TOOLBOX)
8793
CACHE STRING "The Python version to use for wrapping")
8894
# Set the include directory for matlab.h
8995
set(GTWRAP_INCLUDE_NAME "wrap")
96+
97+
# Copy matlab.h to the correct folder.
98+
configure_file(${PROJECT_SOURCE_DIR}/wrap/matlab.h
99+
${PROJECT_BINARY_DIR}/wrap/matlab.h COPYONLY)
100+
# Add the include directories so that matlab.h can be found
101+
include_directories("${PROJECT_BINARY_DIR}" "${GTSAM_EIGEN_INCLUDE_FOR_BUILD}")
102+
90103
add_subdirectory(wrap)
91104
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/wrap/cmake")
92105
endif()

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
**Important Note**
44

5-
As of August 1 2020, the `develop` branch is officially in "Pre 4.1" mode, and features deprecated in 4.0 have been removed. Please use the last [4.0.3 release](https://github.com/borglab/gtsam/releases/tag/4.0.3) if you need those features.
5+
As of Dec 2021, the `develop` branch is officially in "Pre 4.2" mode. A great new feature we will be adding in 4.2 is *hybrid inference* a la DCSLAM (Kevin Doherty et al) and we envision several API-breaking changes will happen in the discrete folder.
66

7-
However, most are easily converted and can be tracked down (in 4.0.3) by disabling the cmake flag `GTSAM_ALLOW_DEPRECATED_SINCE_V4`.
7+
In addition, features deprecated in 4.1 will be removed. Please use the last [4.1.1 release](https://github.com/borglab/gtsam/releases/tag/4.1.1) if you need those features. However, most (not all, unfortunately) are easily converted and can be tracked down (in 4.1.1) by disabling the cmake flag `GTSAM_ALLOW_DEPRECATED_SINCE_V41`.
88

99
## What is GTSAM?
1010

examples/DiscreteBayesNetExample.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ int main(int argc, char **argv) {
5656
DiscreteBayesNet::shared_ptr chordal = fg.eliminateSequential(ordering);
5757

5858
// solve
59-
DiscreteFactor::sharedValues mpe = chordal->optimize();
60-
GTSAM_PRINT(*mpe);
59+
auto mpe = chordal->optimize();
60+
GTSAM_PRINT(mpe);
6161

6262
// We can also build a Bayes tree (directed junction tree).
6363
// The elimination order above will do fine:
@@ -70,14 +70,14 @@ int main(int argc, char **argv) {
7070

7171
// solve again, now with evidence
7272
DiscreteBayesNet::shared_ptr chordal2 = fg.eliminateSequential(ordering);
73-
DiscreteFactor::sharedValues mpe2 = chordal2->optimize();
74-
GTSAM_PRINT(*mpe2);
73+
auto mpe2 = chordal2->optimize();
74+
GTSAM_PRINT(mpe2);
7575

7676
// We can also sample from it
7777
cout << "\n10 samples:" << endl;
7878
for (size_t i = 0; i < 10; i++) {
79-
DiscreteFactor::sharedValues sample = chordal2->sample();
80-
GTSAM_PRINT(*sample);
79+
auto sample = chordal2->sample();
80+
GTSAM_PRINT(sample);
8181
}
8282
return 0;
8383
}

examples/DiscreteBayesNet_FG.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ using namespace gtsam;
3333
int main(int argc, char **argv) {
3434
// Define keys and a print function
3535
Key C(1), S(2), R(3), W(4);
36-
auto print = [=](DiscreteFactor::sharedValues values) {
37-
cout << boolalpha << "Cloudy = " << static_cast<bool>((*values)[C])
38-
<< " Sprinkler = " << static_cast<bool>((*values)[S])
39-
<< " Rain = " << boolalpha << static_cast<bool>((*values)[R])
40-
<< " WetGrass = " << static_cast<bool>((*values)[W]) << endl;
36+
auto print = [=](const DiscreteFactor::Values& values) {
37+
cout << boolalpha << "Cloudy = " << static_cast<bool>(values.at(C))
38+
<< " Sprinkler = " << static_cast<bool>(values.at(S))
39+
<< " Rain = " << boolalpha << static_cast<bool>(values.at(R))
40+
<< " WetGrass = " << static_cast<bool>(values.at(W)) << endl;
4141
};
4242

4343
// We assume binary state variables
@@ -85,7 +85,7 @@ int main(int argc, char **argv) {
8585
}
8686

8787
// "Most Probable Explanation", i.e., configuration with largest value
88-
DiscreteFactor::sharedValues mpe = graph.eliminateSequential()->optimize();
88+
auto mpe = graph.eliminateSequential()->optimize();
8989
cout << "\nMost Probable Explanation (MPE):" << endl;
9090
print(mpe);
9191

@@ -97,7 +97,7 @@ int main(int argc, char **argv) {
9797

9898
// solve again, now with evidence
9999
DiscreteBayesNet::shared_ptr chordal = graph.eliminateSequential();
100-
DiscreteFactor::sharedValues mpe_with_evidence = chordal->optimize();
100+
auto mpe_with_evidence = chordal->optimize();
101101

102102
cout << "\nMPE given C=0:" << endl;
103103
print(mpe_with_evidence);
@@ -113,7 +113,7 @@ int main(int argc, char **argv) {
113113
// We can also sample from it
114114
cout << "\n10 samples:" << endl;
115115
for (size_t i = 0; i < 10; i++) {
116-
DiscreteFactor::sharedValues sample = chordal->sample();
116+
auto sample = chordal->sample();
117117
print(sample);
118118
}
119119
return 0;

examples/FisheyeExample.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,7 @@ int main(int argc, char *argv[]) {
122122
std::cout << "initial error=" << graph.error(initialEstimate) << std::endl;
123123
std::cout << "final error=" << graph.error(result) << std::endl;
124124

125-
std::ofstream os("examples/vio_batch.dot");
126-
graph.saveGraph(os, result);
125+
graph.saveGraph("examples/vio_batch.dot", result);
127126

128127
return 0;
129128
}

examples/HMMExample.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,14 @@ int main(int argc, char **argv) {
6666
chordal->print("Eliminated");
6767

6868
// solve
69-
DiscreteFactor::sharedValues mpe = chordal->optimize();
70-
GTSAM_PRINT(*mpe);
69+
auto mpe = chordal->optimize();
70+
GTSAM_PRINT(mpe);
7171

7272
// We can also sample from it
7373
cout << "\n10 samples:" << endl;
7474
for (size_t k = 0; k < 10; k++) {
75-
DiscreteFactor::sharedValues sample = chordal->sample();
76-
GTSAM_PRINT(*sample);
75+
auto sample = chordal->sample();
76+
GTSAM_PRINT(sample);
7777
}
7878

7979
// Or compute the marginals. This re-eliminates the FG into a Bayes tree

examples/Pose2SLAMExample_graphviz.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,10 @@ int main(int argc, char** argv) {
6060

6161
// save factor graph as graphviz dot file
6262
// Render to PDF using "fdp Pose2SLAMExample.dot -Tpdf > graph.pdf"
63-
ofstream os("Pose2SLAMExample.dot");
64-
graph.saveGraph(os, result);
63+
graph.saveGraph("Pose2SLAMExample.dot", result);
6564

6665
// Also print out to console
67-
graph.saveGraph(cout, result);
66+
graph.dot(cout, result);
6867

6968
return 0;
7069
}

examples/UGM_chain.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ int main(int argc, char** argv) {
7070
// "Decoding", i.e., configuration with largest value
7171
// We use sequential variable elimination
7272
DiscreteBayesNet::shared_ptr chordal = graph.eliminateSequential();
73-
DiscreteFactor::sharedValues optimalDecoding = chordal->optimize();
74-
optimalDecoding->print("\nMost Probable Explanation (optimalDecoding)\n");
73+
auto optimalDecoding = chordal->optimize();
74+
optimalDecoding.print("\nMost Probable Explanation (optimalDecoding)\n");
7575

7676
// "Inference" Computing marginals for each node
7777
// Here we'll make use of DiscreteMarginals class, which makes use of

examples/UGM_small.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ int main(int argc, char** argv) {
6363
// "Decoding", i.e., configuration with largest value (MPE)
6464
// We use sequential variable elimination
6565
DiscreteBayesNet::shared_ptr chordal = graph.eliminateSequential();
66-
DiscreteFactor::sharedValues optimalDecoding = chordal->optimize();
67-
optimalDecoding->print("\noptimalDecoding");
66+
auto optimalDecoding = chordal->optimize();
67+
GTSAM_PRINT(optimalDecoding);
6868

6969
// "Inference" Computing marginals
7070
cout << "\nComputing Node Marginals .." << endl;

0 commit comments

Comments
 (0)