Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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 @@ -59,6 +59,7 @@ docs/doxygen/html/
docs/readthedocs/site
docs/readthedocs/_build/
docs/readthedocs/_generated/
docs/readthedocs/_generated_stubs/
docs/python_api/_build/

# Data files
Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/BallJointConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
#include "dart/dynamics/BodyNode.hpp"
#include "dart/dynamics/Skeleton.hpp"
#include "dart/math/Constants.hpp"
#include "dart/math/lcp/Dantzig/Lcp.hpp"
#include "dart/math/lcp/dantzig/Lcp.hpp"

#include <iostream>

Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/BoxedLcpConstraintSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
#include "dart/constraint/ConstraintBase.hpp"
#include "dart/constraint/DantzigBoxedLcpSolver.hpp"
#include "dart/constraint/PgsBoxedLcpSolver.hpp"
#include "dart/math/lcp/Dantzig/Lcp.hpp"
#include "dart/math/lcp/Lemke.hpp"
#include "dart/math/lcp/dantzig/Lcp.hpp"

namespace dart {
namespace constraint {
Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/ContactConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
#include "dart/dynamics/Skeleton.hpp"
#include "dart/math/Constants.hpp"
#include "dart/math/Helpers.hpp"
#include "dart/math/lcp/Dantzig/Lcp.hpp"
#include "dart/math/lcp/dantzig/Lcp.hpp"

#include <iostream>

Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/DantzigBoxedLcpSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "dart/constraint/DantzigBoxedLcpSolver.hpp"

#include "dart/common/Profile.hpp"
#include "dart/math/lcp/Dantzig/Lcp.hpp"
#include "dart/math/lcp/dantzig/Lcp.hpp"

namespace dart {
namespace constraint {
Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/DantzigLCPSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@
#include "dart/common/Logging.hpp"
#include "dart/constraint/ConstrainedGroup.hpp"
#include "dart/constraint/ConstraintBase.hpp"
#include "dart/math/lcp/Dantzig/Lcp.hpp"
#include "dart/math/lcp/Lemke.hpp"
#include "dart/math/lcp/dantzig/Lcp.hpp"

namespace dart {
namespace constraint {
Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/JointConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "dart/dynamics/Joint.hpp"
#include "dart/dynamics/Skeleton.hpp"
#include "dart/math/Constants.hpp"
#include "dart/math/lcp/Dantzig/Lcp.hpp"
#include "dart/math/lcp/dantzig/Lcp.hpp"

#include <algorithm>

Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/JointLimitConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#include "dart/dynamics/Joint.hpp"
#include "dart/dynamics/Skeleton.hpp"
#include "dart/math/Constants.hpp"
#include "dart/math/lcp/Dantzig/Lcp.hpp"
#include "dart/math/lcp/dantzig/Lcp.hpp"

#include <iostream>

Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/MimicMotorConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "dart/dynamics/BodyNode.hpp"
#include "dart/dynamics/Joint.hpp"
#include "dart/dynamics/Skeleton.hpp"
#include "dart/math/lcp/Dantzig/Lcp.hpp"
#include "dart/math/lcp/dantzig/Lcp.hpp"

#include <iostream>

Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/PGSLCPSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@
#include "dart/common/Profile.hpp"
#include "dart/constraint/ConstrainedGroup.hpp"
#include "dart/constraint/ConstraintBase.hpp"
#include "dart/math/lcp/Dantzig/Lcp.hpp"
#include "dart/math/lcp/Lemke.hpp"
#include "dart/math/lcp/dantzig/Lcp.hpp"

namespace dart {
namespace constraint {
Expand Down
4 changes: 2 additions & 2 deletions dart/constraint/PgsBoxedLcpSolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
#include "dart/constraint/PgsBoxedLcpSolver.hpp"

#include "dart/math/Constants.hpp"
#include "dart/math/lcp/Dantzig/Matrix.hpp"
#include "dart/math/lcp/Dantzig/Misc.hpp"
#include "dart/math/lcp/dantzig/Matrix.hpp"
#include "dart/math/lcp/dantzig/Misc.hpp"

#include <Eigen/Dense>

Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/ServoMotorConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include "dart/dynamics/BodyNode.hpp"
#include "dart/dynamics/Joint.hpp"
#include "dart/dynamics/Skeleton.hpp"
#include "dart/math/lcp/Dantzig/Lcp.hpp"
#include "dart/math/lcp/dantzig/Lcp.hpp"

#include <iostream>

Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/SoftContactConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
#include "dart/dynamics/SoftMeshShape.hpp"
#include "dart/math/Constants.hpp"
#include "dart/math/Helpers.hpp"
#include "dart/math/lcp/Dantzig/Lcp.hpp"
#include "dart/math/lcp/dantzig/Lcp.hpp"

#include <iostream>

Expand Down
2 changes: 1 addition & 1 deletion dart/constraint/WeldJointConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#include "dart/dynamics/BodyNode.hpp"
#include "dart/dynamics/Skeleton.hpp"
#include "dart/math/Constants.hpp"
#include "dart/math/lcp/Dantzig/Lcp.hpp"
#include "dart/math/lcp/dantzig/Lcp.hpp"

namespace dart {
namespace constraint {
Expand Down
2 changes: 1 addition & 1 deletion dart/lcpsolver/dantzig/PivotMatrix.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once

#include "dart/lcpsolver/detail/DeprecatedNamespace.hpp"
#include "dart/math/lcp/Dantzig/PivotMatrix.hpp"
#include "dart/math/lcp/dantzig/PivotMatrix.hpp"
2 changes: 1 addition & 1 deletion dart/lcpsolver/dantzig/common.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once

#include "dart/lcpsolver/detail/DeprecatedNamespace.hpp"
#include "dart/math/lcp/Dantzig/Common.hpp"
#include "dart/math/lcp/dantzig/Common.hpp"
2 changes: 1 addition & 1 deletion dart/lcpsolver/dantzig/lcp-impl.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once

#include "dart/lcpsolver/detail/DeprecatedNamespace.hpp"
#include "dart/math/lcp/Dantzig/Lcp-impl.hpp"
#include "dart/math/lcp/dantzig/Lcp-impl.hpp"
2 changes: 1 addition & 1 deletion dart/lcpsolver/dantzig/lcp.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once

#include "dart/lcpsolver/detail/DeprecatedNamespace.hpp"
#include "dart/math/lcp/Dantzig/Lcp.hpp"
#include "dart/math/lcp/dantzig/Lcp.hpp"
2 changes: 1 addition & 1 deletion dart/lcpsolver/dantzig/matrix-impl.hpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once

#include "dart/lcpsolver/detail/DeprecatedNamespace.hpp"
#include "dart/math/lcp/Dantzig/Matrix-impl.hpp"
#include "dart/math/lcp/dantzig/Matrix-impl.hpp"
2 changes: 1 addition & 1 deletion dart/lcpsolver/dantzig/matrix.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once

#include "dart/lcpsolver/detail/DeprecatedNamespace.hpp"
#include "dart/math/lcp/Dantzig/Matrix.hpp"
#include "dart/math/lcp/dantzig/Matrix.hpp"
2 changes: 1 addition & 1 deletion dart/lcpsolver/dantzig/misc.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma once

#include "dart/lcpsolver/detail/DeprecatedNamespace.hpp"
#include "dart/math/lcp/Dantzig/Misc.hpp"
#include "dart/math/lcp/dantzig/Misc.hpp"
15 changes: 0 additions & 15 deletions dart/lcpsolver/detail/DeprecatedNamespace.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,4 @@
#endif
#endif

namespace dart {
namespace math {
namespace lcp {
} // namespace lcp
} // namespace math
} // namespace dart

namespace dart {
namespace
[[deprecated("dart::lcpsolver is deprecated; include dart/math/lcp headers "
"and use dart::math instead")]] lcpsolver {
using namespace math::lcp;
} // namespace lcpsolver
} // namespace dart

#endif // DART_LCPSOLVER_DETAIL_DEPRECATEDNAMESPACE_HPP_
14 changes: 11 additions & 3 deletions dart/math/lcp/All.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
#pragma once

#include "dart/math/lcp/Dantzig/Lcp.hpp"
#include "dart/math/lcp/Lemke.hpp"
#include "dart/math/lcp/ODELCPSolver.hpp"
// New LCP solver framework (v2)
#include <dart/math/lcp/LcpSolver.hpp>
#include <dart/math/lcp/LcpTypes.hpp>

// Pivoting methods
#include <dart/math/lcp/pivoting/LemkeSolver.hpp>

// Legacy LCP solvers (v1 - backward compatibility)
#include <dart/math/lcp/Lemke.hpp>
#include <dart/math/lcp/ODELCPSolver.hpp>
#include <dart/math/lcp/dantzig/Lcp.hpp>
69 changes: 66 additions & 3 deletions dart/math/lcp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,36 @@ dart_add_core_headers(${math_lcp_hdrs})
dart_add_core_sources(${math_lcp_srcs})

# Dantzig implementation headers and sources (remain public API)
file(GLOB math_lcp_dantzig_hdrs "Dantzig/*.hpp")
file(GLOB math_lcp_dantzig_srcs "Dantzig/*.cpp")
file(GLOB math_lcp_dantzig_hdrs "dantzig/*.hpp")
file(GLOB math_lcp_dantzig_srcs "dantzig/*.cpp")
dart_add_core_headers(${math_lcp_dantzig_hdrs})
dart_add_core_sources(${math_lcp_dantzig_srcs})

# Compute relative header names (e.g., lcp/Lemke.hpp, lcp/Dantzig/Common.hpp)
# Pivoting methods (Lemke, Dantzig wrappers, etc.)
file(GLOB math_lcp_pivoting_hdrs "pivoting/*.hpp")
file(GLOB math_lcp_pivoting_srcs "pivoting/*.cpp")
dart_add_core_headers(${math_lcp_pivoting_hdrs})
dart_add_core_sources(${math_lcp_pivoting_srcs})

# Projection methods (PGS, PSOR, BGS, etc. - future)
file(GLOB math_lcp_projection_hdrs "projection/*.hpp")
file(GLOB math_lcp_projection_srcs "projection/*.cpp")
dart_add_core_headers(${math_lcp_projection_hdrs})
dart_add_core_sources(${math_lcp_projection_srcs})

# Newton methods (future)
file(GLOB math_lcp_newton_hdrs "newton/*.hpp")
file(GLOB math_lcp_newton_srcs "newton/*.cpp")
dart_add_core_headers(${math_lcp_newton_hdrs})
dart_add_core_sources(${math_lcp_newton_srcs})

# Other methods (interior point, etc. - future)
file(GLOB math_lcp_other_hdrs "other/*.hpp")
file(GLOB math_lcp_other_srcs "other/*.cpp")
dart_add_core_headers(${math_lcp_other_hdrs})
dart_add_core_sources(${math_lcp_other_srcs})

# Compute relative header names (e.g., lcp/Lemke.hpp, lcp/dantzig/Common.hpp)
set(math_lcp_header_names "")
foreach(header ${math_lcp_hdrs})
file(RELATIVE_PATH rel_path "${CMAKE_CURRENT_SOURCE_DIR}" ${header})
Expand All @@ -29,8 +53,47 @@ install(
COMPONENT headers
)

install(
FILES ${math_lcp_dantzig_hdrs}
DESTINATION include/dart/math/lcp/dantzig
COMPONENT headers
)

# Compatibility install for legacy Dantzig include path
install(
FILES ${math_lcp_dantzig_hdrs}
DESTINATION include/dart/math/lcp/Dantzig
COMPONENT headers
)

if(math_lcp_pivoting_hdrs)
install(
FILES ${math_lcp_pivoting_hdrs}
DESTINATION include/dart/math/lcp/pivoting
COMPONENT headers
)
endif()

if(math_lcp_projection_hdrs)
install(
FILES ${math_lcp_projection_hdrs}
DESTINATION include/dart/math/lcp/projection
COMPONENT headers
)
endif()

if(math_lcp_newton_hdrs)
install(
FILES ${math_lcp_newton_hdrs}
DESTINATION include/dart/math/lcp/newton
COMPONENT headers
)
endif()

if(math_lcp_other_hdrs)
install(
FILES ${math_lcp_other_hdrs}
DESTINATION include/dart/math/lcp/other
COMPONENT headers
)
endif()
58 changes: 58 additions & 0 deletions dart/math/lcp/LcpSolver.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* Copyright (c) 2011-2025, The DART development contributors
* All rights reserved.
*
* The list of contributors can be found at:
* https://github.com/dartsim/dart/blob/main/LICENSE
*
* This file is provided under the following "BSD-style" License:
* Redistribution and use in source and binary forms, with or
* without modification, are permitted provided that the following
* conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
* CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/

#include "dart/math/lcp/LcpSolver.hpp"

namespace dart {
namespace math {

//==============================================================================
LcpResult LcpSolver::solve(
const Eigen::MatrixXd& A, const Eigen::VectorXd& b, Eigen::VectorXd& x)
{
return solve(A, b, x, mDefaultOptions);
}

//==============================================================================
LcpOptions LcpSolver::getDefaultOptions() const
{
return mDefaultOptions;
}

//==============================================================================
void LcpSolver::setDefaultOptions(const LcpOptions& options)
{
mDefaultOptions = options;
}

} // namespace math
} // namespace dart
Loading
Loading