From e47360919f8511cc2797daa9a595ba026f57d849 Mon Sep 17 00:00:00 2001 From: Chris McComb Date: Sat, 6 Jan 2024 12:18:19 -0500 Subject: [PATCH] Created using Colaboratory --- examples/optimizing_for_mass.ipynb | 457 +++++++++++++++++++++++++++++ 1 file changed, 457 insertions(+) create mode 100644 examples/optimizing_for_mass.ipynb diff --git a/examples/optimizing_for_mass.ipynb b/examples/optimizing_for_mass.ipynb new file mode 100644 index 0000000..ce8be9f --- /dev/null +++ b/examples/optimizing_for_mass.ipynb @@ -0,0 +1,457 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "metadata": { + "id": "view-in-github", + "colab_type": "text" + }, + "source": [ + "\"Open" + ] + }, + { + "cell_type": "markdown", + "source": [ + "# Install TrussMe" + ], + "metadata": { + "id": "d4JweabFv5bI" + } + }, + { + "cell_type": "code", + "execution_count": 1, + "metadata": { + "colab": { + "base_uri": "https://localhost:8080/" + }, + "id": "lIYdn1woOS1n", + "outputId": "bc13a49f-39ba-471f-9519-0fca95ba430d" + }, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + " Preparing metadata (setup.py) ... \u001b[?25l\u001b[?25hdone\n", + " Building wheel for trussme (setup.py) ... \u001b[?25l\u001b[?25hdone\n" + ] + } + ], + "source": [ + "!pip install git+https://github.com/cmccomb/trussme.git -qqq" + ] + }, + { + "cell_type": "markdown", + "source": [ + "# Set up functions for optimization" + ], + "metadata": { + "id": "XXEb3-8Zv8hC" + } + }, + { + "cell_type": "code", + "source": [ + "import trussme\n", + "import scipy.optimize\n", + "import numpy" + ], + "metadata": { + "id": "wSB4taeLfbYt" + }, + "execution_count": 2, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "This is a helper function that support the translation between a vector of optimization parameters and the truss itself. We are enforcing symmetry and only optimizing the location of movable joints." + ], + "metadata": { + "id": "-42VVeJkv-k-" + } + }, + { + "cell_type": "code", + "source": [ + "def make_truss(x: list[float]) -> trussme.Truss:\n", + " # Build truss from scratch\n", + " truss_from_commands = trussme.Truss()\n", + " truss_from_commands.add_pinned_joint([-2.5, 0.0, 0.0])\n", + " truss_from_commands.add_free_joint([x[0], x[1], 0.0])\n", + " truss_from_commands.add_free_joint([x[2], x[3], 0.0])\n", + " truss_from_commands.add_free_joint([-x[2], x[3], 0.0])\n", + " truss_from_commands.add_free_joint([-x[0], x[1], 0.0])\n", + " truss_from_commands.add_pinned_joint([2.5, 0.0, 0.0])\n", + "\n", + " truss_from_commands.add_free_joint([x[4], x[5], 0.0])\n", + " truss_from_commands.add_free_joint([x[6], x[7], 0.0])\n", + " truss_from_commands.add_free_joint([0.0, 1.0, 0.0])\n", + " truss_from_commands.add_free_joint([-x[6], x[7], 0.0])\n", + " truss_from_commands.add_free_joint([-x[4], x[5], 0.0])\n", + "\n", + " truss_from_commands.add_out_of_plane_support(\"z\")\n", + "\n", + " truss_from_commands.joints[8].loads[1] = -50000\n", + "\n", + " truss_from_commands.add_member(0, 1)\n", + " truss_from_commands.add_member(1, 2)\n", + " truss_from_commands.add_member(2, 3)\n", + " truss_from_commands.add_member(3, 4)\n", + " truss_from_commands.add_member(4, 5)\n", + "\n", + " truss_from_commands.add_member(6, 7)\n", + " truss_from_commands.add_member(7, 8)\n", + " truss_from_commands.add_member(8, 9)\n", + " truss_from_commands.add_member(9, 10)\n", + "\n", + " truss_from_commands.add_member(0, 6)\n", + " truss_from_commands.add_member(6, 1)\n", + " truss_from_commands.add_member(1, 7)\n", + " truss_from_commands.add_member(7, 2)\n", + " truss_from_commands.add_member(2, 8)\n", + " truss_from_commands.add_member(8, 3)\n", + " truss_from_commands.add_member(3, 9)\n", + " truss_from_commands.add_member(9, 4)\n", + " truss_from_commands.add_member(4, 10)\n", + " truss_from_commands.add_member(10, 5)\n", + "\n", + " return truss_from_commands" + ], + "metadata": { + "id": "CItMgcAUfcWs" + }, + "execution_count": 3, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "Next, we create an objective for mass, two helper functions for constraints (FOS, deflection in cm) and a callback." + ], + "metadata": { + "id": "sdGKyMRhwJWJ" + } + }, + { + "cell_type": "code", + "source": [ + "def mass_objective(x: list[float]) -> float:\n", + " return make_truss(x).mass" + ], + "metadata": { + "id": "yBoTNKg9gp9v" + }, + "execution_count": 4, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "def fos_constraint(x: list[float]) -> float:\n", + " truss = make_truss(x)\n", + " truss.analyze()\n", + " return truss.fos" + ], + "metadata": { + "id": "Yms0mCvwhanc" + }, + "execution_count": 5, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "def deflection_constraint(x: list[float]) -> float:\n", + " truss = make_truss(x)\n", + " truss.analyze()\n", + " return truss.deflection*100" + ], + "metadata": { + "id": "Y9gp6DPGkZUx" + }, + "execution_count": 6, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "def callback(intermediate_result: scipy.optimize.OptimizeResult):\n", + " truss = make_truss(intermediate_result.x)\n", + " truss.analyze()\n", + " print(\n", + " \"mass = {:.2f} kg; \".format(truss.mass),\n", + " \"FOS = {:.2f} kg; \".format(truss.fos),\n", + " \"deflection = {:.2f} cm; \".format(truss.deflection*100)\n", + " )" + ], + "metadata": { + "id": "vdD4Abt1nfuh" + }, + "execution_count": 7, + "outputs": [] + }, + { + "cell_type": "markdown", + "source": [ + "# Examine an intial truss design" + ], + "metadata": { + "id": "BgnTYvGTwTI9" + } + }, + { + "cell_type": "code", + "source": [ + "x0 = [-1.5, 0.0, -0.5, 0.0, -2.0, 1.0, -1.0, 1.0]" + ], + "metadata": { + "id": "TeEV3XoEfgnI" + }, + "execution_count": 8, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "initial_truss = make_truss(x0)\n", + "initial_truss.analyze()\n", + "print(\n", + " \"mass = {:.2f} kg; \".format(initial_truss.mass),\n", + " \"FOS = {:.2f}; \".format(initial_truss.fos),\n", + " \"deflection = {:.2f} cm; \".format(initial_truss.deflection*100)\n", + ")\n", + "trussme.visualize.plot_truss(initial_truss, starting_shape=\"force\");" + ], + "metadata": { + "id": "9B8YYWmtgod7", + "outputId": "2c2eca5a-616f-4be9-fc69-40dfc78150e7", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 423 + } + }, + "execution_count": 9, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "mass = 37.58 kg; FOS = 1.19; deflection = 0.70 cm; \n" + ] + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "
" + ], + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgMAAAGFCAYAAABg2vAPAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAXO0lEQVR4nO3dTazld33f8e+9dx58PYMzgGOb2mDsJEiJg4yQSBywm1bCSMYBY5NFlC66SBWpi0iRIkWJuiGquum6aqW2my6yaIUGI8Uw4NCKh8a0uImLa7sahDAY44yg9UOYxzt3ThfDt/N0H87D/5z////7vl7b2Xz1173nfuZ9ztVdm0wmkwAAylrv+wAAoF/GAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQHHGAAAUZwwAQ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ccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABRnDABAccYAABT3/wDegA84qKOarAAAAABJRU5ErkJggg==\n" + }, + "metadata": {} + } + ] + }, + { + "cell_type": "markdown", + "source": [ + "# Optimize the truss and examine results" + ], + "metadata": { + "id": "NA58IYC5wxGV" + } + }, + { + "cell_type": "markdown", + "source": [ + "We'll make two more specific constraints using our earlier helper functions. Specifically, we'll constraint the FOS to be greater than 1.0, and the deflection to be less than 1.0cm." + ], + "metadata": { + "id": "C95vlWj5w6PC" + } + }, + { + "cell_type": "code", + "source": [ + "fos_greater_than_1 = scipy.optimize.NonlinearConstraint(fos_constraint, 1.0, numpy.inf)\n", + "deflection_less_than_1cm = scipy.optimize.NonlinearConstraint(deflection_constraint, 0.0, 1.0)" + ], + "metadata": { + "id": "_ix6ERJCw5gU" + }, + "execution_count": 10, + "outputs": [] + }, + { + "cell_type": "code", + "source": [ + "result = scipy.optimize.minimize(\n", + " mass_objective,\n", + " x0,\n", + " method='trust-constr',\n", + " constraints=[\n", + " fos_greater_than_1,\n", + " deflection_less_than_1cm\n", + " ],\n", + " callback=callback,\n", + " options={\"maxiter\": 50},\n", + "\n", + ")" + ], + "metadata": { + "id": "do_1s7mwgkVD", + "outputId": "3722e6f1-d530-4e29-df6c-badab247c641", + "colab": { + "base_uri": "https://localhost:8080/" + } + }, + "execution_count": 11, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "mass = 37.58 kg; FOS = 1.19 kg; deflection = 0.70 cm; \n", + "mass = 33.10 kg; FOS = 1.42 kg; deflection = 0.57 cm; \n", + "mass = 29.81 kg; FOS = 1.26 kg; deflection = 0.54 cm; \n", + "mass = 29.81 kg; FOS = 1.26 kg; deflection = 0.54 cm; \n", + "mass = 26.60 kg; FOS = 0.63 kg; deflection = 2.15 cm; \n", + "mass = 26.22 kg; FOS = 1.47 kg; deflection = 0.53 cm; \n", + "mass = 26.22 kg; FOS = 1.47 kg; deflection = 0.53 cm; \n", + "mass = 25.82 kg; FOS = 1.11 kg; deflection = 0.54 cm; \n", + "mass = 25.82 kg; FOS = 1.11 kg; deflection = 0.54 cm; \n", + "mass = 25.62 kg; FOS = 1.16 kg; deflection = 0.72 cm; \n", + "mass = 25.16 kg; FOS = 1.26 kg; deflection = 0.54 cm; \n", + "mass = 25.16 kg; FOS = 1.26 kg; deflection = 0.54 cm; \n", + "mass = 24.74 kg; FOS = 0.88 kg; deflection = 0.59 cm; \n", + "mass = 24.74 kg; FOS = 0.88 kg; deflection = 0.59 cm; \n", + "mass = 24.74 kg; FOS = 0.88 kg; deflection = 0.59 cm; \n", + "mass = 24.68 kg; FOS = 1.19 kg; deflection = 0.57 cm; \n", + "mass = 24.68 kg; FOS = 1.19 kg; deflection = 0.57 cm; \n", + "mass = 24.68 kg; FOS = 1.19 kg; deflection = 0.57 cm; \n", + "mass = 24.68 kg; FOS = 1.19 kg; deflection = 0.57 cm; \n", + "mass = 24.67 kg; FOS = 1.19 kg; deflection = 0.56 cm; \n", + "mass = 24.67 kg; FOS = 1.19 kg; deflection = 0.56 cm; \n", + "mass = 24.66 kg; FOS = 1.19 kg; deflection = 0.56 cm; \n", + "mass = 24.66 kg; FOS = 1.19 kg; deflection = 0.56 cm; \n", + "mass = 24.65 kg; FOS = 1.19 kg; deflection = 0.55 cm; \n", + "mass = 24.65 kg; FOS = 1.19 kg; deflection = 0.55 cm; \n", + "mass = 24.65 kg; FOS = 1.19 kg; deflection = 0.55 cm; \n", + "mass = 24.65 kg; FOS = 1.19 kg; deflection = 0.55 cm; \n", + "mass = 24.64 kg; FOS = 1.18 kg; deflection = 0.54 cm; \n", + "mass = 24.64 kg; FOS = 1.18 kg; deflection = 0.54 cm; \n", + "mass = 24.64 kg; FOS = 1.18 kg; deflection = 0.54 cm; \n", + "mass = 24.64 kg; FOS = 1.18 kg; deflection = 0.54 cm; \n", + "mass = 24.63 kg; FOS = 1.18 kg; deflection = 0.53 cm; \n", + "mass = 24.63 kg; FOS = 1.18 kg; deflection = 0.53 cm; \n", + "mass = 24.62 kg; FOS = 1.18 kg; deflection = 0.52 cm; \n", + "mass = 24.62 kg; FOS = 1.18 kg; deflection = 0.52 cm; \n", + "mass = 24.62 kg; FOS = 1.17 kg; deflection = 0.51 cm; \n", + "mass = 24.62 kg; FOS = 1.17 kg; deflection = 0.51 cm; \n", + "mass = 24.62 kg; FOS = 1.17 kg; deflection = 0.51 cm; \n", + "mass = 24.62 kg; FOS = 1.17 kg; deflection = 0.51 cm; \n", + "mass = 24.61 kg; FOS = 1.18 kg; deflection = 0.50 cm; \n", + "mass = 24.61 kg; FOS = 1.18 kg; deflection = 0.50 cm; \n", + "mass = 24.61 kg; FOS = 1.17 kg; deflection = 0.50 cm; \n", + "mass = 24.61 kg; FOS = 1.17 kg; deflection = 0.50 cm; \n", + "mass = 24.61 kg; FOS = 1.17 kg; deflection = 0.50 cm; \n", + "mass = 24.61 kg; FOS = 1.18 kg; deflection = 0.50 cm; \n", + "mass = 24.61 kg; FOS = 1.18 kg; deflection = 0.50 cm; \n", + "mass = 24.61 kg; FOS = 1.16 kg; deflection = 0.50 cm; \n", + "mass = 24.61 kg; FOS = 1.16 kg; deflection = 0.50 cm; \n", + "mass = 24.61 kg; FOS = 1.17 kg; deflection = 0.50 cm; \n", + "mass = 24.61 kg; FOS = 1.17 kg; deflection = 0.50 cm; \n" + ] + } + ] + }, + { + "cell_type": "code", + "source": [ + "final_truss = make_truss(result.x)\n", + "final_truss.analyze()\n", + "callback(result)\n", + "trussme.visualize.plot_truss(final_truss, starting_shape=\"force\");" + ], + "metadata": { + "id": "KWsBltqLhMi2", + "outputId": "b2c1c8c8-e961-475d-9128-a34149ba118e", + "colab": { + "base_uri": "https://localhost:8080/", + "height": 423 + } + }, + "execution_count": 12, + "outputs": [ + { + "output_type": "stream", + "name": "stdout", + "text": [ + "mass = 24.61 kg; FOS = 1.17 kg; deflection = 0.50 cm; \n" + ] + }, + { + "output_type": "display_data", + "data": { + "text/plain": [ + "
" + ], + "image/png": "iVBORw0KGgoAAAANSUhEUgAAAgMAAAGFCAYAAABg2vAPAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjcuMSwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy/bCgiHAAAACXBIWXMAAA9hAAAPYQGoP6dpAAAe5ElEQVR4nO3deZgV1ZnH8d85t7tpNhENguAad00kQVB01ODjxriAGCMStscFnbiP6zgxUdQxo4IxYsgIhhEEEcMwQlwQzWh0IhpcorghmgjIHkHohu6+99Z5549Cum9QJyxS3X2+n798qogejcKXqveccmZmAgAA0fJZLwAAAGSLGAAAIHLEAAAAkSMGAACIHDEAAEDkiAEAACJHDAAAEDliAACAyBEDAABEjhgAACByxAAAAJEjBgAAiBwxAABA5IgBAAAiRwwAABA5YgAAgMgRAwAARI4YAAAgcsQAAACRIwYAAIgcMQAAQO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I4YAAAgcsQAAACRIwYAAIgcMQAAQOSIAQAAIkcMAAAQOWIAAIDIEQMAAESOGAAAIHLEAAAAkSMGAACIHDEAAEDkiAEAACJHDAAAEDliAACAyBEDAABEjhgAACByxAAAAJEjBgAAiBwxAABA5IgBAAAiRwwAABA5YgAAgMgRAwAARI4YAAAgcsQAAACRIwYAAIgcMQAAQOSIAQAAIkcMAAAQOWIAAIDIEQMAAESOGAAAIHLEAAAAkSMGAACIHDEAAEDkiAEAACJHDAAAEDliAACAyBEDAABEjhgAACByxAAAAJEjBgAAiBwxAABA5IgBAAAiRwwAABA5YgAAgMgRAwAARO7/AORI/NG4EgHQAAAAAElFTkSuQmCC\n" + }, + "metadata": {} + } + ] + }, + { + "cell_type": "code", + "source": [ + "final_truss.fos_buckling" + ], + "metadata": { + "id": "L0etCQgyhTDM", + "outputId": "3ab98538-8e38-4c6d-c44e-e2b4f56069fa", + "colab": { + "base_uri": "https://localhost:8080/" + } + }, + "execution_count": 13, + "outputs": [ + { + "output_type": "execute_result", + "data": { + "text/plain": [ + "1.1665746158046306" + ] + }, + "metadata": {}, + "execution_count": 13 + } + ] + }, + { + "cell_type": "code", + "source": [], + "metadata": { + "id": "agtKz9YHq-er" + }, + "execution_count": 13, + "outputs": [] + } + ], + "metadata": { + "colab": { + "name": "scratchpad", + "provenance": [], + "include_colab_link": true + }, + "kernelspec": { + "display_name": "Python 3", + "name": "python3" + } + }, + "nbformat": 4, + "nbformat_minor": 0 +} \ No newline at end of file