43 TrajectoryOptimizer::TrajectoryOptimizer(
StateSimPtr& _stateSim,
44 unique_ptr<TrajectorySimulator::CostsEvaluatorClass> _costsEvaluator,
50 void TrajectoryOptimizer::optimize()
52 throw "not implemented";
63 auto& costsEvaluator =
trajSim()->costsEvaluator_;
65 costsEvaluator->gradF.resize(
optState_->valueSize());
66 costsEvaluator->gradG.resize(costsEvaluator->g.size(),
optState_->valueSize());
67 costsEvaluator->gradH.resize(costsEvaluator->h.size(),
optState_->valueSize());
69 fCache = costsEvaluator->f;
70 gCache = costsEvaluator->g;
71 hCache = costsEvaluator->h;
73 for (
size_t i = 0; i <
optState_->valueSize(); ++i)
79 costsEvaluator->f =
fCache;
80 costsEvaluator->g =
gCache;
81 costsEvaluator->h =
hCache;
86 const double optStateIFix =
optState_->value(_idx);
92 auto& costsEvaluator =
trajSim()->costsEvaluator_;
94 for (
int j = 0; j < costsEvaluator->gradG.rows(); ++j)
96 costsEvaluator->gradG(j, _idx) = (costsEvaluator->g[j] -
gCache[j]) /
stepSize_;
98 for (
int j = 0; j < costsEvaluator->gradH.rows(); ++j)
100 costsEvaluator->gradH(j, _idx) = (costsEvaluator->h[j] -
hCache[j]) /
stepSize_;
void evaluateTrajectory(const double &_arcBegin=0)
std::shared_ptr< OptimizationState > OptimizationStateSPtr
Helper function needed to upgrade c++ 2011.
TrajectorySimulatorSPtr & trajSim()
std::vector< double > hCache
virtual void initState0ParamFuncsHValid(const size_t &_optFailCount)
std::vector< double > gCache
void computeJacobian1Entry(size_t _idx)
std::shared_ptr< StateSim > StateSimPtr
OptimizationStateSPtr optState_