## Grapheme – Numerical Optimization Capabilities – Part II

### Contents

### Introduction

In the previous post **Numerical Optimization Capabilities (Part I)** we briefly discussed the main numerical optimization capabilities of Grapheme. We introduced and familiarized with the concepts of the *Evaluation Panels* and of the *Optimization Search Panels* and we run through the step-by-step optimization of benchmark analytical functions.

This post moves from there and illustrates how to define and use scriptable evaluation panels to perform more complex evaluations, even calling and linking external third party applications. We will do that by setting up a simple multi-objective optimization search for a typical structural engineering application: the optimization of a cantilever beam subjected to axial compression.

### The optimization problem

Our goal is to optimize the cross section of a cantilever beam subjected to axial compression load so to have a lightweight structure capable to bear as much load as possible without buckle. This is a well know problem where we want to maximize the buckling load of the beam whilst simultaneously reducing its cross section area in order to reduce as much as possible the weight of the beam.

To make the example as simple as possible, we consider a rectangular section with constant thickness and we evaluate the buckling load via Timoshenko and Gere (1961) formula:

is the Elastic modulus of the beam material;*E*is the minimum moment of inertia of the bean section along X and Y;*I*is the free length of the beam.*L*

Moment of inertia can be evaluated as:

### The evaluation panel

To solve our multi-objective optimization we will define to distinct evaluation panels:

: we will define an expression based evaluation panel to compute the cross section area of the beam. The area can be easily evaluated as:*Area Evaluation*where*2*H*t + 2*(B-2*t)*t’*and*H*are the height and the width of the cross section whilst*B*is the thickness of the beam profile. To create the Expression Based evaluation panel we move into the Statistical Analysis Module perspective of Grapheme. From the Statistical Analysis Tree create a new analysis selecting the Optimization Panel category. When the wizard opens up, select Expression Evaluator and move to the next page. From there, define we define the three design variables B=[20,80], H=[20,80] and t=[1,3]. Then we edit end define the area expression function.*t*: even if we could use an analytical expression to code the critical laod of the beam section, we will opt for a java scripted solution. To create the Java scripting based panel, from the Statistical Analysis Tree create a new analysis selecting the Optimization Panel category. When the wizard opens up, select Java Function Evaluator and move to the next page. From there we set the same variable and domain used to define the area and then we write the main Java function.*Buckling Load Evaluation*

**The Java Function Evaluator**

The rationale is to provide a way to define and arbitrary objective and constraint functions to optimization searches as deemed required, even linking and calling external applications.

Accordingly, a Java Function Evaluator Panel allows defining a set of design variables and relevant domains along with a Java entry point to evaluate and return a scalar value be used in any other Optimization Search Panel.

Users are required to implement their evaluation method within a predefined class template. More specifically, users will need to implement the body of the function **evaluate**:

public class Evaluator { public static double evaluate(double[] values, String projectDir) { // implement here your function call return Double.NaN; } }

In our specific example, we can code the critical load evaluation as it follows:

public class Evaluator { static int L = 5000; // Lenght of th beam in mm static int E = 210000; // Young modulus - structural steel - N/mm^2 public static double evaluate(double[] values, String projectDir) { double H = values[0]; double B = values[1]; double t2 = 2*values[2]; double b = B-t2; double h = H-t2; double Jxx = (B* H*H*H - b* h*h*h) / 12.0; double Jyy = (H* B*B*b - h* b*b*b) / 12.0; double Pcr = 0.25 * Math.PI * Math.PI * E * Math.min( Jxx, Jyy ) / L / L; return Pcr; } }

### The optimization problem

### Optimization results

### Conclusions:

This post provides a deeper overview of the optimization capabilities made available in Grapheme v.2.9 and more specifically on how to write Java scriptable evaluation nodes.

Script based evaluation panels are a flexible and powerful way to define arbitrary optimization search within Grapheme.

Users shall bear in mind that Grapheme optimization algorithms have been designed and implemented to solve problems where both objective and constraint (if any defined) function evaluations are fast and not computationally expensive. For a more powerful process integration and optimization suite, have a look at **Nexus**, which has been specifically designed to perform trade-off and optimization studies of complex design process involving computationally intensive analysis tasks.

You can download your free-trial version of Grapheme from our official website ** Grapheme** .