Code for Reinforcement learning for inverse structural design and rapid laser cutting of kirigami prototypes. RL-Kirigami performs inverse design for compact reconfigurable parallelogram quad kirigami: an OT-CFM generator proposes ratio fields conditioned on a target deployed silhouette, and GRPO aligns the generator to non-differentiable rewards (silhouette match, feasibility, ratio-field regularity). Decoded layouts can be exported as DXF for laser cutting.
pip install -e . # optional: installs the CLI wrappers declared in pyproject.tomlThe three entry points below can also be invoked directly as python <script>.py.
python -m data_generator.generator --config configs/data_generator.yamlOutputs:
data_generator/kirigami_x_dataset.pkl- dataset pickledata_generator/preview.png- sample griddata_generator/gifs/- per-sample deployment animations
A prebuilt 5000 / 500 / 500 split is available on Google Drive. If the pickle is not at the default path, set data.pickle_path in configs/training.yaml.
python fm_training.py --config_path configs/training.yaml --resume lastOutputs:
checkpoints/<run_name>/- checkpointscheckpoints/tb/- TensorBoard logs
Use --resume last to continue from the most recent checkpoint, or omit it to start fresh.
python rl_training.py --config_path configs/training.yaml --init_from last --resume last--init_from last loads the latest OT-CFM checkpoint as the starting policy. RL checkpoints are written to checkpoints/<run_name>_RL/.
| File / block | What it controls |
|---|---|
configs/data_generator.yaml |
grid size, mask resolution, split sizes, x range, sampler, seed |
configs/training.yaml -> model_config |
backbone and tensor shapes |
configs/training.yaml -> data |
dataset and generator references |
configs/training.yaml -> training |
shared training settings (optimizer, batches, epochs) |
configs/training.yaml -> rl_training |
GRPO-only overrides (group size, reward weights, temperature) |
Keep the two YAML files consistent: training.yaml reads grid_rows, grid_cols, x_min, x_max, and the mask size from data_generator.yaml.
If you use this code, please cite:
@misc{yazdani2026rlkirigami,
title={Reinforcement learning for inverse structural design and rapid laser cutting of kirigami prototypes},
author={Yazdani, Milad and Shalileh, Shahriar and Shahriari, Dena},
year={2026},
eprint={2605.08098},
archivePrefix={arXiv},
primaryClass={cs.LG},
doi={10.48550/arXiv.2605.08098},
url={https://arxiv.org/abs/2605.08098}
}