6 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
7 ConstraintsContainerDms<STATE_DIM, CONTROL_DIM, SCALAR>::ConstraintsContainerDms(
8 std::shared_ptr<OptVectorDms<STATE_DIM, CONTROL_DIM, SCALAR>> w,
9 std::shared_ptr<tpl::TimeGrid<SCALAR>> timeGrid,
10 std::vector<std::shared_ptr<ShotContainer<STATE_DIM, CONTROL_DIM, SCALAR>>> shotContainers,
11 std::shared_ptr<ConstraintDiscretizer<STATE_DIM, CONTROL_DIM, SCALAR>> discretizedConstraints,
13 const DmsSettings settings)
14 : settings_(settings), shotContainers_(shotContainers)
16 c_init_ = std::shared_ptr<InitStateConstraint<STATE_DIM, CONTROL_DIM, SCALAR>>(
17 new InitStateConstraint<STATE_DIM, CONTROL_DIM, SCALAR>(
x0, w));
19 this->constraints_.push_back(c_init_);
21 for (
size_t shotNr = 0; shotNr < settings_.
N_; shotNr++)
23 std::shared_ptr<ContinuityConstraint<STATE_DIM, CONTROL_DIM, SCALAR>> c_i =
24 std::shared_ptr<ContinuityConstraint<STATE_DIM, CONTROL_DIM, SCALAR>>(
25 new ContinuityConstraint<STATE_DIM, CONTROL_DIM, SCALAR>(shotContainers[shotNr], w, shotNr, settings));
27 this->constraints_.push_back(c_i);
30 if (discretizedConstraints)
32 std::cout <<
"Adding discretized constraints" << std::endl;
33 this->constraints_.push_back(discretizedConstraints);
37 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
40 #pragma omp parallel for num_threads(settings_.nThreads_) 41 for (
auto shotContainer = shotContainers_.begin(); shotContainer < shotContainers_.end(); ++shotContainer)
43 (*shotContainer)->integrateShot();
47 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
50 #pragma omp parallel for num_threads(settings_.nThreads_) 51 for (
auto shotContainer = shotContainers_.begin(); shotContainer < shotContainers_.end(); ++shotContainer)
53 (*shotContainer)->integrateSensitivities();
57 template <
size_t STATE_DIM,
size_t CONTROL_DIM,
typename SCALAR>
60 c_init_->updateConstraint(x0);
void changeInitialConstraint(const state_vector_t &x0)
Updates the initial constraint.
Definition: ConstraintsContainerDms.h:59
void prepareEvaluation() override
Gets called before the constraint evaluation. This method should contain all the calculations needed ...
Definition: ConstraintsContainerDms.h:39
size_t N_
Definition: DmsSettings.h:51
void prepareJacobianEvaluation() override
Gets called before the constraint jacobian evaluation. This method should contain all the calculation...
Definition: ConstraintsContainerDms.h:49
StateVector< state_dim > x0
Definition: ConstrainedNLOCTest.cpp:14
Eigen::Matrix< double, nStates, 1 > state_vector_t