Skip to content

Commit

Permalink
fix: run formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
mimizh2418 committed Dec 6, 2024
1 parent 0ec00a4 commit 1b135f8
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 12 deletions.
2 changes: 1 addition & 1 deletion examples/derivatives/main.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) 2024 Alvin Zhang.

#include <suboptimal/autodiff/Variable.h>
#include <suboptimal/autodiff/Derivatives.h>
#include <suboptimal/autodiff/Variable.h>

#include <array>
#include <cmath>
Expand Down
2 changes: 1 addition & 1 deletion examples/elevatorMPC/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@

#include <Eigen/Core>

#include "ElevatorMPC.h"
#include "Dynamics.h"
#include "ElevatorMPC.h"

int main() {
using namespace std::chrono_literals;
Expand Down
6 changes: 4 additions & 2 deletions include/suboptimal/NonlinearProblem.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// Copyright (c) 2024 Alvin Zhang.

#pragma once

#include <concepts>
#include <vector>
#include <utility>
#include <vector>

#include "suboptimal/autodiff/Variable.h"

Expand Down Expand Up @@ -79,7 +81,7 @@ class NonlinearProblem {
* @param objective the function to maximize
*/
void maximize(Variable&& objective);

/**
* Adds a constraint to the optimization problem
* @param constraint the constraint to add
Expand Down
4 changes: 4 additions & 0 deletions src/NonlinearProblem.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// Copyright (c) 2024 Alvin Zhang.

#include "suboptimal/NonlinearProblem.h"

#include <utility>

namespace suboptimal {
NonlinearProblem::NonlinearProblem() = default;

Expand Down
1 change: 0 additions & 1 deletion src/autodiff/Variable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ Variable asinh(const Variable& x) {

Variable acosh(const Variable& x) {
return acosh(x.expr);

}

Variable atanh(const Variable& x) {
Expand Down
4 changes: 2 additions & 2 deletions src/solvers/linear/Simplex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
#include "suboptimal/solvers/SolverExitStatus.h"
#include "suboptimal/solvers/linear/SimplexPivotRule.h"
#include "suboptimal/solvers/linear/SimplexSolverConfig.h"
#include "util/FinalAction.h"
#include "util/SolverProfiler.h"
#include "util/Assert.h"
#include "util/ComparisonUtil.h"
#include "util/FinalAction.h"
#include "util/SolverProfiler.h"

using namespace Eigen;

Expand Down
6 changes: 5 additions & 1 deletion test/autodiff/GradientTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#define CATCH_CONFIG_FAST_COMPILE

#include <suboptimal/autodiff/Variable.h>
#include <suboptimal/autodiff/Derivatives.h>
#include <suboptimal/autodiff/Variable.h>

#include <cmath>
#include <iostream>
Expand Down Expand Up @@ -31,6 +31,10 @@ TEST_CASE("Autodiff - Basic gradient", "[autodiff]") {

const Eigen::Vector2d grad_val{(x_val * x_val - y_val * y_val) / (5 * x_val * x_val), //
(2 * y_val - 2 * x_val) / (5 * x_val)};


std::cout << grad.getValue() << std::endl;
std::cout << grad_val << std::endl;
CHECK(grad.getValue().isApprox(grad_val));
CHECK(suboptimal::getValues(grad.getExpr()).isApprox(grad_val));
}
Expand Down
2 changes: 1 addition & 1 deletion test/autodiff/HessianTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#define CATCH_CONFIG_FAST_COMPILE

#include <suboptimal/autodiff/Variable.h>
#include <suboptimal/autodiff/Derivatives.h>
#include <suboptimal/autodiff/Variable.h>

#include <cmath>

Expand Down
2 changes: 1 addition & 1 deletion test/autodiff/JacobianTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

#define CATCH_CONFIG_FAST_COMPILE

#include <suboptimal/autodiff/Variable.h>
#include <suboptimal/autodiff/Derivatives.h>
#include <suboptimal/autodiff/Variable.h>

#include <cmath>
#include <iostream>
Expand Down
2 changes: 1 addition & 1 deletion test/solvers/linear/SimplexFailureTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#include <suboptimal/LinearProblem.h>
#include <suboptimal/solvers/SolverExitStatus.h>
#include <suboptimal/solvers/linear/Simplex.h>
#include <suboptimal/solvers/linear/SimplexPivotRule.h>
#include <suboptimal/solvers/linear/SimplexSolverConfig.h>
#include <suboptimal/solvers/linear/Simplex.h>

#include <limits>

Expand Down
2 changes: 1 addition & 1 deletion test/solvers/linear/SimplexTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

#include <suboptimal/LinearProblem.h>
#include <suboptimal/solvers/SolverExitStatus.h>
#include <suboptimal/solvers/linear/Simplex.h>
#include <suboptimal/solvers/linear/SimplexPivotRule.h>
#include <suboptimal/solvers/linear/SimplexSolverConfig.h>
#include <suboptimal/solvers/linear/Simplex.h>

#include <Eigen/Core>
#include <catch2/catch_test_macros.hpp>
Expand Down

0 comments on commit 1b135f8

Please sign in to comment.