Research Data Accompanying the Publication: "Quantum Computing and Tensor Networks for Laminate Design: A Novel Approach to Stacking Sequence Retrieval"
===========================================================
**Authors:** Arne Wulff¹, Boyang Chen¹, Matthew Steinberg², Yinglu Tang¹, Matthias Möller², Sebastian Feld²
¹*Faculty of Aerospace Engineering, Delft University of Technology, The Netherlands*
²*Faculty of Electrical Engineering, Mathematics and Computer Science, Delft University of Technology, The Netherlands*
This repository contains generated data files of the DMRG experiments with 200 plies in our paper:
[A. Wulff *et al.*: Comput. Methods Appl. Mech. Eng. 432 (2024) 117380,
doi: 10.1016/j.cma.2024.117380](https://doi.org/10.1016/j.cma.2024.117380)
Please use the following citation:
```
@article{Wulff2024,
title = {Quantum computing and tensor networks for laminate design: A novel approach to stacking sequence retrieval},
journal = {Computer Methods in Applied Mechanics and Engineering},
volume = {432},
pages = {117380},
year = {2024},
issn = {00457825},
doi = {10.1016/j.cma.2024.117380},
url = {https://www.sciencedirect.com/science/article/pii/S0045782524006352},
author = {Arne Wulff and Boyang Chen and Matthew Steinberg and Yinglu Tang and Matthias M{\"o}ller and Sebastian Feld},
}
```
**Abstract:**
> As with many tasks in engineering, structural design frequently involves navigating complex and computationally expensive problems. A prime example is the weight optimization of laminated composite materials, which to this day remains a formidable task, due to an exponentially large configuration space and nonlinear constraints. The rapidly developing field of quantum computation may offer novel approaches for addressing these intricate problems. However, before applying any quantum algorithm to a given problem, it must be translated into a form that is compatible with the underlying operations on a quantum computer. Our work specifically targets stacking sequence retrieval with lamination parameters, which is typically the second phase in a common bilevel optimization procedure for minimizing the weight of composite structures. To adapt stacking sequence retrieval for quantum computational methods, we map the possible stacking sequences onto a quantum state space. We further derive a linear operator, the Hamiltonian, within this state space that encapsulates the loss function inherent to the stacking sequence retrieval problem. Additionally, we demonstrate the incorporation of manufacturing constraints on stacking sequences as penalty terms in the Hamiltonian. This quantum representation is suitable for a variety of classical and quantum algorithms for finding the ground state of a quantum Hamiltonian. For a practical demonstration, we performed numerical statevector simulations of two variational quantum algorithms and additionally chose a classical tensor network algorithm, the DMRG algorithm, to numerically validate our approach. For the DMRG algorithm, we derived a matrix product operator representation of the loss function Hamiltonian and the penalty terms. Although this work primarily concentrates on quantum computation, the application of tensor network algorithms presents a novel quantuminspired approach for stacking sequence retrieval.
Contact: Boyang Chen, Arne Wulff
https://www.tudelft.nl/lr/qaims
**Disclaimer:** This repository contains experimental software and is published for the sole purpose of giving additional background details on the respective publication.
**License:**
This work is licensed under a [Creative Commons Attribution 4.0 International License][ccby].
[![CC BY 4.0][ccbyimage]][ccby]
[ccby]: http://creativecommons.org/licenses/by/4.0/
[ccbyimage]: https://i.creativecommons.org/l/by/4.0/88x31.png
[ccbyshield]: https://img.shields.io/badge/LicenseCC%20BY%204.0lightgrey.svg

# Explanation of this data repository
This repository contains the results from running DMRG with 200 plies. Here, we give a short description of how this dataset is structured. For further details, see the paper.
## File `generated_lamination_parameters.zip`
To test our approach, we generated a set of 100 target lamination parameters. This ZIP file contains all HDF5 file, that where generated during this process. It includes the following files:
 **`sample_lp_disor_constr_batch_00XX.hdf5` with `XX = 00,01,02,...,49`:**
We generated 500000 random stacking sequences and calculated the according lamination parameters. The data was saved in batches of 10000 stacking sequences.
File structure:
```
🗂️ HDF5.File:
├─ 📂 properties
│ ├─ 🏷️ batch_num : batch index
│ ├─ 🏷️ batch_size : batch size
│ ├─ 🏷️ disorientation_constraint_distance
  angle distance for disorientation constraint
│ ├─ 🏷️ num_angles : number of possible ply angles
│ ├─ 🏷️ num_plies : number of plies
│ ├─ 🔢 angles : possible ply angles
│ └─ 🔢 disorientation_constraint_vecs
 table for constraint violations of ply angles

└─ 📂 sample
├─ 🔢 lamination_parameters
  lamination parameters of the generated
  stacking sequences
│ ├─ 🏷️ cols = "lp"
│ └─ 🏷️ rows = "sample_number"
└─ 🔢 stacking_sequence : generated stacking sequences
├─ 🏷️ cols = "stack"
└─ 🏷️ rows = "sample_number"
```
 **`sample_lp_disor_constr_kernelsums_batch_00XX.hdf5` with `XX = 00,01,02,...,49`:**
The point desity in lamination parameter space was estimated at each point in the set of lamination parameters using a kernel density estimator. These files were generated during this process.
File structure:
```
🗂️ HDF5.File:
├─ 📂 data
│ ├─ 🔢 batch_is_calculated : 1 if the batch is processed, 0 else
│ │ └─ 🏷️ rows = "sample_number"
│ ├─ 🔢 kernels
  resulting kernels: sum of the kernel sums, divided by the
  number of points
│ ├─ 🔢 kernels_batches
  which batches are included in the kernels. 1 if the
  batch is included, 0 else
│ ├─ 🔢 kernelsums
   contributions of each batch to the point density at each
   point, according to the KDE
│ │ ├─ 🏷️ cols = "sample_number"
│ │ ├─ 🏷️ h : variance used in the kernel
│ │ └─ 🏷️ rows = "kernel_sums"
│ └─ 🔢 weights : resulting weights for sampling (inverse point density)

└─ 📂 properties : are the same as before
├─ 🏷️ batch_num : batch index
├─ 🏷️ batch_size : batch size
├─ 🏷️ disorientation_constraint_distance
 angle distance for disorientation constraint
├─ 🏷️ num_angles : number of possible ply angles
├─ 🏷️ num_plies : number of plies
├─ 🔢 angles : possible ply angles
└─ 🔢 disorientation_constraint_vecs
table for constraint violations of ply angles
```
 **`sample_lp_disor_constr_full_weighted_sample.hdf5`:**
This file collects all 500000 stacking sequences, with the according lamination parameters and weights. This file can be used to generate small samples of lamination parameters that follow a quasiuniform distribution
File structure:
```
🗂️ HDF5.File:
├─ 📂 properties
│ ├─ 🏷️ batch_num = 0 (unused, from copying properties from previous files)
│ ├─ 🏷️ batch_size : size of a single batch (irrelevant)
│ ├─ 🏷️ disorientation_constraint_distance : angle distance of disorientation constraint
│ ├─ 🏷️ kernel_h : variance in KDE
│ ├─ 🏷️ num_angles : number of possible ply angles
│ ├─ 🏷️ num_plies : number of plies
│ ├─ 🔢 angles : possible ply angles
│ └─ 🔢 disorientation_constraint_vecs : table for constriant violations for angle pairs

└─ 📂 sample : all lamination parameters with stacking sequences and weights for sampling
├─ 🔢 lamination_parameters
├─ 🔢 stacking_sequence
└─ 🔢 weights
```
 **`lp_sample_100.hdf5`:**
Sample of 100 target lamination parameters, randomly chosen from `sample_lp_disor_constr_full_weighted_sample.hdf5` according to the weights. We used the first 50 of these in our DMRG experiments.
File structure:
```
🗂️ HDF5.File:
├─ 📂 properties
│ ├─ 🏷️ batch_num = 0 (unused, from copying properties from previous files)
│ ├─ 🏷️ batch_size : size of a single batch (irrelevant)
│ ├─ 🏷️ disorientation_constraint_distance : angle distance of disorientation constraint
│ ├─ 🏷️ kernel_h : variance in KDE
│ ├─ 🏷️ num_angles : number of possible ply angles
│ ├─ 🏷️ num_plies : number of plies
│ ├─ 🔢 angles : possible ply angles
│ └─ 🔢 disorientation_constraint_vecs : table for constriant violations for angle pairs

└─ 📂 sample : sample of 100 lamination parameters
├─ 🔢 idx_list : indices from sample_lp_disor_constr_full_weighted_sample.hdf5
├─ 🔢 lamination_parameters : chosen lamination parameters
└─ 🔢 stacking_sequence : chosen stacking sequences
```
## File `data_from_dmrg.zip`
This file contains all the generated data from the DMRG experiments.
**Disclaimer:** Due to a mistake in the code, the constraint violations for the resulting stacking sequences were not saved. The datasets `results/constraint_violations` only have entries `0`, even if constraint violations exist in the stack. We checked for constraint violations in `plotting.ipynb`.
The directories in this file are in the following structure:
`data_from_dmrg\{1}_constraint\num_sweeps_{2}\max_bond_dim_{3}\sweep_{4}\`
where
 `{1}` is replaced by `with` or `without`, depending on whether the disorientation constraint was enforced
 `{2}` is replaced by the total number of sweeps of the DMRG optimization
 `{3}` is replaced by the maximum bond dimension
 `{4}` is replaced by `L` for only leftward sweeps, `R` for only rightward sweeps, and `LR` for alternating sweeping directions
The files in the folder follow the naming convention `constant_bondsize_sample_00XX.hdf5`, where `XX=00,01,...,49` according to the row number in `lp_sample_100.hdf5` of the specific target lamination parameters in this trial.
The structure of the HDF5 files:
```
🗂️ HDF5.File:
├─ 📂 properties : Settings for the experiment
│ ├─ 🏷️ disorientation_constraint
  1 or 0, whether the constraint is enforced
│ ├─ 🏷️ disorientation_constraint_distance
  angle distance for constraint in degrees
│ ├─ 🏷️ disorientation_constraint_strength
  strength of penalty for constraint
│ ├─ 🏷️ maxdim
  maximum bond dimension for whole run
│ ├─ 🏷️ num_angles
  number of possible angles
│ ├─ 🏷️ num_plies
  number of plies in the stack
│ ├─ 🏷️ num_sweeps
  number of sweeps in one run of the optimization
│ ├─ 🏷️ num_tries
  number of trials with the same setting,
  except for different initial MPS
│ ├─ 🏷️ sample_idx
  sample index, corresponds to index of target
  lamination parameters
│ ├─ 🏷️ sweep_sequence
  used sweep sequence in the optimization
│ ├─ 🔢 angles
  possible ply angles in degrees
│ ├─ 🔢 disorientation_constraint_matrix
  BitMatrix for constraint violations of pairs of angles
│ ├─ 📂 sweeps : setting of the `Sweep` object
│ │ ├─ 🔢 cutoff
│ │ └─ 🔢 maxdim
│ ├─ 🔢 target_parameters
  the target lamination parameters
│ └─ 🔢 target_stack
 a stacking sequence producing the lamination parameters

├─ 📂 data : store data from experiments
│ ├─ 🔢 elapsed_time_sweeps
  elapsed duration of each sweep
│ ├─ 🔢 energies
  energy expectation value measured after each sweep
│ ├─ 🔢 maxlinkdim
  setting of maximum bond dimension for each sweep
│ ├─ 🔢 time_stamps : time stamps after each sweep
 └─ 📂 psi_samples
  every couple of sweeps, the current MPS is sampled.
  This provides a cross section of the superposition of the MPS
  without the need to store the complete MPS, which can be quite large
│ ├─ 📂 try_1
│ │ ├─ 🔢 sweep_10
│ │ ├─ 🔢 sweep_20
│ │ ⋮
 
│ ├─ 📂 try_2
│ ├─ 📂 try_3
│ ⋮

├─ 📂 results
 ├─ (🔢 constraint_violations
  sum of constraint violations
  ❗ due to an error, constraint violations were not counted and saved
  ❗ in the HDF5 files)
 ├─ 🔢 lamination_parameters
  resulting lamination parameters
 ├─ 🔢 loss
  resulting loss (mean square error) to the target parameters
 ├─ 🔢 rmse
  resulting rmse to the target parameters
 ├─ 🔢 stack
  resulting stacking sequence
 └─ 📂 psi
 resulting MPS, compatible with ITensors way of
 storing and loading an MPS
 ├─ 📂 try_1
 ├─ 📂 try_2
 ⋮

└─ 📂 psi0 : initial MPS, compatible with storing and loading
 an MPS in ITensors
├─ 📂 try_1
├─ 📂 try_2
⋮
```
## Files `plotting.ipynb` and `plotting.html`
IPython Jupyter notebook that was used to generate figures for the paper, together with an HTML copy for easier viewing. For the figures in the paper, the fonts, colors and layouts were adjusted afterwards.
## File `README.md`
This readme file.
