13 #include <condition_variable> 25 template <
size_t STATE_DIM,
30 bool CONTINUOUS =
true>
34 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
43 const std::string& settingsFile,
45 const std::string& ns =
"alg");
53 virtual void rolloutShots(
size_t firstIndex,
size_t lastIndex)
override;
67 void startupRoutine();
69 void shutdownRoutine();
75 void launchWorkerThreads();
81 void threadWork(
size_t threadId);
87 void lineSearchWorker(
size_t threadId);
95 void computeLQProblemWorker(
size_t threadId);
98 void rolloutShotWorker(
size_t threadId);
104 size_t generateUniqueProcessID(
const size_t& iterateNo,
const int workerState,
const size_t resetCount);
107 void printString(
const std::string& text);
109 std::vector<std::thread> workerThreads_;
110 std::atomic_bool workersActive_;
111 std::atomic_int workerTask_;
113 std::mutex workerWakeUpMutex_;
114 std::condition_variable workerWakeUpCondition_;
116 std::mutex kCompletedMutex_;
117 std::condition_variable kCompletedCondition_;
119 std::mutex kCompletedMutexCost_;
120 std::condition_variable kCompletedConditionCost_;
122 std::mutex lineSearchResultMutex_;
123 std::mutex alphaBestFoundMutex_;
124 std::condition_variable alphaBestFoundCondition_;
126 std::atomic_size_t alphaTaken_;
128 size_t alphaExpBest_;
130 std::atomic_bool alphaBestFound_;
131 std::vector<size_t> alphaProcessed_;
133 std::atomic_size_t kTaken_;
134 std::atomic_size_t kCompleted_;
139 SCALAR lowestCostPrevious_;
virtual void computeLQApproximation(size_t firstIndex, size_t lastIndex) override
build LQ approximation around trajectory (linearize dynamics and general constraints, quadratize cost, etc)
Definition: NLOCBackendMP-impl.hpp:212
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef NLOCBackendBase< STATE_DIM, CONTROL_DIM, P_DIM, V_DIM, SCALAR, CONTINUOUS > Base
Definition: NLOCBackendMP.hpp:36
virtual ~NLOCBackendMP()
destructor
Definition: NLOCBackendMP-impl.hpp:34
Settings for the NLOptCon algorithm.
Definition: NLOptConSettings.hpp:198
CppAD::AD< CppAD::cg::CG< double > > SCALAR
SCALAR performLineSearch() override
performLineSearch: execute the line search, possibly with different threading schemes ...
Definition: NLOCBackendMP-impl.hpp:409
Base::OptConProblem_t OptConProblem_t
Definition: NLOCBackendMP.hpp:37
Definition: NLOCBackendMP.hpp:31
C++ implementation of GNMS.
Definition: NLOCBackendBase.hpp:48
NLOCBackendMP(const OptConProblem_t &optConProblem, const NLOptConSettings &settings)
Definition: NLOCBackendMP-impl.hpp:13
const bool verbose
Definition: ConstraintComparison.h:18
virtual void rolloutShots(size_t firstIndex, size_t lastIndex) override
integrates the specified shots and computes the corresponding defects
Definition: NLOCBackendMP-impl.hpp:312