Manual Guide for R-IoMP - Teccampus.cva.itesm.mx/rbatres/riomp-files/riomp-guide.pdfQuick Guide for...
Transcript of Manual Guide for R-IoMP - Teccampus.cva.itesm.mx/rbatres/riomp-files/riomp-guide.pdfQuick Guide for...
pg. 1
Manual Guide for R-IoMP
Welcome to R - Identification of Mechanical Properties (RIoMP) release 1.5.
Contents
Advices from author ...................................................................................................................... 2
Chapter 1 – Requirements ........................................................................................................... 2
Chapter 2 – Prepare files .............................................................................................................. 3
Section 2.1 – Experimental Response files .......................................................................... 6
Section 2.2 –Design Space ................................................................................................... 6
Section 2.3 – Inputs and Outputs ......................................................................................... 7
Chapter 3 – Make ANN with NEUROET ......................................................................................... 8
Chapter 4 – Execute code .......................................................................................................... 11
Section 4.1 – Input Files ..................................................................................................... 11
Section 4.2 – Metamodel commands - Results .................................................................. 12
Chapter 5 – Saving the results ................................................................................................... 18
Section 5.1 – Save the results to the internal memory ...................................................... 18
Section 5.2 – Export memory into a text file ....................................................................... 19
Chapter 6 – The Options panel (Verify results) ........................................................................... 21
Section 6.1 – Manual value input ....................................................................................... 21
Section 6.2 – Manual curve input ....................................................................................... 22
Chapter 7 – The variables .......................................................................................................... 23
Section 5.1 – Relevant functions ........................................................................................ 24
Section 5.2 – Relevant variables ........................................................................................ 25
Chapter 6 – RIoMP scope ........................................................................................................... 26
Acknowledges and Contact ......................................................................................................... 27
Appendix A – The Latin Hypercube Sampling ............................................................................. 28
Appendix B – Prepare the Input file (detailed) ............................................................................ 30
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 2
Advices from author
This code is based on the methodology of Gutierrez et. al 1 , mainly for the
nanoindentation experiment’s parameters identification.
Consider checking Neuroet user guide for the creation of ANN’s. RIoMP works hand-to-
hand with Neuroet.
About the ANN features, this code works for any number of hidden neurons, and up to
15 parameters (or input variables).
Hardware requirement is: basic. It is recommended to use computers with processor
superior to Intel core2duo for a faster performance.
Chapter 1 – Requirements
Be sure to prepare the next software on your computer:
1. R Statistical Computing http://www.r-project.org/
Once you install R statistical environment software, it will be necessary to install the following
packages (or libraries).
i. tcltk (usually included in the basic installation)
ii. Tkrplot (manually installed)
iii. DEoptim (manually installed)
iv. lhs (in case you require the Latin Hypercube Sampling function of Appendix A)
2. Neuroet (.jar files)
For the case of Neuroet, a proper installation process is not required; however, Java Runtime
Environment 6 is needed to run Neuroet. JRE 6 is not available from www.oracle.com anymore.
If you are using windows, find the jre6.exe provided together with this guide (both 32 bits
version and 64 bits versions are available).
1 Gutierrez L., Li H., Toda H., Kobayashi M., Kuwazuru O. and Batres R., “A Method for the
Identification of mechanical properties using Surrogate Models”, International Journal of Computer Theory and Engineering , IJCTE Vol. 6, No. 3, 2014
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 3
Chapter 2 – Prepare files Since RIoMP has the objective to function from the results produced by other programs, a
correct preparation of those results into files is fundamental to this methodology. In this
chapter it is shown how to manage the basic 6 files required to run the program.
In order to ease the understanding of the user, it is provided 4 example sets. Each of those 4
folders contains at least the 6 files that we are going to describe in this section. Please use
them freely.
The file list is as follows:
1. Experiment result – Experimental response (see Section 2.1)
2. Inputs – Parameters (see Section 2.2)
Requirements 1: Installing packages
For installing any package in R statistical environment software, click in the menu “Packages”
and select “Install packages (s)”. If this is the first time you install a package, a list of CRAN
mirrors (servers) appears. Select the nearest geographical location and click “OK”. Finally, click
on the package which you want to install and select “OK”.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 4
3. Output – Simulation Response (see Section 2.2)
4. biases – Biases used for the ANN (see Section 2.2)
5. weights – Weights used for the ANN (see Section 2.2)
6. Design Space – Range of parameters in which the program searches for the optimum
solution (see Section 2.3)
The files are .txt format (tab separated) because they mostly contain data organized in columns
and rows. The origin of these files is varied: some of them have to be adapted from other data
results (Inputs and Outputs), others no need user intervention at all (biases and weights), and
finally some must be created manually by the user (Design Space).
The flow chart shown below describes the “File Management” process during the project.
An important concept about RIoMP is that it is designed to extract a lot of implicit information
from the files.
Prepare Files 1: File management
MARC simulation software provides the simulation results. These results are manually adapted to
Inputs and Output files and submitted to train the ANN in Neuroet. The same files are later used for
optimization in RIoMP. The biases and weights represent the equation of the ANN, RIoMP can
ensemble these files automatically. The Experiment file contains data of the real experiment results.
Finally, the Design Space has to be created manually by the user.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 5
The headers in each file are very important. For example, the code will identify that
“Displacement” is the independent variable because it is the only variable which appears in
three files: Experiment results, the ANN Inputs, and the Design Space. Therefore, if the column
titles in each of these files are not the same, the code won’t be able to recognize the variables;
eventually, it will result in an error.
Very Important: Make sure that the HEADERS of the columns which represent the same
concept (for example “Displacement”) are identical among the files. Unfortunately, spaces or
especial characters are also not allowed. This is to say:
Does not work Use the same: It works!
Displacement column title in
Experiment results file Displacement nm Displacement_nm_
Displacement column title in
Neural network Inputs file Displace%[nm] Displacement_nm_
Displacement column title in
Design Space file Displacement_nm_ Displacement_nm_
A symptom that you are using different titles is when R console shows messages related to the
data frame of some internal variables, such as:
Error in `[.data.frame`(experiment, , outvars) :
undefined columns selected
When you type in the console: “experiment”, “outvars” or “invars” (names of some internal
variables) you will be able to verify the headers that the program has captured from your files.
Biases and weights files do not require a header.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 6
Section 2.1 – Experimental Response files
This is an example of the Experiment response file:
Section 2.2 –Design Space
To perform an efficient computer experiment, according to Gutierrez et. al., DACE encourages
the usage of techniques such as the Design Space (DS) of parameters values. From inside of
that DS we will choose 4 to 8 sets of parameters values to build the ANN. (See also Latin
Hypercube Sampling (LHS) in Appendix A). In this section we will focus on the Design Space.
This is an example of the design space file:
Prepare files 2: Experiment
(a) Left: A screenshot of the file which contains the experimental numerical values.
(b) Right: A plot of the data contained in the file described in (a).
The Experiment response file usually has only two columns: the dependent variable, and the
independent variable of the experiment. Be sure to remove any uncertainty in the data or any
additional information you think is not necessary.
Prepare files 3: Design Space
This file contains as many columns as variables needed, so you can use the same columns as
the Inputs file described in section 2.3. For each column, it is necessary to specify a minimum
and a maximum values in which you are willing the optimization algorithm to search.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 7
The order of the columns of the design space depends on the order of the columns in the
Inputs file. You can choose, however, whether to put the minimum value at the top and the
maximum at the bottom, or vice versa.
*Note: For the cases of “Displacement” and “Binary” columns, the range is implicitly given in the
Input file so it is not necessary to specify a range at all. Any value is fine for these columns, e.g. 0.
Section 2.3 – Inputs and Outputs
Simulation results are obtained for each of the sets of values in the LHS. These results must be
organized in two files: The Inputs and Output.
These are examples of the Inputs and Output files:
The Appendix B of this guide explains in detail how to prepare the inputs and outputs. Roughly,
you need three steps:
1. Rearrange the simulation response data: put the inputs (Displacement variable) in one file
and the outputs (Load variable) in another one.
2. Add one column for each material parameter, and put their corresponding value in each
row.
3. Define the “loading” and “unloading” sections of the curve. To do this, introduce a Binary
column, this is, for all the rows belonging to the “loading” section put a “0”, and for all
rows belonging to the “unloading” section put a “1”. A spreadsheet application might be
useful to complete this task.
Prepare files 4: Inputs and Outputs
The Inputs file (left side of the picture) has several columns, and the Output file (right side) has
only one column.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 8
Chapter 3 – Make ANN with NEUROET This chapter is a quick guide for creating Artificial Neural Networks (ANN’s) using Neuroet
program with the minimum requirements2.
If this is the first time to run the application, first be sure to install java runtime environment
version 6 on your computer (see Chapter 1). Then, copy the nn.jar and or124.jar files to your
computer. For example, in my computer these files are located in the path:
C:\Users\Leo\neural_net\nn.jar
C:\Users\Leo\neural_net\or124.jar ,
which means that I must run the code from the path C:\Users\Leo\neural_net\ .
After writing the executing java command and pressing <enter> key, a short message will be
displayed: “Starting up, Ready to rock!”. The Neuroet interface will appear:
2 If you are interested in how to elaborate more complex ANN’s don’t hesitate to take a look on the
manual for “Neuroet: a simple artificial neural network for scientists”; an application from professor
Peter A. Noble from University of Washington Seattle.
Make ANN’s 1: Run Neuroet
In windows, execute the command application cmd.exe. Then, find the Neuroet files directory
and type the next command line:
java -cp "./nn.jar;./or124.jar" neuroet.Startup
Note: If you are using a different OS: java -cp "./nn.jar:./or124.jar" neuroet.Startup
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 9
Finally, to train your ANN follow the next three steps:
1. Load the Inputs file and the Outputs file from the tab “Train Network”.
2. Configure the neural network training options from the panel Edit>Preferences.
Make ANN’s 2: Configure Neuroet
The required configuration of NEUROET is as follows:
From the Edit menu select Preferences and configure the panel as shown above. This
configuration guarantees the best compatibility with RIoMP code.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 10
The fields marked as “Optional” can vary depending on the following criterions:
a) Number of Hidden Neurons – In the indentation problem, good results have been
achieved with numbers between 6 ~ 12. 8 HN’s has demonstrated to have powerful
pattern recognition. It is also possible to find several options to find the optimized HN’s
of the ANN; the tab Optimize Hidden Neurons performs a statistical analysis to help you
choose the best number of HN.
b) Training Method – For the indentation problem, results quality has been achieved in
the next order: Standard Backpropagation (best), Levemberg-Marqardt (good), and
Conjugate Gradient (not good at all).
c) Threshold – This option controls when the training step must be stopped. Neuroet
calculates the statistical r-squared (correlation coefficient) of the error between the
ANN prediction and the original training output. A perfect fit would be when r-squared
equals to 1, so if the “Threshold” option is set to 1.0, the program will continue training
the ANN until the ANN error shows no improvement. In many situations the value of 1.0
is very hard to reach. However, for the case of the nanoindentation research it is
common to get values over 0.97.
d) Keep Best Generalizations – If this option is unchecked, one single ANN can be
obtained. When this option is checked, 100 ANN’s are trained at once and categorized
automatically into 10 sub-folders; each one contains the best result for every 10 ANN’s.
Once the preferences are set, continue to the third and last step.
3. Train the ANN, and obtain the Biases and Weights.
Prepare files 5: Biases and Weights
This is an example of the biases and weights files:
To obtain the Biases and Weights of the ANN, you can do the next:
i. Train the ANN by pressing the “Train Network” button in the Neuroet interface.
ii. Save the results file in your computer.
iii. Find the “bias.txt” and the “weights.txt” files.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 11
Chapter 4 – Execute code Open the R programming environment and install the needed libraries (see Chapter 1). Do a
copy-paste of the RIoMP code in the R console. The main interface of R-IOMP appears
automatically.
The user interface has 6 sections:
1. Input Files – Section for loading the input files.
2. Metamodel commands –Commands for making the optimization and infill sampling.
3. Results – Some numerical results and feedback information.
4. Options – Visualize RMSD of Plotted curve, manually inputted parameters and curves.
5. Active Memory – Slots of memory in for saving results after every optimization or infill.
6. Display – Screen for showing the current plot and other log messages.
Section 4.1 – Input Files
This part of the interface is used for loading the input files prepared in last sections. Be sure to
prepare them correctly and load them in order. Some of the common mistakes you might have
are:
o Error 1: Headers which describe same type of column are not identical. Even spaces
are not allowed in the headers name.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 12
o Error 2: Additional “invisible” rows and columns at beginning or end of the file. You can
delete additional columns or rows using spreadsheet software, such as Excel.
o Error 3: different extension. It is necessary to save your files with the extension .txt (tab
separated).
The next image shows the aspect of the interface after loading the files.
Section 4.2 – Metamodel commands - Results
This part of the interface represents the methodology of the Identification of Mechanical
Properties using ANN’s. The code executes the methodology in steps:
I. Step 1: Experiment – Plots the original curve of the Experiment input.
II. Step 2: Find regression – Plots the original curve versus another two power law curves.
The coefficients for both power-law curves are shown in the “Results” section of the
interface based on the next formula:
A maximum displacement is calculated by assuming an intersection between the two
power-law-curves:
III. Step 3: Calibrate – Calculates the calibration and re-plots the adjusted curves.
Interface 1: Input Files
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 13
Interface 2: Metamodel Commands (Find Regression & Calibration)
(Up) After pressing “Find Regression” button, the coefficients for the regression curves are shown in
the “Results” section. The program shows a plot of two green dotted-lines representing the regressed
curves. (Down) When the “Calibration” button is pressed, the green lines become solid and the whole
system is displaced to match the Input’s maximum displacement (calibration process). The
calculated calibration is shown in the “Results” section.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 14
IV. Step 4: Read ANN – Assembles the weights file and biases file. This command allows
you to produce random ANN’s and verify roughly the performance of the previously
trained ANN (Neuroet).
V. Step 5: Optimize – Finds the optimum fit between the calibrated curve and a prediction
given by the ANN’s Design Space.
When you press the “Optimize” button the code searches for the best combination of
parameters that generates a prediction which fits the original experiment curve. That
fitted curve is plotted in blue color. In the ideal case this curve overlaps the green line
(the regression), and also the red curve (the original experiment).
Note that by this time, all the fields in the “Results” panel are filled. After the
optimization step, the field “Objective F.” contains the objective function result from the
optimization algorithm. This number has no physical meaning and it is used only as a
referrence. Note that in the “Options” panel (right side of RIoMP GUI interface) the
RMSD point-by-point is shown, RMSD has a physical meaning and it might be important
for the final results.
Interface 3: Metamodel Commands (Read ANN)
When pressing the “Read ANN” button, a random prediction is plotted and compared with the
calibrated experiment curve. In the “Options” panel right side of the interface, the code automatically
calculates RMSD “point by point”.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 15
Step 5.1: Optimizer “Objective Weights”
The user can choose to modify the weights of the objective function of the optimization
algorithm. This objective function is based in three different curve features: “match the
tips”, “match the area below the curves” or “match the curves point by point”. Shimizu
et. al3 explains that “it is desirable to make the optimal solution adapt dynamically
according to the deviation of parameters and/or changes of the environment.”, which
motivates the idea of including a program function that helps the user to focus on
certain features of the curve that are considered as relevant. Shimizu continues saying
that “For various reasons, however, such a dynamic adaptability is not easy to achieve.”
Sometimes you will need several trial optimizations until you achieve the results you
need.
For example, the next image shows the default values in the section for “Objective
Weights” <Tips:0.1>, <Point:0.8> and <Areas:0.1>:
3 Shimizu Yoshiaki, Zhang Zhong & Batres Rafael, “Frontiers in computing technologies for
manufacturing applications”, 2007 Springer-Verlag London Limited, Chapter 2.5.1.
Interface 4: Metamodel Commands (Optimize)
The “Optimize” function searches inside the Design Space for the best combination of
parameters that matches the prediction and the original experiment. When the computer
completes the optimization algorithm then 1) the prediction is plotted, and 2) the plot image is
automatically copied to the clipboard.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 16
These values stand for the next formula:
| | Where:
is the weight of the error between the tips of both curves. This aims to fit the
maximum value of the dependent variable “Loads” from both the original
experiment and the prediction curves.
is the weight of the error between both curves calculated point by point.
This aims to fit the curves using a simple RMSD (Root mean-squared
deviation).The disadvantage of this method is that if the data is too noisy or has
a clustered distribution, the optimization algorithm may intend to fit certain
regions that could not be relevant for the user.
is the weight of the error between both curves calculated by integrating the
curves and comparing the areas. This is encouraged by the idea that when the
number of points is very huge (e.g. >1000) an RMSD can be replaced by the
error between the area below the curves. This helps to reduce the noise or
clustering of some regions of the dataset. However, this method might be
inaccurate in some cases in which the data clustering does matter.
In a more sophisticated context, the “Objective Weights” feature also helps the user to
keep a “balance” between the scale of the units, the size of the dataset and the
magnitude of the error.
VI. Step 6: Infill Sampling – Calculates an infill point using the Infill Sampling Criterion (ISC)
proposed by Li et. at4. This method suggests adding a point that potentially increases
the accuracy of the ANN prediction. The ISC is designed to find the “weak” parts of the
current ANN. It is high recommended to calculate an infill point and run the entire
methodology again. The ISC, in general, ensures that the ANN prediction and the
simulation response remain consistent.
During each step, the program displays control messages which guide user through the entire
process. You have the option to follow up your progress by looking at the “message” entry in
the lower frame of the interface. Also, for some simple mistakes, RIoMP code has a simple
error-detection system through pop-up windows. However, you may find some typical difficulties,
such as the next ones:
4 Li H., Gutierrez L., Toda H., Kobayashi M., Kuwazuru O. and Batres R., “A numerical evaluation of an
infill sampling criterion in artificial neural network-based optimization”, International Journal of Computer Theory and Engineering, IJCTE Vol. 6, No. 3, 2014
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 17
(This is a continuation of section 4.1’s list of most common errors)
Error 4 – Execute steps in order. Try to follow the command steps starting from 1 to 6.
Error 5 – Long time waiting. Try to keep an eye on the R main console in order to detect
any missing element. Sometimes the algorithm cannot run because there is something
wrong or missing in the input files. Generally, errors and other messages are displayed
in R console in blue:
This error is also explained in Chapter 2.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 18
Chapter 5 – Saving the results This chapter explains how to save, visualize, and export the results obtained during the
parameters optimization and infill sampling point calculation. In general, there are two different
ways for saving your results. The first method is temporal, this is to save the program results in
the internal memory (Section 5.1); and the second one is permanent, this is, to export the
memory into an editable file (Section 5.2).
Section 5.1 – Save the results to the internal memory
Execute steps 5 or 6 of the section 4.2. You might notice that the values of the material
parameters are still not visible, so in order to see them, select any of the 9 slots of memory in
the right panel of the GUI of RIoMP and press the button “Save Optimum” for the case of an
ANN prediction optimization (section 4.5, step5), or press the button “Save Infill” for the case
of an Infill Sampling optimization (section 4.5, step5). Now, press “Data” to visualize the saved
values.
Interface 5: Saving your Results
The numerical values of the optimum parameters are initially stored in a common variable. This
common variable works like in a bus network which carries information from function to function
within the program. This means that if you decide to run a new process, the values generated by the
former optimization will be automatically deleted. However, this common variable can be “copied” to
a temporary memory by pressing the “Save Optimum” or “Save Infill” buttons.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 19
Section 5.2 – Export memory into a text file
As it was explained in the section 5.1, the numerical results can be stored in a temporary
memory so that the user can access to this information any time within the current session. If
you decide to close the program or restart it then the information won’t be available anymore.
In this case, what can be done is to export the information contained in the memory slots into
an editable text file.
RIoMP has a function called “Export Memory” in the lower tab of the program interface. To
export the data saved in the slots, just press the “Export Memory” button, then open the
generated file with any spreadsheet software.
The results file will look something like this:
Tip: In order to remove the quotation marks (“”) in your results file, you can open it once
by using Microsoft Excel, save it and open again in any text editor. You will see that the
quotation marks are gone.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 20
In general, the results file will contain the next information:
(Row 1) Date in which the file was created.
(Row 3 & 4) The general information about the experimental input/output names,
number of inputs, the ANN number of hidden neurons, and the calibration value.
(Row 8 ~) The data of each of the 9 slots available.
For example, the image shown in Interface 6 is a results file created from an Active Memory
with only three used slots. From row 9 it can be appreciated that the Slot1 is type “ANN
optimum”, this means that Slot1 contains a material parameters optimization. The second
slot’s type is “Infill Point” which stands for an ISC point calculation. The last slot used in this
example is the Slot 3 and the other memory slots are empty.
Interface 6: Exporting your results
The button “Export Memory” produces a .txt file which can be opened using a spreadsheet software.
The document is organized in rows and columns containing some information gathered during that
session.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 21
Chapter 6 – The Options panel (Verify results) The options panel has two objectives:
(a) To manually input values for comparing against the experiment.
(b) To manually input another curve for comparing against the experiment. For example,
when you want to see how well a simulation fits your results.
Section 6.1 – Manual value input
To manually load parameters first you have to execute the metamodel commands (section 4.2)
until the step 4 (Read-ANN). Once the program ensembles the ANN you are ready to predict any
combination of inputs. You can take the same file as used for the Design Space in Section 2.3
and input manually the parameters values which you want to predict:
Load your manual_input file in the “Manual Param.” entry and press the “View plot” button.
You will see an ANN created from those values, and additionally you can compare it against the
experimental curve. Also you will see that the “Manual RMSD” field now contains the root-mean
square deviation (RMSD) value of the predicted curve versus the experiment curve.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 22
Section 6.2 – Manual curve input
When we want to compare visual and numerically a simulation vs. an experiment, or an
experiment vs. another experiment, then this function could be useful. Load the simulation
results in the same format as the experimental response in section 2.1; use the same titles
and columns.
Be sure to execute the metamodel commands (section 4.2) until the step 4 (Read-ANN). Then,
load the simulation file and press either the “Sim.” button next to the “Step1 – Experiment” or
the one next to the “Step3 – Calibration” in the metamodel commands panel. If you press the
first one, you will see a raw comparison of the simulation versus the experiment. When you
press the second one, the comparison is done by first calibrating the experiment. Finally, you
will see the root-mean squared deviation (RMSD) in the field “Simul.RMSD” of the Options
panel.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 23
Chapter 7 – The variables After you get used to RIoMP interface commands, you may notice that there are other
possibilities of handling the information directly from the R console. If you get stuck at some
point using the GUI of RIoMP, then you may find useful to call or modify manually any variable
of the program.
In the next two examples, I would like to describe how to visualize manually some of the
important concepts that we have worked out along this user guide.
I. Call variables which contain results
The variable which contains the parameter values after the optimization step is:
XVector # The optimum Vector
After making an optimization, if you type XVector in the R console you will get something like
this:
This vector doesn’t contain any information about the name of the variables but we know
they belong to the same parameters from the inputs described in section 2.2. So in order to
verify the names of each of the 6 values you can type invars.
II. Execute functions
When you produce an ANN, the thing you can see in the RIoMP GUI is the plot of the ANN
prediction. However this plot is a representation of numerical values which are not
available from the interface. If you want to know what the values plotted are, then you can
do two things: (1) type the variable which contains the ANN’s vector, or (2) run a function
which returns an ANN prediction containing these values.
Let’s create an ANN using the vector described in the previous example: XVector. As we
already know, XVector contains the optimum values. We can generate an ANN using the
next function:
neuralnet.f (x) # Building neural network based in a vector of values
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 24
Now replace x with the variable needed:
It is possible to put any other vector inside. Just be sure that the vector you put is
congruent with the number of inputs. You can create manually a vector like this:
myvector <- c(1,2,3,4,5,6)
The RIoMP code is written in .doc format so any user can explore and navigate the document.
Inside the code there is a long list of functions which can be visualized on the Navigation panel
(select the option Navigation Panel from the “View” panel of Microsoft Word).
To conclude this chapter, the next two sections contain a list of some of the most relevant
functions and variables.
Section 5.1 – Relevant functions
Functions with a parameter x that can be replaced always by XVector
Oneuralnet.f (x) Build ANN using a vector x of inputs. The size of
the resulting vector is as big as the Experimental
file number of inputs.
neuralnet.f (x) Build ANN using a vector x of inputs. The size of
the resulting vector is 500 entries.
area.num.f (x) Calculates the numerical integration of an ANN
generated by using a vector x of inputs.
calculate.RMSD.f (x) Calculates the RMSD of an ANN built using a vector
x of inputs.
Functions that doesn’t need a parameter
generate.x () Generates a random vector of inputs. This vector is
saved as the variable xx.
area.int.f () Calculates the integration of the experimental
curves.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 25
Section 5.2 – Relevant variables
Files ---------
experiment # The experimental file with Title
inputNN # Vector of inputs used to train NN with Titles
outputNN # Vector of outputs used to train NN with Titles
biasesNN # Vector of biases including output bias
weightsNN # Vector of hidden neurons
weights2 # Vector of output neurons
ninputs # The number of total inputs
nneurons # The number of neurons
exper # Experimental file directory and name
expvars # Names of the experimental variables
invars # Names of the input variables
outvars # Name of the output variable
mainvar # Name of the main variable (eg. Displacement)
Onn # Length or number of the (original)data input vector
inputa # Inputs of the load section
inputb # Inputs of the unload section
outputa # Outputs of the load section
outputb # Outputs of the unload section
Regression ------
optimA1 # Regression, coefficient A for load
optimC1 # Regression, coefficient C for load
optimn1 # Regression, coefficient n for load
optimA2 # Regression, coefficient A for unload
optimC2 # Regression, coefficient C for unload
optimn2 # Regression, coefficient n for unload
topa # The top value (tip)of the curve of the ANN prediction
Calibration ------
calC1 # Calibrated parameter C1 (Replaces optimC1)
calC2 # Calibrated parameter C2 (Replaces optimC2)
calibration # Calibration value
maxcal # The value which the program intends to calibrate
vector_1 # New “clean” vector of values for inputs load
vector_2 # Proportional vector of values for inputs unload
nn # Number of total rows of both the new “clean” vectors
intersection # The experiment calculated tip by regression
Neural Network ------
MMvalmat # Matrix of number of inputs
Mini # Matrix of inputs minimums
Mino # Matrix of outputs minimums
Maxi # Matrix of inputs maximums
Maxo # Matrix of outputs maximums
Minput # The main input vector
Binary # The binary vector
binary_is # Location of binary vector in the inputs
main_is # Location of main vector in the inputs
VARS # The current/optimized evaluated vector of inputs
xx # Is a vector of random inputs within the design space
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 26
Optimization ------
area.int # The area of the curve by algebraic integration
area.num # The area of the curve by numeric integration
XVector # The optimum Vector
Infill sampling ------
InfillX # The current vector for Infill
Memories ------
SM1 # Slot memory 1 – optimized values)
SM2 # Slot memory 2 – optimized values
SM3 # Slot memory 3 – optimized values
SM4 # Slot memory 4 – optimized values
SM5 # Slot memory 5 – optimized values
SM6 # Slot memory 6 – optimized values
SM7 # Slot memory 7 – optimized values
SM8 # Slot memory 8 – optimized values
SM9 # Slot memory 9 – optimized values
Chapter 6 – RIoMP scope This version was fully designed for the Indentation Method. Nevertheless, RIoMP methodology
can be extended to diverse problems.
Imagine that you want to find the parameter values not for a curve composed by two
complementary curves (such as the Load and Unload in the indentation problem). Let’s say
that you want to find a curve made by a single line:
However, the RIoMP is designed for working with a Binary column, which functions for the
indentation curve, so the code needs to identify two curves as inputs. You just probably need a
bit of creativity on how you prepare your input files. For example consider a problem like this:
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 27
So you need to predict only the curve which name is “Real Output”. Intentionally, one column
(Binary) and additional rows are added manually. Then, the last two additional rows in the
picture represent a simple linear “fake function” which has no real importance. Keep in mind
that the Binary column helps the ANN software (Neuroet) to “build” separated patterns for each
Real and Fake curves.
Finally, if you decide to try an experiment such as the example shown here, then consider the
next states as very important:
The lines should intersect only once and in the upper limit.
The curves should be able to be regressed with the power law or a simpler form of it.
RIoMP is not fully tested to work for curves containing negative values.
The fake function should be short and simple. Take into account that few values have a
small weight in the moment of the optimization so it actually will not affect.
Acknowledges and Contact
I would like to thank professor Batres, Dr. Li and professor Kuwazuru for they support and
collaboration with the creation of this software.
This code is for scientific purposes.
For any further contact, email to [email protected] , or contact the laboratory of our
Industrial Systems Engineering group from Toyohashi University of Technology in its webpage:
http://www.sc.pse.tut.ac.jp/index-e.html
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 28
Appendix A – The Latin Hypercube Sampling The Latin Hypercube Sampling (LHS) is a technique of the Design and Analysis of Computer
Experiments (DACE) discipline. In Sacks et. al5, the LHS is described as “an extension of
stratified sampling which ensures that each of the input variables has all portions of its range
represented”. The lhs package of R statistical environment includes several types of LHS. The
LHS used in this research is the Optimum LHS (OLHS) proposed by Stocki6, whose algorithm is
already contained in the function optimumLHS of the lhs package.
The LHS reference manual is available on the R site:
http://cran.r-project.org/web/packages/lhs/lhs.pdf
The next is the code for generating an OLHS with 8 sampling points, 4 parameters and a design
space like this:
START CODE:
# Load the library for LHS
library (lhs) # Load the library for LHS
# set.seed(1234) # remove the ‘#’ if you want to get the same results as this example
LHS8 <- optimumLHS(8, 4, 5, .05,TRUE) # Generates the LHS with 8 partitions and 4 replications
LHS8 # Show the results of the LHS
# Create an individual matrix of 1’s
I8 <- matrix(1,nrow=8,ncol=1) # Make a matrix with 8 partitions to contain the scaled values of next step.
# Scale LHS to the design space values in individual columns
ELHS8 <- ((LHS8[,1]*(150-50)+50)*I8) # Scale the first column of the LHS to fit the DS for the param. E
CLHS8 <- ((LHS8[,2]*(1000-500)+500)*I8) # Scale the first column of the LHS to fit the DS for the param. C
nLHS8 <- ((LHS8[,3]*(0.3-0.1)+0.1)*I8) # Scale the first column of the LHS to fit the DS for the param. n
aLHS8 <- ((LHS8[,4]*(0.002-0)+0)*I8) # Scale the first column of the LHS to fit the DS for the param. a
5 J. Sacks, W. J. Welch, T. J. Mitchell and H. P. Wynn,”Design and Analysis of Computer Experiments”,
Statistical Science, Volume 4, Issue 4 (Nov. 1989), 409-423. 6 R. Stocki, “A method to improve design reliability using optimal Latin hypercube sampling”, Computer
Assisted Mechanics and Engineering Sciences 12, 2005, 87-105
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 29
# Put all the columns together in the same matrix
theLHS8 <- array(1,c(8,4)) # Make the matrix that will contain each column
theLHS8[,1] <- ELHS8 # Attach the column of the parameter E
theLHS8[,2] <- CLHS8 # Attach the column of the parameter C
theLHS8[,3] <- nLHS8 # Attach the column of the parameter n
theLHS8[,4] <- aLHS8 # Attach the column of the parameter a
theLHS8 # See the final Design Space
END CODE
The result of this code is an optimum LHS like this:
[,1] [,2] [,3] [,4]
[1,] 103.80840 594.2067 0.2795274 0.0014399177
[2,] 127.51560 641.1756 0.2498038 0.0002018381
[3,] 144.41667 790.4004 0.1577956 0.0016554548
[4,] 66.62213 718.8748 0.1919274 0.0018712478
[5,] 78.04911 547.8412 0.1268445 0.0005774217
[6,] 96.46590 906.5341 0.1038250 0.0011259834
[7,] 118.67451 984.4500 0.2043662 0.0004620981
[8,] 60.81042 815.1161 0.2579296 0.0007534375
The first column represents the parameter “E” of the design space and it contains values
between 50 and 150, the second columns represents “C” and it has values between 500 and
1000, the third column represents “a” which has values between 0.1 and 0.3, finally, the last
column represents the parameter “n” and it has values between 0 and 0.002.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 30
Appendix B – Prepare the Input file (detailed) The Input file is probably the most important of the files used in RIoMP methodology. The
inputs file contains implicit information about:
the simulations results
the parameters configuration (LHS)
the maximum displacement and load
Let’s start from obtaining the simulation results and putting them in two columns in a
spreadsheet:
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 31
Add the parameters to each curve by including a column with the value of each of the
parameters used in that simulation.
Separate the “loading” and “unloading” curves and find maximum displacement. As shown in
the next figure, the “loading” curve contains all the points from displacement X0 to Xmax,
meanwhile the “unloading” curve contains those from Xmax to xf. Finally, Xmax also represents
the maximum displacement.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 32
Add a “binary” column. Put a “0” for those rows that represent the load, and then put a “1” in
the rest. Also, since the maximum displacement point is the intersection of the “load” and
“unload” curves, it must be duplicated.
Find the additional rows or values which has no physical meaning. In the indentation problem,
the last part of the simulation contains values measured when the tip is already not having a
contact with the material, so it is better to delete them. These values are whether negative
values or normally very small.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 33
Copy the values to separates sheets. In one sheet paste those columns which represent the
inputs (Displacement, Parameters and Binary), and in another sheet paste the outputs (Load).
Be sure not to leave blank spaces and to write a single line of headers (see also chapter 2).
It is a good idea to save your document in this moment. Finally, save each sheet as .txt format.
Quick Guide for R-IoMP r1.5 Industrial Engineering Group - TUT Japan
pg. 34
You can use the inputs and outputs files for training your network (Chapter 3) and also for
performing the optimization (Chapter 4).
In the case you need to add a new curve (such as the Infill Sampling), you must create a new
file which includes the previous and the new curves.
RIoMP – For scientific purposes was completed in June 2014.
Toyohashi University of Technology / Industrial Systems Engineering Laboratory