## Mathematical Modeling for Engineering Design

## Main.MathematicalModeling History

Hide minor edits - Show changes to output

Deleted lines 14-32:

----

(:html:)

<div id="disqus_thread"></div>

<script type="text/javascript">

/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */

var disqus_shortname = 'apmonitor'; // required: replace example with your forum shortname

/* * * DON'T EDIT BELOW THIS LINE * * */

(function() {

var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;

dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';

(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);

})();

</script>

<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

<a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>

(:htmlend:)

Deleted lines 14-45:

----

!!!! Modeling Exercise

Modeling often constitutes most of an optimization project. There is some art in the way a programmer poses the model in a way that allows solvers to efficiently find a solution. Below are some tips and an exercise on ways to rearrange the model equations for improved convergence.

[[Attach:twobar_rearrangement.pdf | Worksheet with Modeling Exercises]]

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v1.apm | Solve Initial Version]]

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v2.apm | Solve with SQRT removed]]

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v3.apm | Solve with added constraints and no SQRT]]

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v4.apm | Solve with added constraints and explicit definition of some variables]]

# Rearrange to equation in residual form to:

## Avoid divide by zero

## Minimize use of functions like sqrt, log, exp, etc.

## Have continuous first and second derivatives

## Fit the equation into a linear or quadratic form

# Bounds

## Include variable bounds to exclude infeasible solutions

## Variable bounds to avoid regions of strong nonlinearity

## Caution: watch for infeasible solutions

# Scaling:

## Scale absolute value of variables to 1e-3 to 1e3

## Scale absolute value of equation residuals to 1e-3 to 1e3

## Better that 1st derivative values are closer to 1.0

# Good initial conditions:

## Starting near a solution can improve convergence

## Try multiple initial conditions to verify global solution (non-convex problems)

## Explicitly calculate intermediate values

# Check iteration summary for improved convergence

Added lines 24-28:

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v1.apm | Solve Initial Version]]

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v2.apm | Solve with SQRT removed]]

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v3.apm | Solve with added constraints and no SQRT]]

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v4.apm | Solve with added constraints and explicit definition of some variables]]

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v2.apm | Solve with SQRT removed]]

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v3.apm | Solve with added constraints and no SQRT]]

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v4.apm | Solve with added constraints and explicit definition of some variables]]

Deleted lines 46-50:

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v1.apm | Solve Initial Version]]

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v2.apm | Solve with SQRT removed]]

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v3.apm | Solve with added constraints and no SQRT]]

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v4.apm | Solve with added constraints and explicit definition of some variables]]

Changed line 22 from:

Attach:twobar_rearrangement.~~pdf~~

to:

[[Attach:twobar_rearrangement.pdf | Worksheet with Modeling Exercises]]

Added lines 42-46:

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v1.apm | Solve Initial Version]]

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v2.apm | Solve with SQRT removed]]

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v3.apm | Solve with added constraints and no SQRT]]

* [[https://apmonitor.com/online/view_pass.php?f=twobar_v4.apm | Solve with added constraints and explicit definition of some variables]]

Added lines 15-41:

----

!!!! Modeling Exercise

Modeling often constitutes most of an optimization project. There is some art in the way a programmer poses the model in a way that allows solvers to efficiently find a solution. Below are some tips and an exercise on ways to rearrange the model equations for improved convergence.

Attach:twobar_rearrangement.pdf

# Rearrange to equation in residual form to:

## Avoid divide by zero

## Minimize use of functions like sqrt, log, exp, etc.

## Have continuous first and second derivatives

## Fit the equation into a linear or quadratic form

# Bounds

## Include variable bounds to exclude infeasible solutions

## Variable bounds to avoid regions of strong nonlinearity

## Caution: watch for infeasible solutions

# Scaling:

## Scale absolute value of variables to 1e-3 to 1e3

## Scale absolute value of equation residuals to 1e-3 to 1e3

## Better that 1st derivative values are closer to 1.0

# Good initial conditions:

## Starting near a solution can improve convergence

## Try multiple initial conditions to verify global solution (non-convex problems)

## Explicitly calculate intermediate values

# Check iteration summary for improved convergence

Added lines 15-33:

----

(:html:)

<div id="disqus_thread"></div>

<script type="text/javascript">

/* * * CONFIGURATION VARIABLES: EDIT BEFORE PASTING INTO YOUR WEBPAGE * * */

var disqus_shortname = 'apmonitor'; // required: replace example with your forum shortname

/* * * DON'T EDIT BELOW THIS LINE * * */

(function() {

var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;

dsq.src = 'https://' + disqus_shortname + '.disqus.com/embed.js';

(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);

})();

</script>

<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

<a href="https://disqus.com" class="dsq-brlink">comments powered by <span class="logo-disqus">Disqus</span></a>

(:htmlend:)

Changed line 7 from:

to:

!!! Introduction

Changed line 9 from:

to:

!!! Physical Models vs. Experimental Models

Changed line 11 from:

to:

!!!! Physical Models

Changed line 13 from:

to:

!!!! Experimental Models

Changed line 7 from:

to:

* Introduction

Changed line 9 from:

to:

* Physical Models vs. Experimental Models

Changed line 11 from:

to:

** Physical Models

Changed line 13 from:

to:

** Experimental Models

Changed line 1 from:

(:title Mathematical Modeling for ~~Optimization~~:)

to:

(:title Mathematical Modeling for Engineering Design:)

Added lines 1-14:

(:title Mathematical Modeling for Optimization:)

(:keywords mathematical modeling, nonlinear, optimization, engineering optimization, interior point, active set, differential, algebraic, modeling language, university course:)

(:description Mathematical modeling is necessary to apply optimization techniques in engineering:)

[[Attach:chap2_modeling.pdf | Chapter 2: Mathematical Modeling]]

# Introduction

As was discussed in the previous chapter, in order to apply optimization methods we must have a model to optimize. As we also mentioned, obtaining a good model of the design problem is the most important step in optimization. In this chapter we discuss some modeling concepts that can help you develop models which can successfully be optimized. We also discuss the formulation of objectives and constraints for some special situations. We look at how graphics can help us understand the nature of the design space and the model. We end with an example optimization of a heat pump.

# Physical Models vs. Experimental Models

Two types of models are often used with optimization methods: physical models and experimental models. Physical models are based on the underlying physical principles that govern the problem. Experimental models are based on models of experimental data. Some models contain both physical and experimental elements. We will discuss both types of models briefly.

## Physical Models

Physical models can be either analytical or numerical in nature. For example, the Two-bar truss is an analytical, physical model. The equations are based on modeling the physical phenomena of stress, buckling stress and deflection. The equations are all closed form, analytical expressions. If we used numerical methods, such as the finite element method, to solve for the solution to the model, we would have a numerical, physical model.

## Experimental Models

Experimental models are based on experimental data. A functional relationship for the data is proposed and fit to the data. If the fit is good, the model is retained; if not, a new relationship is used. For example if we wish to find the friction factor for a pipe, we could refer to the Moody chart, or use expressions based on a curve fit of the data.

(:keywords mathematical modeling, nonlinear, optimization, engineering optimization, interior point, active set, differential, algebraic, modeling language, university course:)

(:description Mathematical modeling is necessary to apply optimization techniques in engineering:)

[[Attach:chap2_modeling.pdf | Chapter 2: Mathematical Modeling]]

# Introduction

As was discussed in the previous chapter, in order to apply optimization methods we must have a model to optimize. As we also mentioned, obtaining a good model of the design problem is the most important step in optimization. In this chapter we discuss some modeling concepts that can help you develop models which can successfully be optimized. We also discuss the formulation of objectives and constraints for some special situations. We look at how graphics can help us understand the nature of the design space and the model. We end with an example optimization of a heat pump.

# Physical Models vs. Experimental Models

Two types of models are often used with optimization methods: physical models and experimental models. Physical models are based on the underlying physical principles that govern the problem. Experimental models are based on models of experimental data. Some models contain both physical and experimental elements. We will discuss both types of models briefly.

## Physical Models

Physical models can be either analytical or numerical in nature. For example, the Two-bar truss is an analytical, physical model. The equations are based on modeling the physical phenomena of stress, buckling stress and deflection. The equations are all closed form, analytical expressions. If we used numerical methods, such as the finite element method, to solve for the solution to the model, we would have a numerical, physical model.

## Experimental Models

Experimental models are based on experimental data. A functional relationship for the data is proposed and fit to the data. If the fit is good, the model is retained; if not, a new relationship is used. For example if we wish to find the friction factor for a pipe, we could refer to the Moody chart, or use expressions based on a curve fit of the data.