Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
638281b
rebase and change gitignore
avinashresearch1 May 25, 2026
ec85ac3
feat: add homogenization entry to Rot2 vector lift
avinashresearch1 May 26, 2026
a4edcc7
add homogenization to Rot2 with minimal edits
avinashresearch1 May 26, 2026
f4ba55a
fix: move truncation and homogenization after the original Q is formed
avinashresearch1 May 26, 2026
0fbcb2b
fix: format and check against symbolic version
avinashresearch1 May 26, 2026
3958722
feat(wip): modify to use homogenization form
avinashresearch1 Jun 17, 2026
c5aaac0
chore: docs and completed checks on Rot2 QcqpConstraints against juli…
avinashresearch1 Jun 24, 2026
74f3eb5
feat: FrobeniusPrior to QCQP conversion
avinashresearch1 Jul 1, 2026
8a7d382
test(chordal_sdp): extract QCQP Rot2 slam problem test out as an example
avinashresearch1 May 24, 2026
61e5bbf
chore(chordal_sdp): add mosek which can be turned on by running cmake…
avinashresearch1 May 24, 2026
ab990e0
feat wip(chordal): starting to write constructor
avinashresearch1 May 24, 2026
47dba76
feat: extract variable keys from QCQP
avinashresearch1 May 24, 2026
959d8be
fix: debug statements on printing keys
avinashresearch1 May 24, 2026
bbacec8
feat(chordal): collect the keys and their dimensions from the QCQP pr…
avinashresearch1 May 24, 2026
4000a58
chore: rebase to QCQP feature branch
avinashresearch1 May 26, 2026
d4d200f
feat(chordal): constructed and tested the X_ij map for the monolithic…
avinashresearch1 May 26, 2026
6d27054
feat: type conversions utilities of Q_block from Eigen to MOSEK
avinashresearch1 May 27, 2026
ac4aace
feat(chordal): add objective term to monolithic SDP from QCQP
avinashresearch1 May 27, 2026
271a012
test: test monolithic lifted objective
avinashresearch1 May 27, 2026
1c8911b
fix: manifold constraints transferred over
avinashresearch1 Jun 29, 2026
79b1299
fix: hard FrobeniusPrior constraints from QCQP moved to SDP
avinashresearch1 Jul 12, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -34,3 +34,4 @@ conductor/
.ccache/
gtsam_unstable/timing/data/
timing/results/bayes_tree_covariance/
_agent/docs
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ include(cmake/HandleEigen.cmake) # Eigen3
include(cmake/HandleMetis.cmake) # metis
include(cmake/HandleCephes.cmake) # cephes
include(cmake/HandleMKL.cmake) # MKL
include(cmake/HandleMOSEK.cmake) # MOSEK SDP solver, optional
include(cmake/HandleOpenMP.cmake) # OpenMP
include(cmake/HandlePerfTools.cmake) # Google perftools
include(cmake/HandlePython.cmake) # Python options and commands
Expand All @@ -142,6 +143,9 @@ add_subdirectory(CppUnitLite)
# Build GTSAM library
add_subdirectory(gtsam)

# Build certifiable examples
add_subdirectory(gtsam/certifiable)

# Build Tests
add_subdirectory(tests)

Expand Down Expand Up @@ -209,4 +213,4 @@ include(cmake/HandlePrintConfiguration.cmake)
include(cmake/HandleFinalChecks.cmake)

# Include CPack *after* all flags
include(CPack)
include(CPack)
141 changes: 141 additions & 0 deletions cmake/FindMOSEK.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# FindMOSEK.cmake - Find MOSEK Fusion API.
#
# Sets:
# MOSEK_FOUND - True if MOSEK was found.
# MOSEK_INCLUDE_DIRS - Include directories for Fusion.
# MOSEK_LIBRARIES - Libraries to link.
# MOSEK_LIBRARY_DIR - Runtime library directory, for rpath.
# MOSEK_FUSION_SOURCES - Optional Fusion C++ sources when the package does
# not ship a prebuilt Fusion runtime library.

set(MOSEK_ROOT "" CACHE PATH
"Path to MOSEK platform directory (contains h/ and bin/), e.g. .../tools/platform/osxaarch64")

set(_MOSEK_PLATFORMS)
if(APPLE)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm64|aarch64)$")
list(APPEND _MOSEK_PLATFORMS osxaarch64)
endif()
list(APPEND _MOSEK_PLATFORMS osx64x86)
elseif(UNIX)
list(APPEND _MOSEK_PLATFORMS linux64x86)
elseif(WIN32)
list(APPEND _MOSEK_PLATFORMS win64x86)
endif()

set(_MOSEK_BASE_CANDIDATES)
if(MOSEK_ROOT)
list(APPEND _MOSEK_BASE_CANDIDATES "${MOSEK_ROOT}")
endif()
if(DEFINED ENV{MOSEK_ROOT} AND NOT "$ENV{MOSEK_ROOT}" STREQUAL "")
list(APPEND _MOSEK_BASE_CANDIDATES "$ENV{MOSEK_ROOT}")
endif()
if(DEFINED ENV{MOSEK_HOME} AND NOT "$ENV{MOSEK_HOME}" STREQUAL "")
list(APPEND _MOSEK_BASE_CANDIDATES "$ENV{MOSEK_HOME}")
endif()
if(DEFINED ENV{HOME} AND NOT "$ENV{HOME}" STREQUAL "")
list(APPEND _MOSEK_BASE_CANDIDATES
"$ENV{HOME}/Desktop/mosek"
"$ENV{HOME}/Desktop/MOSEK/mosek"
"$ENV{HOME}/mosek")
endif()

set(_MOSEK_HINT_PATHS)
foreach(_base IN LISTS _MOSEK_BASE_CANDIDATES)
if(NOT _base)
continue()
endif()

list(APPEND _MOSEK_HINT_PATHS "${_base}")

file(GLOB _mosek_version_dirs "${_base}/*/tools/platform")
foreach(_platform_root IN LISTS _mosek_version_dirs)
foreach(_platform IN LISTS _MOSEK_PLATFORMS)
list(APPEND _MOSEK_HINT_PATHS "${_platform_root}/${_platform}")
endforeach()
endforeach()

foreach(_platform IN LISTS _MOSEK_PLATFORMS)
list(APPEND _MOSEK_HINT_PATHS "${_base}/tools/platform/${_platform}")
endforeach()
endforeach()
list(REMOVE_DUPLICATES _MOSEK_HINT_PATHS)

find_path(MOSEK_INCLUDE_DIR
NAMES fusion.h
HINTS ${_MOSEK_HINT_PATHS}
PATH_SUFFIXES h
)

find_library(MOSEK_LIBRARY
NAMES mosek64 mosek64.12.0 mosek64.11.1 mosek64.11.0 mosek64.10.2
HINTS ${_MOSEK_HINT_PATHS}
PATH_SUFFIXES bin
)

find_library(MOSEK_FUSION_LIBRARY
NAMES fusion64 fusion
HINTS ${_MOSEK_HINT_PATHS}
PATH_SUFFIXES bin
)

set(MOSEK_FUSION_SOURCES "")
set(MOSEK_FUSION_AVAILABLE FALSE)
set(_MOSEK_FUSION_SRC_DIR "")

if(MOSEK_FUSION_LIBRARY)
set(MOSEK_FUSION_AVAILABLE TRUE)
else()
set(_MOSEK_FUSION_SRC_CANDIDATES)
foreach(_hint IN LISTS _MOSEK_HINT_PATHS)
list(APPEND _MOSEK_FUSION_SRC_CANDIDATES "${_hint}/src/fusion_cxx")
endforeach()
if(MOSEK_ROOT)
list(APPEND _MOSEK_FUSION_SRC_CANDIDATES "${MOSEK_ROOT}/src/fusion_cxx")
endif()
if(MOSEK_INCLUDE_DIR)
get_filename_component(_MOSEK_PLATFORM_ROOT "${MOSEK_INCLUDE_DIR}" DIRECTORY)
list(APPEND _MOSEK_FUSION_SRC_CANDIDATES
"${_MOSEK_PLATFORM_ROOT}/src/fusion_cxx")
endif()
list(REMOVE_DUPLICATES _MOSEK_FUSION_SRC_CANDIDATES)

# Some MOSEK packages ship Fusion C++ as source instead of a runtime library.
# Check all resolved platform candidates, not just the user-supplied root.
foreach(_src_dir IN LISTS _MOSEK_FUSION_SRC_CANDIDATES)
if(EXISTS "${_src_dir}/fusion.cc")
set(_MOSEK_FUSION_SRC_DIR "${_src_dir}")
file(GLOB MOSEK_FUSION_SOURCES "${_MOSEK_FUSION_SRC_DIR}/*.cc")
if(MOSEK_FUSION_SOURCES)
set(MOSEK_FUSION_AVAILABLE TRUE)
endif()
break()
endif()
endforeach()
endif()

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MOSEK DEFAULT_MSG
MOSEK_INCLUDE_DIR MOSEK_LIBRARY MOSEK_FUSION_AVAILABLE)

if(MOSEK_FOUND)
set(MOSEK_INCLUDE_DIRS ${MOSEK_INCLUDE_DIR})
if(_MOSEK_FUSION_SRC_DIR)
list(APPEND MOSEK_INCLUDE_DIRS "${_MOSEK_FUSION_SRC_DIR}")
list(REMOVE_DUPLICATES MOSEK_INCLUDE_DIRS)
endif()
if(MOSEK_FUSION_LIBRARY)
set(MOSEK_LIBRARIES ${MOSEK_FUSION_LIBRARY} ${MOSEK_LIBRARY})
else()
set(MOSEK_LIBRARIES ${MOSEK_LIBRARY})
endif()
get_filename_component(MOSEK_LIBRARY_DIR ${MOSEK_LIBRARY} DIRECTORY)

if(NOT MOSEK_ROOT)
get_filename_component(_MOSEK_INCLUDE_PARENT "${MOSEK_INCLUDE_DIR}" DIRECTORY)
set(MOSEK_ROOT "${_MOSEK_INCLUDE_PARENT}" CACHE PATH
"Path to MOSEK platform directory (contains h/ and bin/)" FORCE)
endif()
endif()

mark_as_advanced(MOSEK_INCLUDE_DIR MOSEK_LIBRARY MOSEK_FUSION_LIBRARY)
46 changes: 46 additions & 0 deletions cmake/HandleMOSEK.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
###############################################################################
# Handle MOSEK Fusion API for SDP solving.
# MOSEK is OFF by default so normal GTSAM builds do not need MOSEK installed.

option(GTSAM_WITH_MOSEK "Build with MOSEK SDP solver support" OFF)

if(GTSAM_WITH_MOSEK)
find_package(MOSEK)
if(MOSEK_FOUND)
message(STATUS "Found MOSEK: ${MOSEK_INCLUDE_DIRS}")
message(STATUS "MOSEK libraries: ${MOSEK_LIBRARIES}")
if(MOSEK_FUSION_LIBRARY)
message(STATUS "MOSEK Fusion backend: prebuilt library")
elseif(MOSEK_FUSION_SOURCES)
message(STATUS "MOSEK Fusion backend: source files")
endif()

set(MOSEK_LICENSE_FILE "$ENV{MOSEKLM_LICENSE_FILE}" CACHE FILEPATH
"Path to MOSEK license file (mosek.lic)")
if(NOT MOSEK_LICENSE_FILE)
message(WARNING "MOSEK_LICENSE_FILE is not set. Tests will fail unless "
"MOSEKLM_LICENSE_FILE is set in the environment. Pass "
"-DMOSEK_LICENSE_FILE=/path/to/mosek.lic to cmake, or set the "
"MOSEKLM_LICENSE_FILE environment variable.")
elseif(NOT EXISTS "${MOSEK_LICENSE_FILE}")
message(WARNING "MOSEK_LICENSE_FILE does not exist: ${MOSEK_LICENSE_FILE}")
endif()

set(GTSAM_USE_MOSEK 1)
list(APPEND GTSAM_ADDITIONAL_LIBRARIES ${MOSEK_LIBRARIES})
list(APPEND GTSAM_ADDITIONAL_INCLUDE_DIRS ${MOSEK_INCLUDE_DIRS})
if(MOSEK_FUSION_SOURCES)
list(APPEND GTSAM_ADDITIONAL_SOURCES ${MOSEK_FUSION_SOURCES})
endif()

if(NOT WIN32)
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${MOSEK_LIBRARY_DIR}")
set(CMAKE_BUILD_RPATH "${CMAKE_BUILD_RPATH};${MOSEK_LIBRARY_DIR}")
endif()
else()
message(FATAL_ERROR "GTSAM_WITH_MOSEK is ON but MOSEK was not found. "
"Please set MOSEK_ROOT to your MOSEK installation path.")
endif()
else()
set(GTSAM_USE_MOSEK 0)
endif()
12 changes: 12 additions & 0 deletions gtsam/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ foreach(subdir ${gtsam_subdirs})
list(APPEND gtsam_srcs ${${subdir}_srcs})
endforeach(subdir)
list(APPEND gtsam_srcs ${gtsam_core_headers})
if(GTSAM_ADDITIONAL_SOURCES)
list(APPEND gtsam_srcs ${GTSAM_ADDITIONAL_SOURCES})
gtsam_assign_source_folders("${GTSAM_ADDITIONAL_SOURCES}")
if(MSVC)
set_source_files_properties(${GTSAM_ADDITIONAL_SOURCES} PROPERTIES COMPILE_FLAGS "/w")
else()
set_source_files_properties(${GTSAM_ADDITIONAL_SOURCES} PROPERTIES COMPILE_FLAGS "-w")
endif()
endif()

IF(MSVC)
# Add precompiled header to sources
Expand Down Expand Up @@ -137,6 +146,9 @@ message(STATUS "Building GTSAM - as a ${GTSAM_LIBRARY_TYPE} library")
add_library(gtsam ${GTSAM_LIBRARY_TYPE} ${gtsam_srcs})
target_link_libraries(gtsam PUBLIC ${GTSAM_BOOST_LIBRARIES})
target_link_libraries(gtsam PUBLIC ${GTSAM_ADDITIONAL_LIBRARIES})
if(GTSAM_ADDITIONAL_INCLUDE_DIRS)
target_include_directories(gtsam SYSTEM PRIVATE ${GTSAM_ADDITIONAL_INCLUDE_DIRS})
endif()

# Apply build flags:
gtsam_apply_build_flags(gtsam)
Expand Down
44 changes: 44 additions & 0 deletions gtsam/certifiable/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Examples for certifiable optimization experiments. These targets are kept
# outside the core gtsam library so SDP prototyping does not change libgtsam.

add_library(gtsam_certifiable STATIC LiftedSDPProblem.cpp LiftedSDPProblem.h)
target_link_libraries(gtsam_certifiable PUBLIC gtsam)
gtsam_apply_build_flags(gtsam_certifiable)
set_property(TARGET gtsam_certifiable PROPERTY FOLDER "certifiable")

if(GTSAM_BUILD_TESTS)
add_executable(testLiftedSDPs tests/testLiftedSDPs.cpp)
target_link_libraries(testLiftedSDPs CppUnitLite gtsam)
gtsam_apply_build_flags(testLiftedSDPs)
add_test(NAME testLiftedSDPs COMMAND testLiftedSDPs)
set_property(TARGET testLiftedSDPs PROPERTY FOLDER "tests")
endif()

if(GTSAM_USE_MOSEK)
target_link_libraries(gtsam_certifiable PRIVATE ${MOSEK_LIBRARIES})
target_include_directories(gtsam_certifiable SYSTEM PRIVATE ${MOSEK_INCLUDE_DIRS})

add_executable(Rot2RingQcqpToMonolithicSDP examples/Rot2RingQcqpToMonolithicSDP.cpp)
target_link_libraries(Rot2RingQcqpToMonolithicSDP gtsam_certifiable)
gtsam_apply_build_flags(Rot2RingQcqpToMonolithicSDP)
add_dependencies(examples Rot2RingQcqpToMonolithicSDP)
set_property(TARGET Rot2RingQcqpToMonolithicSDP PROPERTY FOLDER "examples")

if(NOT GTSAM_BUILD_EXAMPLES_ALWAYS)
set_target_properties(Rot2RingQcqpToMonolithicSDP PROPERTIES EXCLUDE_FROM_ALL ON)
endif()

add_executable(SimpleMosekSDPExample tests/testMOSEKInstall.cpp)
target_link_libraries(SimpleMosekSDPExample gtsam ${MOSEK_LIBRARIES})
target_include_directories(SimpleMosekSDPExample SYSTEM PRIVATE ${MOSEK_INCLUDE_DIRS})
set_target_properties(SimpleMosekSDPExample PROPERTIES
BUILD_RPATH "${MOSEK_LIBRARY_DIR}"
INSTALL_RPATH "${MOSEK_LIBRARY_DIR}")
gtsam_apply_build_flags(SimpleMosekSDPExample)
add_dependencies(examples SimpleMosekSDPExample)
set_property(TARGET SimpleMosekSDPExample PROPERTY FOLDER "examples")

if(NOT GTSAM_BUILD_EXAMPLES_ALWAYS)
set_target_properties(SimpleMosekSDPExample PROPERTIES EXCLUDE_FROM_ALL ON)
endif()
endif()
Loading
Loading