Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
W_DELTA_SIGMA = 1e-1 # difference in flight time
W_NU = 1e5 # virtual control

print(cvxpy.installed_solvers())
solver = 'ECOS'
verbose_solver = False

Expand Down Expand Up @@ -462,11 +463,11 @@ def __init__(self, m, K):
# x_t+1 = A_*x_t+B_*U_t+C_*U_T+1*S_*sigma+zbar+nu
constraints += [
self.var['X'][:, k + 1] ==
cvxpy.reshape(self.par['A_bar'][:, k], (m.n_x, m.n_x)) @
cvxpy.reshape(self.par['A_bar'][:, k], (m.n_x, m.n_x), order='F') @
self.var['X'][:, k] +
cvxpy.reshape(self.par['B_bar'][:, k], (m.n_x, m.n_u)) @
cvxpy.reshape(self.par['B_bar'][:, k], (m.n_x, m.n_u), order='F') @
self.var['U'][:, k] +
cvxpy.reshape(self.par['C_bar'][:, k], (m.n_x, m.n_u)) @
cvxpy.reshape(self.par['C_bar'][:, k], (m.n_x, m.n_u), order='F') @
self.var['U'][:, k + 1] +
self.par['S_bar'][:, k] * self.var['sigma'] +
self.par['z_bar'][:, k] +
Expand Down Expand Up @@ -536,7 +537,7 @@ def solve(self, **kwargs):
with warnings.catch_warnings(): # For User warning from solver
warnings.simplefilter('ignore')
self.prob.solve(verbose=verbose_solver,
solver=solver)
solver=solver)
except cvxpy.SolverError:
error = True

Expand Down
2 changes: 1 addition & 1 deletion InvertedPendulum/inverted_pendulum_mpc_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def mpc_control(x0):
prob = cvxpy.Problem(cvxpy.Minimize(cost), constr)

start = time.time()
prob.solve(verbose=False)
prob.solve(verbose=False, solver=cvxpy.CLARABEL)
elapsed_time = time.time() - start
print(f"calc time:{elapsed_time:.6f} [sec]")

Expand Down
3 changes: 2 additions & 1 deletion requirements/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
numpy == 2.2.4
scipy == 1.15.2
matplotlib == 3.10.1
cvxpy == 1.5.3
cvxpy == 1.6.5
ecos == 2.0.14
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be removed by #1207

pytest == 8.3.5 # For unit test
pytest-xdist == 3.6.1 # For unit test
mypy == 1.15.0 # For unit test
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@


def run_this_test(file):
pytest.main([os.path.abspath(file)])
pytest.main(args=["-W", "error", "-Werror", "--pythonwarnings=error", os.path.abspath(file)])