# Materials Algorithms Project Program Library

## Program MAP_STEEL_HOTROLLED_UTS_EL

### 1. Provenance of Source Code

Min Sung Joo
Pohang University of Science and Technology
Pohang, Kyoungbuk, Republic of Korea

athpimo@postech.ac.kr

Top | Next

### 2. Purpose of code

This program is an implementation of a genetic algorithm which can reach optimum sets of input parameters, such as chemical composition and processing variable, for two desired target values of the ultimate tensile strength and the elongation to failure of hot-rolled steels in the same time. This can in theory be applied to any problem, where a neural network exists.

Top | Next | Prev

### 3. Specification

 Language: C Product form: Source code and executable files for UNIX/Linux machines.

Complete program.

Top | Next | Prev

### 4. Description

The neural network is a non-linear regression method for modelling which can be used to establish physical link between the microstructure and complex mechanical properties depending on a large number of input parameters. Because of the large multidimensional space of solutions, if we are interested in finding the best sets or domains of input parameters for several target value, an efficient searching tool is needed. In this case, the genetic algorithm ,which is an optimization technique which simulates biological evolution, can be used.
The genetic algorithm is an optimization technique which simulates biological evolution. This is done by a random creation of a population of individuals, represented by chromosomes. These individuals are evaluated and undergo a process of evolution which start with a natural selection, inspired by Darwin's theory of evolution: the best individuals of a population are selected. Then a biological process occurs: some recombinations, as crossover and mutation, are made in order to create a new generation of individuals with the hope that this new one is better. The genetic algorithm is stopped when a target value is reached.
For example, if the problem is that of looking for the input set(xi), which will give two desired outputs y1 and y2 in the same time:

y1 = f1 (x1, x2, ..., xn)
y2 = f2 (x1, x2, ..., xn)

with the function f1 and f2 being non-linear models which are made by neural network.
In order to adjust the genetic algorithm to this prolbem, the user need to set the two desired target t1 and t2, and then the genetic algorithms randomly generates sets of inputs called 'chromosomes', which exist in populations:

Xi = [xi1, xi2, ..., xin]

These sets are used to calculate the outputs y1 and y2 for f1 and f2 of neural network models and then ranked according to a fitness factor, which describes how well they perform. The best chromosomes are selected and subjected to operations, as well in the biological system, as crossover or mutation. In this way, we obtain the input sets for the next calculation. This new sets of chromosomes are then still evaluated and undergo selection, crossover and mutation mechanisms. This kind of process takes place for many times until the fitness value is reached. It means that the output of function for the inserted input reachs close to the desired target.

MAP provides a set of data files, which can be used with the GA program for finding different sets of inputs. The multiple_UTS_EL.tar.gz file, which can be downloaded from here, contains the following files. A working version of a GA is also included to optimize the ultimate tensile strength and elongation to failure of the hot-rolled steels as a function of chemical composition and processing variables.

The following are concerned with the genetic algorithm files that work with the neural network:

genetic.c
A C program used to run the genetic algorithm.
genetic.h
multiple_UTS_EL
An executable program of genetic.c.
generate44
It reads the normalized input data file, input/norm_test.in, and uses the weight files in subdicrectory input. The results are written to the temporary output file _ot, _out, _res and _sen.
unnormalise/treatout.c
A C program for un-normalising the output data files.
unnormalise/treatout
An executable program of unnormalise/treatout.c.
unnormalise/nn-output_b
A file which contains the normalized inputs and outputs of the GA after the program has concluded.
unnormalise/result
A file which contains the unnormalized values for inputs, outputs and error of each chromosome after unnormalising data in the normalized nn-output_b file.
input/labels.txt
A list of input variables.
input/TARGETS
Normalised inputs file (target and accuracy values for the GA).
input/norm_test.in
A text file which contains the normalized input variables initialized by the GA to be fed into the neural network.

The following are concerned with the neural network files that work with the GA, but can be changed according to user requirements:

input/11/_w*f
The weights files for the UTS model.
input/11/*.lu
Files containing information for calculating the size of the error bars for the UTS model.
input/11/spec1.t1
An altered version of spec.t1 which is a dynamic file for UTS model, created by neural network. It is read by the program generate44.
input/11/outran.x
A normalized output file that was created when developing the UTS model. It is accessed by generate44 via input/11/spec1.t1.
input/17/_w*f
The weights files for the EL model.
input/17/*.lu
Files containing information for calculating the size of the error bars for the EL model.
input/17/spec1.t1
An altered version of spec.t1 which is a dynamic file for EL model, created by neural network. It is read by the program generate44.
input/17/outran.x
A normalized output file that was created when developing the EL model. It is accessed by generate44 via input/11/spec1.t1.
input/MINMAX
Minimum and maximum values for the input variables used in the original database.

#### How to run the GA to find optimum sets of parameters:

```First, you have to define in the "values" of the inputs you wish to
vary or those you wish to fix and the corresponding fixed value.
Then, you must normalise the desired target value of the ultimate
tensile strength and the elongation and enter them in the
"input/nn-input" file, as well as the wanted accuracy. For example,

2
0.4 0.1
0.2 0.1

First line means that the number of target is 2.
Second line means that 0.4 of normalised target for UTS with 0.1 (10%)accuracy.
Third line means that 0.2 of normalised target for EL with 0.1 (10%) accuracy.

Secondly, you need to set the permitted values for targets in genetic.h

#define MAX_UNNORMAL_UTS               1039.0
#define MIN_UNNORMAL_UTS               317.0
#define MAX_UNNORMAL_EL                50.0
#define MIN_UNNORMAL_EL                14.0
#define TARGET_UNNORMAL_UTS            400.0
#define TARGET_UNNORMAL_EL             35.0
#define TARGET_PERCENT_PERMIT          0.1
#define UNCERTAINTY_PERCENT_PERMIT     0.15

MAX_UNNORMAL_UTS is maximum UTS,
MIN_UNNORMAL_UTS is minimum UTS,
MAX_UNNORMAL_EL is maximum elongation,
MIN_UNNORMAL_EL is minimum elongation,
TARGET_UNNORMAL_UTS is target UTS and TARGET_UNNORMAL_EL is target elongation in MINMAX.
TARGET_PERCENT_PERMIT is permitted range for the targets and
UNCERTAINTY_PERCENT_PERMIT is permitted range for the uncertainties.

Finally, compile the C program "genetic.c" (cc -lm genetic.c) and execute it.
```

#### How to change GA parameters

The efficiency of the GA depend on the values of parameters such as the number of population, the number of generations ... which are not defined for any problem but must be adapted for each GA. The values are entered directly in the "genetic.h" file so you have to edit it and change the desired values in the header of the file.

Top | Next | Prev

### 5. References

1. Minsung Joo, 2008, Reducing redundancy in steel design, M.Eng. Thesis, POSTECH
2. Ryu, J. H., 2007, Model for mechanical properties of Hot-Rolled Steels, M.Eng. Thesis, POSTECH
3. Shah, I., 2002, Tensile Properties of Austenitic Stainless Steel, I. Shah, M.Phil. Thesis, University of Cambridge
4. Delorme, A., 2003, Genetic Algorithm for Optimization of Mechanical Properties, Technical report, University of Cambridge

Top | Next | Prev

### 6. Parameter descriptions

#### Input parameters

To specify the target value and accuracy desired, input/TARGETS must be amended. The normalized target value relates to a real value, according to the input/MINMAX file used.

 Row1 The number of targets Row2 Normalised target value of UTS and its accuracy (in decimal e.g. 0.1 for 10%) Row3 Normalised target value of EL and its accuracy (in decimal e.g. 0.1 for 10%)

To specify the permitted range of the output, genetic.h must be changed.

 #define MAX_UNNORMAL_UTS The maximum UTS in MINMAX #define MIN_UNNORMAL_UTS The minimum UTS in MINMAX #define MAX_UNNORMAL_EL The maximum elongation in MINMAX #define MIN_UNNORMAL_EL The minimum elongation in MINMAX #define TARGET_UNNORMAL_UTS The target of UTS #define TARGET_UNNORMAL_EL The target of elongation #define TARGET_PERCENT_PERMIT The permitted range for the targets #define UNCERTAINTY_PERCENT_PERMIT The permitted range for the uncertainties

To initiate the GA search, the inputs are randomly generated and placed in input/norm_test.in. It should be noted that each chromosome generally relates to a different steel composition, but this could change over the course of optimization. For the current multi-objective model, the composition and processing variables, totally 17 data items, are specified:

 Gene Number Variable 1 Normalised C, wt% 2 Normalised Mn, wt% 3 Normalised Si, wt% 4 Normalised P, wt% 5 Normalised S, wt% 6 Normalised Cr, wt% 7 Normalised Ni, wt% 8 Normalised Mo, wt% 9 Normalised Ti, wt% 10 Normalised Nb, wt% 11 Normalised V, wt% 12 Normalised Al, wt% 13 Normalised N, ppm 14 Normalised B, ppm 15 Normalised Cu, wt% 16 Normalised Finishing rolling temperature, Centigrade 17 Normalised Coling temperature, Centigrade

Each input is normalized using the equation:
Normalized value = (value - min)/(max-min) - 0.5

Where the values for min and max are defined as follows:

 Gene Number Variable Minimum Maximum 1 C, wt% 0.0204 0.8684 2 Mn, wt% 0.1670 1.4100 3 Si, wt% 0 0.2170 4 P, wt% 0.0040 0.0220 5 S, wt% 0.0020 0.0150 6 Cr, wt% 0 0.1600 7 Ni, wt% 0 0.0600 8 Mo, wt% 0 0.0200 9 Ti, wt% 0 0.0040 10 Nb, wt% 0 0.0040 11 V, wt% 0 0.0030 12 Al, wt% 0 0.0640 13 N, ppm 0 87.00 14 B, ppm 0 2.00 15 Cu, wt% 0 0.0300 16 Finishing rolling temperature, Centigrade 808.00 925.00 17 Coling temperature, Centigrade 478.00 714.00

#### Output parameters

Two output files are produced by the GA program: unnormalise/nn-output_b and score-output.

score-output simply prints out the scores for each chromosome.
unnormalise/nn-output_b contains the inputs, prediction and (prediction + error).

This is done for the best chromosomes within all populations:

 Column 1-17 The normalized predicted inputs Column 18 The normalized predicted UTS Column 19 The normalized uncertainty for UTS Column 20 The normalized predicted EL Column 21 The normalized uncertainty for EL

The normalized values in all columns must be un-normalised using the equation:

actual value = (normalized value + 0.5) * (max-min) + min

The C program, unnormalise/treatout.c, is used to translate the output files to produce the actual values of inputs and outputs which are written to unnormalise/result.

Top | Next | Prev

### 7. Error Indicators

None.

Top | Next | Prev

### 8. Accuracy estimate

See:
Input parameters, output parameters.

Top | Next | Prev

See:
MAP_STEEL_HOTROLLED_UTS, MAP_STEEL_HOTROLLED_EL

Top | Next | Prev

### 10. Example

#### 1. Program text

Complete program.

#### 2. Program data

The input file (input/TARGETS) is:
1
-0.385042 0.1
0.083333 0.1

The input variables (genetic.h) are:
 #define MAX_UNNORMAL_UTS 1039 #define MIN_UNNORMAL_UTS 317 #define MAX_UNNORMAL_EL 50 #define MIN_UNNORMAL_EL 14 #define TARGET_UNNORMAL_UTS 400 #define TARGET_UNNORMAL_EL 35 #define TARGET_PERCENT_PERMIT 0.1 #define UNCERTAINTY_PERCENT_PERMIT 0.15

#### 3. Program results

```
After 1000 generations,

The output file unnormalise/nn-output_b,
which contains the normalised values for the ultimate tensile strength
and elongation to failure models including compositions and processing variables
(after eliminate the duplicates):

C         Mn        Si        P         S         Cr        Ni        Mo
-0.398056 -0.220628 -0.313316  0.056306  0.082468 -0.499524 -0.301120 -0.177404
-0.398056 -0.220628 -0.313316  0.056306  0.082468 -0.499524 -0.301120 -0.177404
-0.475544 -0.561986 -0.313316  0.056306  0.082468 -0.499524 -0.301120 -0.367664
-0.398056 -0.220628 -0.048844 -0.501250  0.529016 -0.257462 -0.113136 -0.177404
-0.475544 -0.130388 -0.313316  0.056306  0.082468 -0.499524 -0.301120 -0.367664
-0.398056 -0.220628 -0.313316  0.056306  0.082468 -0.499524 -0.301120 -0.367664
-0.398056 -0.220628 -0.313316  0.056306  0.082468 -0.499524 -0.301120 -0.367664
-0.398056 -0.220628 -0.313316  0.056306  0.082468 -0.499524 -0.301120 -0.367664
-0.398056 -0.220628 -0.313316  0.056306  0.082468 -0.499524 -0.301120 -0.367664
-0.398056 -0.220628 -0.313316  0.056306  0.082468 -0.499524 -0.301120 -0.367664
-0.398056 -0.220628 -0.313316  0.056306  0.082468 -0.499524 -0.301120 -0.367664
-0.398056 -0.220628 -0.313316  0.056306  0.082468 -0.499524 -0.301120 -0.367664
-0.398056 -0.220628 -0.313316  0.056306  0.082468 -0.499524 -0.301120 -0.367664
-0.398056 -0.220628 -0.313316  0.056306  1.000000 -0.499524 -0.301120 -0.367664
-0.398056 -0.220628 -0.313316  0.056306  0.082468 -0.499524 -0.301120 -0.367664
-0.398056 -0.220628 -0.313316  0.056306  0.082468 -0.499524 -0.301120 -0.367664
-0.398056 -0.220628 -0.313316  0.056306  0.082468 -0.499524 -0.301120 -0.367664

Ti        Nb        V         Al        N         B         Cu        FRT       CT
1.000000 -0.392392  1.000000 -0.055930  0.057670  0.027608 -0.169880 -0.580246  0.259780
1.000000 -0.392392  1.000000 -0.055930  0.057670  0.027608  1.000000  1.000000  0.259780
1.000000 -0.392392 -0.117396 -0.055930  0.057670 -0.284446  0.045918 -0.312928  0.343830
-0.327078 -0.392392 -0.117396 -0.055930  0.057670  0.027608  1.000000  1.000000  0.259780
-0.327078 -0.392392  1.000000  0.551784  0.060506 -0.403904  1.000000  1.000000 -0.149948
-0.327078 -0.392392 -0.117396 -0.055930  0.057670 -0.370240  1.000000  1.000000  0.259780
-0.327078 -0.392392 -0.117396 -0.055930  0.057670 -0.370240  1.000000  1.000000 -0.215434
-0.327078 -0.392392 -0.117396 -0.055930  0.057670 -0.370240  1.000000  1.000000  0.200652
-0.327078 -0.392392 -0.117396 -0.055930  0.057670  0.027608  1.000000  0.817484  0.021144
-0.327078 -0.392392  1.000000 -0.055930  0.057670 -0.370240  1.000000  0.297672 -0.241228
-0.327078 -0.392392  1.000000 -0.055930  0.057670  0.220582  0.472396  1.000000  0.200652
-0.327078 -0.392392 -0.021238  0.275688  0.057670 -0.370240  1.000000  1.000000  0.090482
-0.327078 -0.392392 -0.117396  0.420880  0.091766  1.000000  1.000000 -0.269236  0.068824
-0.327078 -0.392392 -0.021238  0.275688  0.057670 -0.370240  1.000000  1.000000  0.090482
-0.020580  0.012766  0.756828 -0.206050  0.057670 -0.370240  1.000000  1.000000  0.090482
-0.327078 -0.392392 -0.117396 -0.055930  0.057670 -0.370240  1.000000  0.297672  0.090482
-0.327078 -0.392392 -0.117396 -0.055930  0.057670 -0.370240  1.000000  1.000000  0.090482

UTS             Uncertainty for UTS        Elongation        Uncertainty for EL
-0.391685       -0.262677                   0.069802          0.278176
-0.380911       -0.259091                   0.107902          0.334289
-0.412365       -0.266818                   0.160434          0.330986
-0.352884       -0.191931                   0.112458          0.287693
-0.370306       -0.276402                  -0.000373          0.216698
-0.385824       -0.299624                   0.170218          0.303250
-0.338677       -0.245395                   0.081005          0.184393
-0.378293       -0.295181                   0.160037          0.284294
-0.348384       -0.277457                   0.173599          0.305266
-0.340638       -0.277737                   0.093019          0.229417
-0.370012       -0.276400                   0.174379          0.322403
-0.359748       -0.278867                   0.147743          0.268202
-0.355681       -0.285834                   0.004444          0.258778
-0.346510       -0.208929                   0.097465          0.342948
-0.379628       -0.293965                   0.137468          0.284890
-0.352441       -0.304278                   0.177462          0.302286
-0.365780       -0.284701                   0.140411          0.250856

These are then run with unnormalise/treatout.c,
where the normalised values are converted into the actual values
to unnormalise/result:

C        Mn       Si       P        S        Cr       Ni       Mo
0.106849 0.514259 0.040510 0.014014 0.009572 0.000076 0.011933 0.006452
0.106849 0.514259 0.040510 0.014014 0.009572 0.000076 0.011933 0.006452
0.041139 0.089951 0.040510 0.014014 0.009572 0.000076 0.011933 0.002647
0.106849 0.514259 0.097901 0.003977 0.015377 0.038806 0.023212 0.006452
0.041139 0.626428 0.040510 0.014014 0.009572 0.000076 0.011933 0.002647
0.106849 0.514259 0.040510 0.014014 0.009572 0.000076 0.011933 0.002647
0.106849 0.514259 0.040510 0.014014 0.009572 0.000076 0.011933 0.002647
0.106849 0.514259 0.040510 0.014014 0.009572 0.000076 0.011933 0.002647
0.106849 0.514259 0.040510 0.014014 0.009572 0.000076 0.011933 0.002647
0.106849 0.514259 0.040510 0.014014 0.009572 0.000076 0.011933 0.002647
0.106849 0.514259 0.040510 0.014014 0.009572 0.000076 0.011933 0.002647
0.106849 0.514259 0.040510 0.014014 0.009572 0.000076 0.011933 0.002647
0.106849 0.514259 0.040510 0.014014 0.009572 0.000076 0.011933 0.002647
0.106849 0.514259 0.040510 0.014014 0.021500 0.000076 0.011933 0.002647
0.106849 0.514259 0.040510 0.014014 0.009572 0.000076 0.011933 0.002647
0.106849 0.514259 0.040510 0.014014 0.009572 0.000076 0.011933 0.002647
0.106849 0.514259 0.040510 0.014014 0.009572 0.000076 0.011933 0.002647

Ti       Nb       V        Al       N         B        Cu       FRT        CT
0.006000 0.000430 0.004500 0.028420 48.517288 1.055216 0.009904 798.611206 657.308105
0.006000 0.000430 0.004500 0.028420 48.517288 1.055216 0.045000 983.500000 657.308105
0.006000 0.000430 0.001148 0.028420 48.517288 0.431108 0.016378 829.887451 677.143860
0.000692 0.000430 0.001148 0.028420 48.517288 1.055216 0.045000 983.500000 657.308105
0.000692 0.000430 0.004500 0.067314 48.764023 0.192192 0.045000 983.500000 560.612244
0.000692 0.000430 0.001148 0.028420 48.517288 0.259520 0.045000 983.500000 657.308105
0.000692 0.000430 0.001148 0.028420 48.517288 0.259520 0.045000 983.500000 545.157593
0.000692 0.000430 0.001148 0.028420 48.517288 0.259520 0.045000 983.500000 643.353882
0.000692 0.000430 0.001148 0.028420 48.517288 1.055216 0.045000 962.145630 600.989990
0.000692 0.000430 0.004500 0.028420 48.517288 0.259520 0.045000 901.327637 539.070190
0.000692 0.000430 0.004500 0.028420 48.517288 1.441164 0.029172 983.500000 643.353882
0.000692 0.000430 0.001436 0.049644 48.517288 0.259520 0.045000 983.500000 617.353760
0.000692 0.000430 0.001148 0.058936 51.483643 3.000000 0.045000 834.999390 612.242493
0.000692 0.000430 0.001436 0.049644 48.517288 0.259520 0.045000 983.500000 617.353760
0.001918 0.002051 0.003770 0.018813 48.517288 0.259520 0.045000 983.500000 617.353760
0.000692 0.000430 0.001148 0.028420 48.517288 0.259520 0.045000 901.327637 617.353760
0.000692 0.000430 0.001148 0.028420 48.517288 0.259520 0.045000 983.500000 617.353760

UTS             Uncertainty for UTS        Elongation        Uncertainty for EL
395.203430      93.143768                  34.512871         7.501466
402.982269      87.954033                  35.884472         8.149933
380.272491      105.084923                 37.775623         6.139873
423.217743      116.208076                 36.048489         6.308459
410.639069      67.798691                  31.986572         7.814556
399.435089      62.236385                  38.127850         4.789151
433.475220      67.349586                  34.916180         3.721968
404.872437      60.006878                  37.761333         4.473251
426.466766      51.209282                  38.249565         4.740011
432.059357      45.414536                  35.348682         4.910329
410.851349      67.587852                  38.277645         5.328863
418.261932      58.396088                  37.318748         4.336524
421.198303      50.429539                  32.159985         9.156024
427.819794      99.333466                  35.508739         8.837388
403.908569      61.848694                  36.948849         5.307191
423.537598      34.773697                  38.388634         4.493662
413.906830      58.539055                  37.054794         3.976022

```

Top | Next | Prev

### 11. Auxiliary subroutines required

None.

Top | Next | Prev

### 12. Keywords

hot-rolled steel, genetic algorithm, ultimate tensile strength, elongation, neural network

Top | Next | Prev