Code accompanying "Control Synthesis with Heterogeneous Structure: Imitation-based Trajectory-feedback Control with Signal Temporal Logic Specifications " by Karen Leung and Marco Pavone
More documentation to come.
The size of our neural network is described below. Note that the image is of size (number of channels)
. In our experiments, there were four channels. The state dimension of our system is
and with control input of size
.
- Summarizing
into a hidden state (
): Our CNN has 2 layers. The first convolution layer applies four 8x8 filters with a stride of 4 and 4 padded zeros per spatial dimension. This is followed by batch normalization, the ReLU nonlinear activation function, and 4x4 max-pooling. The second convolution layer then applies a single 8x8 filter with a stride of 4 and 4 padded zeros per spatial dimension to yield the the final CNN output
. This results in
.
- Initializing LSTM hidden state (
): Two identically-sized three layer MLPs are used, each to project
into each component of the LSTM hidden state which is a 2-tuple of a
dimensional vector. Each MLP if of the form: a linear layer of size
with bias, followed by a
activation, a linear layer
with bias, another
activation, and then another linear layer
.
- LSTM cell (
): An LSTM cell with hidden state size of
.
- Projecting hidden state to control (
): A single linear layer of size
with bias.
We detail the hyperparameters used in your offline training process below.
- We use the Adam optimizer with PyTorch's default parameters and a weight decay = 0.05.
: The number of training epochs used to train the model before applying adversarial training iterations.
: The number of adversarial samples to search for.
: Size of training set. We used a mini-batch size of 8 during our stochastic gradient descent steps.
: The weight on control reconstruction when computing
.
- We use a sigmoidal function
to characterize the annealing schedule various hyperparameters. Let
denote the current training epoch, and
denote the number of iterations for that training round (either
or
). Let
and
denote the smallest and largest value that the annealed hyperparameter can take. For the full training phase where
,
and
:
For the training phase during the adversarial training iterations where ,
and
:
-
-
-
See ctrl_syn/src/learning.py see the neural network architecture.
To train a model, run
python3 run_cnn.py --iter_max 200 --lstm_dim 128 --device cuda --dropout 0.2 --weight_ctrl 0.5 --weight_recon 0.7 --weight_stl -1 --teacher_training -1 --mode adv_training_iteration_rapid --type coverage --stl_scale -1 --status new --stl_max 0.5 --stl_min 0.1 --scale_min 0.1 --scale_max 50.0 --trainset_size 128 --evalset_size 32 --number 0 --action create --adv_iter_max 100 --run 0 --expert_mini_bs 4