Skip to content

Commit 092e122

Browse files
committed
fix metrics for initial state
1 parent 3bfd820 commit 092e122

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

ocs2_ipm/src/IpmSolver.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -636,8 +636,10 @@ PerformanceIndex IpmSolver::setupQuadraticSubproblem(const std::vector<Annotated
636636
};
637637
runParallel(std::move(parallelTask));
638638

639-
// Account for init state in performance
640-
performance.front().dynamicsViolationSSE += (initState - x.front()).squaredNorm();
639+
// Account for initial state in performance
640+
const vector_t initDynamicsViolation = initState - x.front();
641+
metrics.front().dynamicsViolation += initDynamicsViolation;
642+
performance.front().dynamicsViolationSSE += initDynamicsViolation.squaredNorm();
641643

642644
// Sum performance of the threads
643645
PerformanceIndex totalPerformance = std::accumulate(std::next(performance.begin()), performance.end(), performance.front());

ocs2_sqp/ocs2_sqp/src/SqpSolver.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,10 @@ PerformanceIndex SqpSolver::setupQuadraticSubproblem(const std::vector<Annotated
358358
};
359359
runParallel(std::move(parallelTask));
360360

361-
// Account for init state in performance
362-
performance.front().dynamicsViolationSSE += (initState - x.front()).squaredNorm();
361+
// Account for initial state in performance
362+
const vector_t initDynamicsViolation = initState - x.front();
363+
metrics.front().dynamicsViolation += initDynamicsViolation;
364+
performance.front().dynamicsViolationSSE += initDynamicsViolation.squaredNorm();
363365

364366
// Sum performance of the threads
365367
PerformanceIndex totalPerformance = std::accumulate(std::next(performance.begin()), performance.end(), performance.front());

0 commit comments

Comments
 (0)