Andrea Favillia,b, Francesco Lacconea, Paolo Cignonia, Luigi Malomoa, Daniela Giorgia
aInstitute of Information Science and Technologies "A. Faedo" (ISTI), National Research Council of Italy (CNR)
bUniversity of Pisa (Italy)
Paper: TBA
BibTeX: TBA
Website: TBA
This code has been tested on Windows® 11 Pro and Ubuntu 24.04. The hardware setup is based on a Intel i9-14900KF CPU, 64 GB of RAM, NVIDIA GeForce RTX 4080 Super GPU with 16 GB of dedicated memory. The code runs on Python 3.11.5 with PyTorch 2.5.0 (2.4.1 for Ubuntu), CUDA 12.4 (12.1 for Ubuntu), PyTorch Geometric, GurobiPy 11.0.3. The use of CUDA is recommended to have results in reasonable computation time.
Gurobi Optimizer®, a platform for optimization and decision-making, is employed to solve Integer Linear Programming (ILP) instances inside the algorithm. A licence of Gurobi Optimizer®, free for academic purposes, is therefore needed. Once the user has got the licence, the corresponding .lic file has to be put in the home directory when installing software dependencies.
Some of the implemented GPU-accelerated computations require the installation of the CUDA Toolkit (link Win, link Ubuntu). Please, check the correspondance of the installed CUDA Toolkit version with the version of the pytorch-cuda
package (12.4, Windows®, or 12.1, Ubuntu, for both, in the case of the preconfigured environments we provide).
We employed Anaconda, a popular Python distribution for data science and machine learning. After that Anaconda is installed, we can use an Anaconda shell to create virtual environments and run the code. From an Anaconda prompt, we move to the repository root directory and enter the command
conda env create --file environment_<win,ubu>.yml
to create an envirorment named ReclaimedGridShells
that contains all the needed dependencies. We can then activate ReclaimedGridShells
by typing
conda activate ReclaimedGridShells
To ensure that CUDA Toolkit works correctly, check for latest NVIDIA card driver update.
The replication of the paper figures requires the execution of compiled C++ code contained in the cpp
folder. The user can decide to build the executables via cpp\CMakeLists.txt
or to download pre-compiled binaries here (...).
We present three use scenarios of this software, giving each time a figure from the orginal paper as application example. The given output folder will contain the 3D models for both inputs and outputs, together with the images with the same visualization style of the paper and some csv files containing quantitative results.
This task solves the optimization of an input gridshell shape, provided as a .ply
file with fixed mesh topology, both in terms of static compliance reduction and reuse waste from a given stock of beam elements. The user can choose between one of the pre-configured
stocks uniform
, nonuniform1
, nonuniform2
.
More specifically, the command
python single_task_exec.py --device "cuda" --meshpath "meshes/Dolphin.ply" -niter 10000 --lr 5e-6 --saveinterval 100 --times --stock "uniform" --curves --hists --structhist --rendermodels --render --renderw --jpg
performs single case computation of the shape Dolphin.ply
and reproduces the images of Fig. 11. In the output\Dolphin_stock_uniform
subfolder, the user can find the input and output gridshell (files Dolphin_start.jpg
and Dolphin_end.jpg
, respectively), the color-coded wireframes showing the initial and final beam assignment (files Dolphin_batch_colors_start.jpg
and Dolphin_batch_colors_end.jpg
), the mesh in false colors representing the initial and final Service Load displacements (files Dolphin_deflections_start.jpg
, Dolphin_deflections_end.jpg
, with the respective histograms hist_deflections_Dolphin.pdf
, hist_deflections_end_Dolphin.pdf
), the wireframe representing the initial and final beam strain energy (files Dolphin_energy_start.jpg
, Dolphin_energy_end.jpg
, with the respective histograms hist_energy_Dolphin.pdf
, hist_energy_end_Dolphin.pdf
), the frequency histogram of the initial and final beam lengths (file Dolphin_lengths.pdf
), the final inventory assignment histogram (file Dolphin_stock_uniform_matches.pdf
), and the csv data for waste and new material descent curves (files wastages.csv
and new_material.csv
).
This task solves the optimization of an input gridshell shape, provided as a .ply
file with fixed mesh topology, both in terms of static compliance reduction and reuse waste with respect to three different inventories of beam elements (uniform
, nonuniform1
, and nonuniform2
).
More specifically, the command
python multistock_task_exec.py --device "cuda" --meshpath "meshes/Blob.ply" -niter 10000 --lr 5e-6 --saveinterval 100 --times --curves --hists --structhist --rendermodels --render --renderw --jpg
performs multi-stock computation of the shape Blob.ply
and reproduces the images of Fig. 14. For brevity, let's consider only the case of the stock nonuniform1
: in the output\Blob_stock_nonuniform1
subfolder, the user can find the input and output gridshell (files Blob_start.jpg
and Blob_end.jpg
, respectively), the color-coded wireframes showing the initial and final beam assignment (files Blob_batch_colors_start.jpg
and Blob_batch_colors_end.jpg
), and the inventory assignment histograms for both input and output (files Dolphin_stock_uniform_matches.pdf
and Dolphin_stock_uniform_matches.pdf
).
This task at first computes different remeshings of a given target shape (provided as a .ply
) with different average edge lengths, and then computes the optimization for each mesh both in terms of static compliance reduction and reuse waste from a given stock of beam elements.
More specifically, the command
python multimesh_task_exec.py --device "cuda" --meshpath "meshes/Blob.ply" -niter 10000 --lr 5e-6 --saveinterval 100 --times --stock "uniform" --curves --hists --structhist --rendermodels --render --renderw --jpg
performs multi-meshing computation of the shape Blob.ply
, with respect the stock uniform
, and reproduces the images of Fig. 16. For brevity, let's consider only the case of the average length 1.90: in the output\Blob_1.90_stock_uniform
subfolder, the user can find the output gridshell (file Blob_1.90_end.jpg
), the histogram of the initial and final beam assignment (file Blob_1.90_start_end_matches.pdf
), evolutionary curves for matching_percentages, waste and new material (files matching_percentages.pdf
, wastages.pdf
, and new_material.pdf
), the mesh in false colors representing the initial and final Service Load displacements (files Blob_1.90_deflections_start.jpg
, Blob_1.90_deflections_end.jpg
, with the respective histograms hist_deflections_Blob_1.90.pdf
, hist_deflections_end_Blob_1.90.pdf
), the wireframe representing the initial and final beam strain energy (files Blob_1.90_energy_start.jpg
, Blob_1.90_energy_end.jpg
, with the respective histograms hist_energy_Blob_1.90.pdf
, hist_energy_end_Blob_1.90.pdf
). The file scatter_alt.pdf
of the parent directory contains the scatter plot of Fig. 15.
Deterministic behavior of PyTorch CUDA is not guaranteed: output of linear algebra operation may slightly differ from a machine to another (source). However, by flagging --reproducible
we can offer a full replicable implementation of our algorithm at the cost of slower computation time.