Skip to content

Instantly share code, notes, and snippets.

@mayataka
mayataka / optuna_mpc.py
Last active January 23, 2022 05:57
Parameter tuning of MPC via Optuna
from casadi import *
import math
import numpy as np
import optuna
class CartPole:
def __init__(self):
self.mc = 2.0 # cart の質量[kg]
self.mp = 0.2 # pole の質量[kg]
@mayataka
mayataka / introduction_to_numerical_optimal_control.ipynb
Last active April 25, 2025 01:47
数値最適制御入門の入門
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mayataka
mayataka / set-my-ubuntu.sh
Last active June 6, 2025 06:49
Set Ubuntu 22.04
gsettings set org.gnome.desktop.input-sources xkb-options "['ctrl:nocaps']"
sudo apt update -y
sudo apt upgrade -y
sudo apt autoremove -y
sudo apt install build-essential cmake git libeigen3-dev vim tmux doxygen graphviz ffmpeg libglpk-dev -y
sudo apt install python3-sphinx -y
# install docker
sudo apt install lsb-release -y
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
@mayataka
mayataka / casadi_milp.py
Last active August 5, 2022 13:58
A very simple MILP via CasADi
from casadi import *
import numpy as np
# optimization variables
x1 = SX.sym('x1')
x2 = SX.sym('x2')
w = [x1, x2]
w0 = [0, 0]
lbw = [-np.inf, -np.inf]