0% found this document useful (0 votes)
15 views85 pages

Advances In Computer Science And Engineering Matthias Schmidt pdf download

The document discusses the book 'Advances in Computer Science and Engineering' edited by Matthias Schmidt, which includes a collection of 23 chapters from various international researchers. The chapters cover topics in applied computing techniques, mechanical and electrical engineering innovations, and applied modeling. The book aims to provide insights into advancements in research and development within the field of computer science and engineering, emphasizing the importance of new approaches to meet modern challenges.

Uploaded by

ariahbeine7e
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views85 pages

Advances In Computer Science And Engineering Matthias Schmidt pdf download

The document discusses the book 'Advances in Computer Science and Engineering' edited by Matthias Schmidt, which includes a collection of 23 chapters from various international researchers. The chapters cover topics in applied computing techniques, mechanical and electrical engineering innovations, and applied modeling. The book aims to provide insights into advancements in research and development within the field of computer science and engineering, emphasizing the importance of new approaches to meet modern challenges.

Uploaded by

ariahbeine7e
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 85

Advances In Computer Science And Engineering

Matthias Schmidt download

https://ebookbell.com/product/advances-in-computer-science-and-
engineering-matthias-schmidt-2134212

Explore and download more ebooks at ebookbell.com


Here are some recommended products that we believe you will be
interested in. You can click the link to download.

Advances In Computer Science And Engineering 1st Edition Shi Ronghui

https://ebookbell.com/product/advances-in-computer-science-and-
engineering-1st-edition-shi-ronghui-4195428

Advances In Computer Science And Engineering 13th International Csi


Computer Conference Csicc 2008 Kish Island Iran March 911 2008 Revised
Selected Papers 1st Edition Mohammad Taheri

https://ebookbell.com/product/advances-in-computer-science-and-
engineering-13th-international-csi-computer-conference-
csicc-2008-kish-island-iran-march-911-2008-revised-selected-
papers-1st-edition-mohammad-taheri-4201550

Advances In Computer Science And Engineering Schmidt Matthias

https://ebookbell.com/product/advances-in-computer-science-and-
engineering-schmidt-matthias-232438336

Advances In Computer Science And Information Technology Computer


Science And Engineering Second International Conference Ccsit 2012
Bangalore India January 24 2012 Proceedings Part Ii 1st Edition
Devendra Kumar Sharma
https://ebookbell.com/product/advances-in-computer-science-and-
information-technology-computer-science-and-engineering-second-
international-conference-ccsit-2012-bangalore-india-
january-24-2012-proceedings-part-ii-1st-edition-devendra-kumar-
sharma-4522406
Advances In Computer Science And Information Engineering Volume 2 1st
Edition Zhengwei Zhu

https://ebookbell.com/product/advances-in-computer-science-and-
information-engineering-volume-2-1st-edition-zhengwei-zhu-4096694

Advances In Computer Science And Information Engineering Volume 1 1st


Edition Guiping Dai

https://ebookbell.com/product/advances-in-computer-science-and-
information-engineering-volume-1-1st-edition-guiping-dai-4635852

Recent Advances In Computer Science And Information Engineering Volume


2 1st Edition Yuekai Wang

https://ebookbell.com/product/recent-advances-in-computer-science-and-
information-engineering-volume-2-1st-edition-yuekai-wang-4106874

Recent Advances In Computer Science And Information Engineering Volume


6 1st Edition Zhang Yanxiang Auth

https://ebookbell.com/product/recent-advances-in-computer-science-and-
information-engineering-volume-6-1st-edition-zhang-yanxiang-
auth-4106876

Recent Advances In Computer Science And Information Engineering Volume


5 1st Edition Wang Ning

https://ebookbell.com/product/recent-advances-in-computer-science-and-
information-engineering-volume-5-1st-edition-wang-ning-4106878
ADVANCES IN COMPUTER
SCIENCE AND ENGINEERING
Edited by Matthias Schmidt
Advances in Computer Science and Engineering
Edited by Matthias Schmidt

Published by InTech
Janeza Trdine 9, 51000 Rijeka, Croatia

Copyright © 2011 InTech


All chapters are Open Access articles distributed under the Creative Commons
Non Commercial Share Alike Attribution 3.0 license, which permits to copy,
distribute, transmit, and adapt the work in any medium, so long as the original
work is properly cited. After this work has been published by InTech, authors
have the right to republish it, in whole or part, in any publication of which they
are the author, and to make other personal use of the work. Any republication,
referencing or personal use of the work must explicitly identify the original source.

Statements and opinions expressed in the chapters are these of the individual contributors
and not necessarily those of the editors or publisher. No responsibility is accepted
for the accuracy of information contained in the published articles. The publisher
assumes no responsibility for any damage or injury to persons or property arising out
of the use of any materials, instructions, methods or ideas contained in the book.

Publishing Process Manager Katarina Lovrecic


Technical Editor Teodora Smiljanic
Cover Designer Martina Sirotic
Image Copyright Mircea BEZERGHEANU, 2010.
Used under license from Shutterstock.com

First published March, 2011


Printed in India

A free online edition of this book is available at www.intechopen.com


Additional hard copies can be obtained from [email protected]

Advances in Computer Science and Engineering, Edited by Matthias Schmidt


p. cm.
ISBN 978-953-307-173-2
free online editions of InTech
Books and Journals can be found at
www.intechopen.com
Contents

Preface IX

Part 1 Applied Computing Techniques 1

Chapter 1 Next Generation Self-learning Style


in Pervasive Computing Environments 3
Kaoru Ota, Mianxiong Dong,
Long Zheng, Jun Ma, Li Li,
Daqiang Zhang and Minyi Guo

Chapter 2 Automatic Generation of Programs 17


Ondřej Popelka and Jiří Štastný

Chapter 3 Application of Computer Algebra into


the Analysis of a Malaria Model using MAPLE™ 37
Davinson Castaño Cano

Chapter 4 Understanding Virtual Reality Technology:


Advances and Applications 53
Moses Okechukwu Onyesolu and Felista Udoka Eze

Chapter 5 Real-Time Cross-Layer Routing


Protocol for Ad Hoc Wireless Sensor Networks 71
Khaled Daabaj and Shubat Ahmeda

Part 2 Innovations in Mechanical Engineering 95

Chapter 6 Experimental Implementation


of Lyapunov based MRAC for Small
Biped Robot Mimicking Human Gait 97
Pavan K. Vempaty, Ka C. Cheok, and Robert N. K. Loh

Chapter 7 Performance Assessment of Multi-State


Systems with Critical Failure Modes:
Application to the Flotation Metallic Arsenic Circuit 113
Seraphin C. Abou
VI Contents

Chapter 8 Object Oriented Modeling


of Rotating Electrical Machines 135
Christian Kral and Anton Haumer

Chapter 9 Mathematical Modelling


and Simulation of Pneumatic Systems 161
Djordje Dihovicni and Miroslav Medenica

Chapter 10 Longitudinal Vibration of Isotropic Solid Rods:


From Classical to Modern Theories 187
Michael Shatalov, Julian Marais,
Igor Fedotov and Michel Djouosseu Tenkam

Chapter 11 A Multiphysics Analysis of Aluminum Welding


Flux Composition Optimization Methods 215
Joseph I. Achebo

Chapter 12 Estimation of Space Air Change Rates and CO2


Generation Rates for Mechanically-Ventilated Buildings 237
Xiaoshu Lu, Tao Lu and Martti Viljanen

Chapter 13 Decontamination of Solid and Powder


Foodstuffs using DIC Technology 261
Tamara Allaf, Colette Besombes,
Ismail Mih, Laurent Lefevre and Karim Allaf

Part 3 Electrical Engineering and Applications 283

Chapter 14 Dynamic Analysis of a DC-DC Multiplier Converter 285


J. C. Mayo-Maldonado, R. Salas-Cabrera, J. C. Rosas-Caro,
H. Cisneros-Villegas, M. Gomez-Garcia, E. N.Salas-Cabrera,
R. Castillo-Gutierrez and O. Ruiz-Martinez

Chapter 15 Computation Time Efficient Models


of DC-to-DC Converters for Multi-Domain Simulations 299
Johannes V. Gragger

Chapter 16 How to Prove Period-Doubling Bifurcations


Existence for Systems of any Dimension -
Applications in Electronics and Thermal Field 311
Céline Gauthier-Quémard

Part 4 Advances in Applied Modeling 335

Chapter 17 Geometry-Induced Transport Properties


of Two Dimensional Networks 337
Zbigniew Domański
Contents VII

Chapter 18 New Approach to a Tourist Navigation System


that Promotes Interaction with Environment 353
Yoshio Nakatani, Ken Tanaka and Kanako Ichikawa

Chapter 19 Logistic Operating Curves in Theory and Practice 371


Peter Nyhuis and Matthias Schmidt

Chapter 20 Lütkenhöner’s „Intensity Dependence


of Auditory Responses“: An Instructional Example
in How Not To Do Computational Neurobiology 391
Lance Nizami

Chapter 21 A Warning to the Human-Factors Engineer: False Derivations


of Riesz’s Weber Fraction, Piéron’s Law, and Others
Within Norwich et al.’s Entropy Theory of Perception 407
Lance Nizami

Chapter 22 A Model of Adding Relations in Two Levels of a Linking


Pin Organization Structure with Two Subordinates 425
Kiyoshi Sawada

Chapter 23 The Multi-Objective Refactoring Set Selection


Problem - A Solution Representation Analysis 441
Camelia Chisăliţă-Creţu
Preface

“Amongst challenges there are potentials.“


(Albert Einstein, 1879-1955)

The speed of technological, economical and societal change in the countries all over
the world has increased steadily in the last century. This trend continues in the new
millennium. Therefore, many challenges arise. To meet these challenges and to realize
the resulting potentials, new approaches and solutions have to be developed. There-
fore, research activities are becoming more and more important.
This book represents an international platform for scientists to show their advances in
research and development and the resulting applications of their work as well as and
opportunity to contribute to international scientific discussion.
The book Advances in Computer Science and Engineering constitutes the revised selec-
tion of 23 chapters written by scientists and researchers from all over the world. The
chapters are organized in four sections: Applied Computing Techniques, Innovations
in Mechanical Engineering, Electrical Engineering and Applications and Advances in
Applied Modeling.
The first section Applied Computing Techniques presents new findings in technical
approaches, programming and the transfer of computing techniques to other fields of
research. The second and the third section; Innovations in Mechanical Engineering
and Electrical Engineering and Applications; show the development, the application
and the analysis of selected topics in the field of mechanical and electrical engineer-
ing. The fourth section, Advances in Applied Modeling, demonstrates the develop-
ment and application of models in the areas of logistics, human-factor engineering and
problem solutions.
This book could be put together due to the dedication of many people. I would like to
thank the authors of this book for presenting their work in a form of interesting, well
written chapters, as well as the InTech publishing team and Prof. Lovrecic for their
great organizational and technical work.

Dr. Matt hias Schmidt,


Institute of Production Systems and Logistics
Leibniz University of Hannover
Produktionstechnisches Zentrum Hannover (PZH)
An der Universität 2
30823 Garbsen
Germany
Part 1

Applied Computing Techniques


1

Next Generation Self-learning Style in


Pervasive Computing Environments
Kaoru Ota1, Mianxiong Dong, Long Zheng,
Jun Ma, Li Li, Daqiang Zhang and Minyi Guo
1School of Computer Science and Engineering, The University of Aizu,

Department of Computer Science and Engineering, Shanghai Jiao Tong University


Department of Computer Science, Nanjing Normal University
1Japan

China

1. Introduction
With the great progress of technologies, computers are embedded into everywhere to make
our daily life convenient, efficient and comfortable [10-12] in a pervasive computing
environment where services necessary for a user can be provided without demanding
intentionally. This trend also makes a big influence even on the education field to make
support methods for learning more effective than some traditional ways such as WBT (Web-
Based Training) and e-learning [13, 14]. For example, some WBT systems for educational
using in some universities [1, 2, 9], a system for teacher-learners’ interaction in learner
oriented education [3], and real e-learning programs for students [7, 8] had succeeded in the
field. However, a learner’s learning time is more abundant in the real world than in the
cyber space, and learning support based on individual situation is insufficient only with
WBT and e-learning. In addition, some researches show that it is difficult for almost all
learners to adopt a self-directed learning style and few of learners can effectively follow a
self-planned schedule [4]. Therefore, support in the real world is necessary for learners to
manage a learning schedule to study naturally and actively with a self-learning style.
Fortunately, with the rapid development of embedded technology, wireless networks, and
individual detecting technology, these pervasive computing technologies make it possible to
support a learner anytime and anywhere kindly, flexibly, and appropriately. Moreover, it
comes to be able to provide the support more individually as well as comfortable
surroundings for each learner through analyzing the context information (e.g. location, time,
actions, and so on) which can be acquired in the pervasive computing environment.
In this chapter, we address a next-generation self-learning style with the pervasive
computing and focus on two aspects: providing proper learning support to individuals and
making learning environments suitable for individuals. Especially, a support method is
proposed to encourage a learner to acquire his/her learning habit based on Behavior
Analysis through a scheduler system called a Ubiquitous Learning Scheduler (ULS). In our
design, the learner’s situations are collected by sensors and analyzed by comparing them to
his/her learning histories. Based on this information, supports are provided to the learner in
order to help him/her forming a good learning style. For providing comfortable
4 Advanced in Computer Science and Engineering

surroundings, we improve the ULS system by utilizing data sensed by environments like
room temperature and light for the system, which is called a Pervasive Learning Scheduler
(PLS). The PLS system adjusts each parameter automatically for individuals to make a
learning environment more comfortable. Our research results revealed that the ULS system
not only benefits learners to acquire their learning habits but also improved their self-
directed learning styles. In addition, experiment results show the PLS system get better
performance than the ULS system.
The rest of the chapter consists as follows. In the section 2, we propose the ULS system and
describe the design of the system in detail followed by showing implementation of the
system with experimental results. In section 3, the PLS system is proposed and we provide
an algorithm to find an optimum parameter to be used in the PLS system. The PLS system is
also implemented and evaluated comparing to the ULS system. Finally, section 4 concludes
this chapter.

2. The ULS system model

Fig. 1. A model of the ULS system


Figure 1. shows a whole model of a ubiquitous learning environment. The system to manage
a learning schedule is embedded in a special kind of desks which can collect learning
information, send it as well as receive data if needed, and display a learning schedule. In the
future, it will be possible to embed the system in a portable device like a cellular phone. As a
result, a learner will be able to study without choosing a place.
In Figure 1., there are two environments. One is a school area. In this area, a teacher inputs a
learner’s data, test record, course grade, and so forth. This information is transferred to the
learner’s desk in his/her home through the Internet. The other is a home area. In this area, a
guardian inputs data based on his/her demands. This information is also transferred to the
desk. When the learner starts to study several textbooks, his/her learning situation is
collected by reading RFID tags attached to textbooks with an RFID-reader on the desk.
Based on combination of teacher’s data, parent’s demand, and learner’s situation, a learning
Next Generation Self-learning Style in Pervasive Computing Environments 5

schedule is made by the system. A learning schedule chart is displayed on the desk. The
learner follows the chart. The chart changes immediately and supports flexibly. The
guardian also can see the chart to perceive the learner’s state of achievement.
In this paper, we are focusing on the home area, especially learners’ self-learning at home.
We assume a learning environment is with the condition as same as Figure 1. To achieve the
goal, we have the following problems to be solved:
1. How to display an attractive schedule chart to motivate the learner?
2. How to give a support based on Behavior Analysis?
3. When to give a support?
4. How to avoid failure during learning?
In order to solve the above problems, at first, a method which can manage a learning
schedule is proposed. Its feature is to manage a learning schedule based on combination of
the teacher’s needs, the parent’s needs, and learner’s situation. Its advantage is that the
learner can determine what to study at the present time immediately. Secondly, the ULS is
implemented based on behavior analyzing method. Because behavioral psychology can
offer students more modern and empirically defensible theories to explain the details of
everyday life than can the other psychological theories [9].The function of the ULS is to use
different colors to advise the learner subjects whether to study or not.

2.1 Ubiquitous Learning Scheduler (ULS)


This paper proposes a system called Ubiquitous Learning Scheduler (ULS) to support
learner managing their learning schedule. The ULS is implemented with a managing
learning schedule method. It analyses learning situations of the learner and gives advices to
the leaner. This method solves the problems we mentioned above. Its details are described
in following sections.

Fig. 2. An example of a scheduling chart


Figure 2. shows how to display a learning schedule chart in the ULS. Its rows indicate
names of subjects and its columns indicate days of the week. For instance, a learner studies
Japanese on Monday at a grid where Jpn. intersects with Mon. The ULS uses several colors
to advise the learner. The learner can customize the colors as he/she like. Grids’ colors
shown in Figure 2. is an example of the scheduling chart. Each color of grids means as
follows.
• Navy blue: The learning subject has been already finished.
• Red: The subject is in an insufficient learning state at the time or the learner has to study
the subject as soon as possible at the time.
6 Advanced in Computer Science and Engineering

• Yellow: The subject is in a slightly insufficient learning state at the time.


• Green: The subject is in a sufficient learning state at the time.
As identified above, red grids have the highest learning priority. Therefore, a learner is
recommended to study subjects in an ideal order: red→yellow→green.
The indications consider that accomplishments lead to motivations. There are two points.
One is that a learner can find out which subjects are necessary to study timely whenever
he/she looks at the chart. If a learning target is set specifically, it becomes easy to judge
whether it has been achieved. The other is that the learner can grasp at a glance how much
he/she has finished learning. It is important for motivating the learner to know attainment
of goals accurately.
Basically, the ULS gives a learner supports when he/she is not studying in an ideal order.
For example, when the learner tries to study a subject at a green grid though his/her chart
has some red grids, the ULS gives a message such as “Please start to study XXX before
YYY”, where XXX is a subject name at a red grid and YYY is the subject name at the green
one.

2.2 Supports to avoid failure during learning

Fig. 3. Model of Shaping

Red Yellow Green


Good! You’ve Quite good! You’ve Excellent! You’ve
Compliment
challenged this done basic study for studied this subject
Examples
subject. this subject. quite enough.
Learning Time
(Objective Regard-less of time More than 10 min. More than 20 min.
Time)
Table 1. Example of complements and learning time
The ULS also aims to lead the learner to a more sophisticated learning style than his/her
initial condition. To solve this problem, we used the Shaping principle in Behavior Analysis
[9]. When differential reinforcement and response generalization are repeated over and
over, behavior can be “shaped” far from its original form [9]. Shaping is a process by which
learning incentive is changed in several steps from their initial level to a more sophisticated
level [9]. Each step results from the application of a new and higher criterion for differential
reinforcement [9]. Each step produces both response differentiation and response
Next Generation Self-learning Style in Pervasive Computing Environments 7

generalization [9]. This principle also makes sense in the learning behavior. By referring to
Figure 3., this paper considers red grids as step 1, yellow ones as step 2, and green ones as
step 3. Step 1 is the lowest level. The ULS gives the learner different compliments based on
learning time according to each color. Learning time depends on a learner’s situation. Table
1 shows an example of that. Learning time of yellow and green are based on average of
elementary students’ learning time in home in Japan [4].

2.3 Design of the ULS system

Fig. 4. Model of Shaping


Figure 4. shows a flow chart of the system in this research. A teacher and a guardian register
each demand for a learner into each database, a Teacher’s Demand DB and a Guardian’s
Demand DB. The demands indicate which subject the learner should have emphasis on. Each
database consists of learning priorities and subject names. On the other hand, the learner
begins to study with some educational materials. At the same time, the ULS collects his/her
learning situations and puts them into a Learning Record DB. The database consists of date,
learning time, and subject names. By comparing and analyzing the information of three
databases, the ULS makes a scheduling chart such as Figure 2. and always displays it in
learning. The learner pursues its learning schedule. The ULS gives him/her supports,
depending on learning situations. The guardian can grasp the learner’s progress situation of
the schedule by the ULS supports.
Each grid’s color is decided with calculating Color Value (CV). We define the following
equation for determining CV.

CV = CV0 * LAD + SAD (1)

Each notation means as follows.

CV[−2 ≤ CV ≤ 4] : Color Value (2)


8 Advanced in Computer Science and Engineering

CV decides a color of the current grid and has some ranges for three colors such as red,
yellow, and green. The green range is from -2 to 0, the yellow one is from 0 to 2, and the red
one is from 2 to 4. Also, the value smaller than -2 will be considered as green and bigger
than 4 will be considered as red respectively. For example, when CV equals to 0.5, the color
is yellow. These ranges are not relative to RGB code and are assumed to be set by the teacher
in this research.

CV0[0 ≤ CV0 ≤ 1] : Initial Color Value (3)


CV0 is decided with combination of the teacher’s demand and the guardian’s one. At first,
the teacher and the guardian respectively input priority of subjects which they want the
learner to self-study. Priority is represented by a value from 1 to 5. 5 is the highest priority
and 1 is the lowest one. ULS converts each priority into CV0. CV0 is calculated by the
following equation.

CV0 = (TP + GP ) * 0.1 (4)

In the equation (4), TP and GP mean Teacher’s Priority and Guardian’s Priority respectively.

Jpn. Math. Sci. Soc. HW.


Teacher 5 2 3 4 1

Guardian 5 4 2 3 1

Sum. 10 6 5 7 2

CV0 1.0 0.6 0.5 0.7 0.2

Table 2. An example of a relationship between ranks and CV0


For an example, in Table 2, Math ranks the value as 2 by the teacher and the 4 by the
guardian. Therefore the sum of their priority equals to 6 and CV0 is decided as 0.6.
The learner’s situation also affects CV. We express it as Long-term Achievement Degree
(LAD) and Short-term Achievement Degree (SAD). Both of their values are fixed at the end
of a last studying day.

LAD[0 ≤ LAD ≤ 100] : Long-term Achievement Degree (5)


LAD indicates how much the learner has been able to accomplish a goal of a subject for a
long term. In this paper, this goal is to acquire his/her learning habit. The default value is
100 percent. We assume that the learner has achieved his/her goal when all grids are green.
Then, the LAD value equals to 100 percent. For example, if the number of green grids is 12
where the number of all grids of a subject is 15 at current time, the LAD value equals to 80
percent. The term period is assumed to be set by a teacher. For instance, the term can be a
week, or a month. LAD values are initialized when the term is over.

SAD[−1 ≤ SAD ≤ 1] : Short-term Achievement Degree (6)


SAD indicates how much the learner has been able to accomplish a goal of a subject for a
short term. In this paper, this goal is to study a subject for objective time of a day. The
Next Generation Self-learning Style in Pervasive Computing Environments 9

default value is 0. SAD has particular three values, -1, 0, and 1. These values means as
follows.
1. The learner has studied for no time.
2. The learner has studied for less than objective time.
3. The learner has studied for more than objective time.
Objective time depends on a grid’s color. This idea is based on Section 4.4. For example,
objective time is 10 minutes for red grids, 20 minutes for yellow ones, and 30 minutes for
green ones. At a subject on a red grid, we assume that a learner is not willing to study it.
Therefore, to compliment studying is important, even if the learner studies for only a
fraction of the time. That is why objective time of red grids is less than one of others. If the
learner takes 10 minutes to study a subject on a yellow grid, the SAD value equals to 0. In
this paper, objective time is initialized by the teacher based on the learner’s ability. Since the
learner starts to use the ULS, the ULS automatically has set objective time. The ULS analyzes
average learning time of the learner, and decides it as objective time for yellow grids. The
ULS also analyzes minimum learning time and maximum one, and decides each them as
objective time for red grids and green ones. Therefore, the objective time is flexibly changed
with the learner’s current ability.
Sometimes there are some relationships between the subjects. If the learner studies the
subjects in a meaningful order, it will result a better understanding. Otherwise, the learning
efficiency is down. For example, classical literature (Ancient writings or Chinese writing)
witch is told in traditional Japanese class might require some pre-knowledge about the
history to help learner understanding the contents and meaning well. In this case, it is clear
that the priority of study the subject History is higher than the subject Japanese. Also, it is a
common sense that rudimentary mathematics might be a prerequisites course before science
study. Considering this characteristics, we also define an equation to improve the system,

n
CV 'i = CVi + ( ∑ CVj ) * Pi (7)
j =1
Xi
where, Pi = n
∑Xj
j =1
We improve the CV’ to apply the shaping principle. P means the priority of each subject. In
this paper, we take the teacher’s priority into this formula. Because teachers are more
familiar with the relationships between each courses than guardian and it should has more
weighted to influence the learner.

Jpn. Math. Sci. Soc. HW.


TP 5 4 1 2 3

CV 1.8 1.2 -0.5 0.4 0.8

CV’ 3.03 2.18 -0.25 0.89 1.54

Table 3. An example of relationship between CV and CV’


For example, in Table 3., the teacher set the priorities as (Jpn., Math., Sci., Soc., HW.), (5, 4, 1, 2,
3) respectively. Using the equation (7), we can earn the new priority, for example, Jpn. like:
10 Advanced in Computer Science and Engineering

5
CVJpn.' = 1.8 + (1.8 + 1.2 − 0.5 + 0.4 + 0.8) * = 3.03
(5 + 4 + 1 + 2 + 3)

4
CVMath.' = 1.2 + (1.8 + 1.2 − 0.5 + 0.4 + 0.8) * = 2.18
(5 + 4 + 1 + 2 + 3)

and the same to the other subjects.

2.4 Implementation and evaluation of the ULS system


We implemented the ULS system based on a specialized desk using a laptop PC, which is
connected to a RFID-READER with RS-232C in this research. We use version 1.01 of DAS-
101 of Daiichi Tsushin Kogyo Ltd for RFID-READER and RFID [10]. Programming langrage
C# is used to develop the ULS system. We use Microsoft Access for a Teacher’s Demand DB, a
Guardian’s Demand DB, and a Learning Record DB.
In this research, each class has its own textbook with an RFID-tag. The ULS recognizes that a
learner is studying a subject of which an RFID is read by the RFID-READER. We assume
that as learning time while the RFID-READER reads the RFID.

Fig. 5. Screen shot of ULS


Figure 5. is a screen capture of ULS in this research. It shows a learning scheduling chart for
a student and his/her guardian. Marks indicate that the learning of the subject has been
already finished.
The purpose of the evaluation is as follows:
1. Could the system provide efficient and effective learning style to the learner?
2. Could the system increase the learner’s motivation?
3. Could the system improve self-directed learning habit of the learner?
Through verifying these points, we attempted to find several needs to be improved in this
system.
The method of this evaluation is a questionnaire survey. 20 examinees studied five subjects
with this system for a few hours. Based on their information such as liked or disliked
Next Generation Self-learning Style in Pervasive Computing Environments 11

subjects, Color Value of each subject is initialized. After an examining period, they answered
some questionnaires for evaluating this system. Contents of the questionnaires are as
follows:
Q1: Did you feel this system makes your motivation increase for self-directed learning?
Q2: Did the system provide suitable visible-supports to you?
Q3: Do you think this system helps you to improve your learning habit at home?
Q4: Did you feel this system was easy to use?
Questionnaire Items

Q4 Quite Yes
Q3 Yes
No Opinion
Q2 No
Q1 Quite No

0% 20% 40% 60% 80% 100%


Response Rate

Fig. 6. Result of Questionnaire Survey (1)


Figure 6. shows statistical results of questionnaire survey of only using the equation (1).
Positive responses, more than 80 percent of “quite yes” and “yes”, were obtained from every
questionnaire item. However, some comments were provided in regard to supports of this
system. For example, “It will be more suitable if the system can support for a particular
period such as days near examination.” One of this reasons was the system was designed
focused on usual learning-style.
Questionnaire Items

Q4 Quite Yes
Q3 Yes
No Opinion
Q2 No
Q1 Quite No

0% 20% 40% 60% 80% 100%


Response Rate

Fig. 7. Result of Questionnaire Survey (2)


Figure 7. shows statistical results of questionnaire survey with the equation (7) implemented
in the system. We can see there is a progress especially on the answer “Quite Yes”
comparing with the result only using the equation (1).
12 Advanced in Computer Science and Engineering

3. The new model of the ULS system


3.1 Pervasive Learning Scheduler (PLS)
So far, we propose a support method for self-managing learning scheduler using Behavior
Analysis in a ubiquitous environment. Based on our method, the ULS is implemented.
According to the experiment results, the contribution of the ULS can be summarized as
follows: the ULS is effective to motivate a learner at his/her home study, and the ULS helps
to improve his/her self-directed learning habit with considering his/her teacher’s and
his/her guardian’s request.

School

Input data transfer

Teacher
PC Server
Internet

Home
Temperature

Thermoter light
Light sensor
Transfer data
Oxygen
Refer data
st Control Center
Input data q ue er Oxygen
PC Re sw
An sensor
Guardian ort, Read tags
pp
Su

Study Textbook
Leaner

Fig. 8. The improved model: Pervasive Learning Scheduler (PLS)


We improve this ULS model with considering enviroments surrounding the learner since
the learner could more effecively study in an environment comfortable for him/her. For
example, intuitively it is better for the leaner to study in a well-lighted area than in a dark
one. Figure 8. shows the improved model and we call it as called a Pervasive Learning
Scheduler (PLS). In this research, we only consider an environment at home where sensors
are embedded as shown in Figure 8. These sensors collect corresponding data from the
environment and send it to a control center. The control center decides whether the
corresponding parameters are suitable for the learner and adjusts them automatically. For
example, a learner accustoms himself to a temperature of 26 degree. The current
temperature collected by the sensor is 30 degree. As the control center receives this data, it
makes a decision on adjusting the temperature. We only show three kinds of sensors in the
figure, however; the PLS also can include other several kinds of sensors as users need.
To this end, we have the following problem: how does the control center decide optimum
values for each parameter? In order to solve this, we propose a data training method. Its
feature is to select adaptive step to approach the optimum value.
Next Generation Self-learning Style in Pervasive Computing Environments 13

3.2 Design of the PLS system


In the PLS system, sensors collect data from an environment and send it to the control
center. Based on collected data from a learner’s surroundings, the control center adjusts each
parameter to the optimal value. A problem is how to decide the optimum values by the
control center. As we take a temperature as an example, then the problem can be rephrased
as: how does the control center know the suitable temperature for each individual learner.
You may think that a learner can tell the control center a preferred temperature as the
optimal value in advance. More precisely, however, the learner can only set an approximate
value not exactly optimal one on the system. We solve this problem to train the data based
on the following algorithm.
1. A learner sets the current temperature with a preferred value and sets a step value.
2. The system increases the current temperature by the step value while the learner
studies.
3. At the end of study, the system compares the studying efficiency with a previous one in
a record. If the efficiency ratio increases, go to the phase (2).
4. If the efficiency becomes lower, it shows that the step value is too large, so we should
deflate the value. Divide the step value by 2, then go to the phase (2). Stop after the step
value is less than a threshold value.
5. After find an optimum temperature with the highest efficiency ratio, reset the step
value to the initial one. Repeat the above phases from (1) to (4) except for the phase (2).
In the phase (2), the system decreases the current temperature by the step value.
6. After find another optimum temperature by the second round, compare it with the
optimum temperature we firstly found, and choose the better one according to their
efficiency ratios.
The studying efficiency is derived based on CV’ obtained by the equation (7) in subsection 2.3.
The efficiency E(t) is calculated at time t of the end of study with the following equation (8).

n
E(t ) = n
(8)
∑ CV ' j (t )
j =1

Then, we can obtain the efficiency ratio comparing E(t) with E(t-1) which is the efficiency of
the previous study at time t-1 in a record with the following equation (9).

E(t )
Efficiency Ratio = (9)
E(t − 1)

Temperature 24 25 25.5 26 26.5 27 28


Efficiency ratio 0.8 0.95 1.4 1 1.3 0.96 0.85
Table 2. An example of temperature values and efficiency ratios
Table 2. shows an example of how to decide the optimum temperature value when firstly
the learner sets 26 degree as an approximate temperature which makes him/her
comfortable. We can assume that the optimum temperature is around the approximate
temperature 26 degree, then the optimum temperature can be in [26-A, 26+A], where A is a
positive number larger enough to find the optimum value. A is the step value and initially
14 Advanced in Computer Science and Engineering

set by the learner. We assume the learner sets it as A=2. According to our algorithm, we
compare the efficiency ratio of temperature of 28 and 26. We can see that the efficiency ratio
of 28 degree is lower than that of 26 degree. We decrease the step value and get a new step
value: A’=A/2=1. Then, we compare the efficiency ratio of 27 degree with that of 26 degree.
The efficiency ratio of 26 degree is still higher, so we decrease the step value again and get
another step value: A’’=A’/2=0.5. The efficiency ratio of 26.5 degree is higher than that of 26
degree. As a result of the first round, we find that the optimum temperature that is 26.5
degree. For simplicity, we generally stop when the step equals to 0.1. Then, we repeat the
phases to obtain another optimum temperature. As a result of the second round, we find the
optimum temperature that is 25.5 degree. Comparing the efficiency ratio of 25.5 degree to
that of 26.5 degree, we finally choose 25.5 degree as the optimum temperature because its
efficiency ratio is higher.
Each day, we only modify the temperature once, and we get the corresponding efficiency
ratio. After several days, we can finally get the optimum temperature. In the same way, the
control center finds an optimum value for each parameter.

3.3 Implementation and evaluation of the PLS system

(a) A snapshot of the control center (b) Back side of a special tile
Fig. 8. Implementation of the PLS system
We implement the PLS system based on the ULS system. Figure. 8(a) shows a screen capture
of the Control Center in the PLS system.
To improve performance of gathering sensory data, we develop special tiles as shown in
Figure. 8(b). The special tiles are embedded with an RFID antenna and pressure sensors,
which are spread all over the desk. Each book includes an RFID tag showing text
information (e.g., English textbook). The dynamic information of a book put on the tile is
acquired by the tile connected to a sensor network. We designed to solve the following
problems; passive RFID reader only has a narrow range of operation and sometimes it
works not well for gathering data of all books on the desk. We separated the antenna from
the reader and created a RF-ID antenna with coil to broad the operation range of it. As the
result, with a relay circuit 16 antennas can control by only one reader. The tile also has five
pressure sensors. By using the special tile, accuracy of gathering learning information was
increased.
Next Generation Self-learning Style in Pervasive Computing Environments 15

Fig. 9. Efficiency ratio comparison between the ULS and the PLS
We evaluate the PLS by involving 10 subjects of students. In order to evaluate learning
effectiveness with considering environmental factors, they answer the following
questionnaires, which is the same in subsection 2.4, after using the ULS system as well as the
PLS system for some periods respectively.
Q1: Did you feel this system makes your motivation increase for self-directed learning?
Q2: Did the system provide suitable visible-supports to you?
Q3: Do you think this system helps you to improve your learning habit at home?
Q4: Did you feel this system was easy to use?
Then, we compare feedback scores of the PLS system with that of the ULS system and
calculate efficiency ratio based on score averages. Figure. 9 shows every subject thinks that
the PLS system is more efficient to study than the ULS system. We can conclude PLS system
succeeds to provide comfortable learning environments to each learner with pervasive
computing technologies, which leads to efficient self-learning style.

4. Conclusion
We address a next-generation self-learning style utilizing pervasive computing technologies
for providing proper learning supports as well as comfortable learning environment for
individuals. Firstly, a support method for self-managing learning scheduler, called the PLS,
is proposed and analyzes context information obtained from sensors by Behavior Analysis.
In addition, we have involved the environment factors such as temperature and light into
the PLS for making a learner’s surroundings efficient for study. The sensory data from
environments is sent to a decision center which analyzes the data and makes the best
decision for the learner. The PLS has been evaluated by some examinees. According to the
results, we have revealed that improved PLS not only benefited learners to acquire their
learning habits but also improved their self-directed learning styles than the former one.

5. Acknowledgment
This work is supported in part by Japan Society for the Promotion of Science (JSPS) Research
Fellowships for Young Scientists Program, JSPS Excellent Young Researcher Overseas Visit
Program, National Natural Science Foundation of China (NSFC) Distinguished Young
Scholars Program (No. 60725208) and NSCF Grant No. 60811130528.
16 Advanced in Computer Science and Engineering

6. References
Lima, P.; Bonarini, A. & Mataric, M. (2004). Application of Machine Learning, InTech, ISBN
978-953-7619-34-3, Vienna, Austria
Li, B.; Xu, Y. & Choi, J. (1996). Applying Machine Learning Techniques, Proceedings of ASME
2010 4th International Conference on Energy Sustainability, pp. 14-17, ISBN 842-6508-
23-3, Phoenix, Arizona, USA, May 17-22, 2010
Siegwart, R. (2001). Indirect Manipulation of a Sphere on a Flat Disk Using Force
Information. International Journal of Advanced Robotic Systems, Vol.6, No.4,
(December 2009), pp. 12-16, ISSN 1729-8806
Arai, T. & Kragic, D. (1999). Variability of Wind and Wind Power, In: Wind Power, S.M.
Muyeen, (Ed.), 289-321, Scyio, ISBN 978-953-7619-81-7, Vukovar, Croatia
Van der Linden, S. (June 2010). Integrating Wind Turbine Generators (WTG’s) with
Energy Storage, In: Wind Power, 17.06.2010, Available from
http://sciyo.com/articles/show/title/wind-power-integrating-wind-turbine-
generators-wtg-s-with-energy-storage
Taniguchi, R. (2002). Development of a Web-based CAI System for Introductory Visual Basic
Programming Course, Japanese Society for Information and Systems in Education,
Vol.19 No.2, pp. 106-111
Fuwa, Y.; Nakamura, Y.; Yamazaki, H. & Oshita, S. (2003). Improving University Education
using a CAI System on the World Wide Web and its Evaluation, Japanese Society for
Information and Systems in Education, Vol.20 No.1, pp. 27-38
Nakamura, S.; Sato, K.; Fujimori, M.; Koyama, A. & Cheng, Z. (2002). A Support System for
Teacher-Learner interaction in Learner-oriented Education, Information Processing
Society of Japan, Vol.43 No.2, pp.671-682
Benesse Corporation. (2005). Home Educational Information of Grade-school Pupils,
Benesse Corporation, Japan
Baldwin, J.D & Baldwin, J.I.; (2001). Behavior Principles in Everyday Life, 4th ed., L.
Pearson, (Ed.), Prentice-Hall, Inc., New Jersey
Daiichi Tsushin Kogyo Ltd. (2003). Automatic Recognition System, Daiichi Tsushin Kogyo
Ltd., Available from http://zones.co.jp/mezam.html
School of Human Sciences, Waseda University. E-School, Available from http://e-
school.human.waseda.ac.jp/
Oklahoma State University. Online Courses, Available from http://oc.okstate.edu/
Barbosa, J.; Hahn, R.; Barbosa, D.N.F. & Geyer, C.F.R. (2007). Mobile and ubiquitous
computing in an innovative undergraduate course, In Proceedings of 38th SIGCSE
technical symposium on Computer science education, pp. 379–383
Satyanarayanan, M. (2001). Pervasive Computing: Vision and Challenges, IEEE Personal
Communication, pp. 10-17
Ponnekanti, S.R; et al. (2001). Icrafter: A service framework for ubiquitous computing
environments, In Proceedings of Ubicomp 2001, pp. 56–75
Stanford, V. (2002). Using Pervasive Computing to Deliver Elder Care, IEEE Pervasive
Computing, pp.10-13
Hinske, S. & Langheinrich, M. (2009). An infrastructure for interactive and playful learning
in augmented toy environments, In Proceedings of IEEE International Conference on
Pervasive Computing and Communications (PerCom 2009), pp. 1-6
Yu, Z.; Nakamura, Y.; Zhang, D.; Kajita, S. & Mase, K. (2008). Content Provisioning for
Ubiquitous Learning, IEEE Pervasive Computing, Vol. 7, Issue 4, pp. 62-70
2

Automatic Generation of Programs


Ondřej Popelka and Jiří Štastný
Mendel University in Brno
Czech Republic

1. Introduction
Automatic generation of program is definitely an alluring problem. Over the years many
approaches emerged, which try to smooth away parts of programmers’ work. One approach
already widely used today is colloquially known as code generation (or code generators). This
approach includes many methods and tools, therefore many different terms are used to
describe this concept. The very basic tools are included in various available Integrated
Development Environments (IDE). These include templates, automatic code completion,
macros and other tools. On a higher level, code generation is performed by tools, which
create program source code from metadata or data. Again, there are thousands of such tools
available both commercial and open source. Generally available are programs for generating
source code from relational or object database schema, object or class diagrams, test cases,
XML schema, XSD schema, design patterns or various formalized descriptions of the
problem domain.
These tools mainly focus on the generation of a template or skeleton for an application or
application module, which is then filled with actual algorithms by a programmer. The great
advantage of such tools is that they lower the amount of tedious, repetitive and boring (thus
error-prone) work. Commonly the output is some form of data access layer (or data access
objects) or object relational mapping (ORM) or some kind of skeleton for an application - for
example interface for creating, reading, updating and deleting objects in database (CRUD
operations). Further, this approach leads to generative programming domain, which
includes concepts such as aspect-oriented programming (Gunter & Mitchell, 1994), generic
programming, meta-programming etc. (Czarnecki & Eisenecker, 2000). These concepts are now
available for general use – for example the AspectJ extension to Java programming language
is considered stable since at least 2003 (Ladad, 2009). However, they are not still mainstream
form of programming according to TIOBE Index (TIOBE, 2010).
A completely different approach to the problem is an actual generation of algorithms of the
program. This is a more complex then code generation as described above, since it involves
actual creation of algorithms and procedures. This requires either extremely complex tools
or artificial intelligence. The former can be probably represented by two most successful
(albeit completely different) projects – Lyee project (Poli, 2002) and Specware project (Smith,
1999). Unfortunately, the Lyee project was terminated in 2004 and the latest version of
Specware is from 2007.
As mentioned above, another option is to leverage artificial intelligence methods
(particularly evolutionary algorithms) and use them to create code evolution. We use the term
18 Advances in Computer Science and Engineering

code evolution as an opposite concept to code generation (as described in previous paragraphs)
and later we will describe how these two concepts can be coupled. When using code
generation, we let the programmer specify program metadata and automatically generate
skeleton for his application, which he then fills with actual algorithms. When using code
evolution, we let the programmer specify sample inputs and outputs of the program and
automatically generate the actual algorithms fulfilling the requirements. We aim to create a
tool which will aid human programmers by generating working algorithms (not optimal
algorithms) in programming language of their choice.
In this chapter, we describe evolutionary methods usable for code evolution and results of
some experiments with these. Since most of the methods used are based on genetic
algorithms, we will first briefly describe this area of artificial intelligence. Then we will
move on to the actual algorithms for automatic generation of programs. Furthermore, we
will describe how these results can be beneficial to mainstream programming techniques.

2. Methods used for automatic generation of programs


2.1 Genetic algorithms
Genetic algorithms (GA) are a large group of evolutionary algorithms inspired by
evolutionary mechanisms of live nature. Evolutionary algorithms are non-deterministic
algorithms suitable for solving very complex problems by transforming them into state space
and searching for optimum state. Although they originate from modelling of natural
process, most evolutionary algorithms do not copy the natural processes precisely.
The basic concept of genetic algorithms is based on natural selection process and is very
generic, leaving space for many different approaches and implementations. The domain of
GA is in solving multidimensional optimisation problems, for which analytical solutions are
unknown (or extremely complex) and efficient numerical methods are unavailable or their
initial conditions are unknown. A genetic algorithm uses three genetic operators –
reproduction, crossover and mutation (Goldberg, 2002). Many differences can be observed in
the strategy of the parent selection, the form of genes, the realization of crossover operator,
the replacement scheme, etc. A basic steady-state genetic algorithm involves the following
steps.
Initialization. In each step, a genetic algorithm contains a number of solutions (individuals)
in one or more populations. Each solution is represented by genome (or chromosome).
Initialization creates a starting population and sets all bits of all chromosomes to an initial
(usually random) value.
Crossover. The crossover is the main procedure to ensure progress of the genetic algorithm.
The crossover operator should be implemented so that by combining several existing
chromosomes a new chromosome is created, which is expected to be a better solution to the
problem.
Mutation. Mutation operator involves a random distortion of random chromosomes; the
purpose of this operation is to overcome the tendency of genetic algorithm in reaching the
local optimum instead of global optimum. Simple mutation is implemented so that each
gene in each chromosome can be randomly changed with a certain very small probability.
Finalization. The population cycle is repeated until a termination condition is satisfied.
There are two basic finalization variations: maximal number of iterations and the quality of
the best solution. Since the latter condition may never be satisfied both conditions are
usually used.
Automatic Generation of Programs 19

The critical operation of genetic algorithm is crossover which requires that it is possible to
determine what a “better solution” is. This is determined by a fitness function (criterion
function or objective function). The fitness function is the key feature of genetic algorithm,
since the genetic algorithm performs the minimization of this function. The fitness function
is actually the transformation of the problem being solved into a state space which is
searched using genetic algorithm (Mitchell, 1999).

2.2 Genetic programming


The first successful experiments with automatic generation of algorithms were using
Genetic Programming method (Koza, 1992). Genetic programming (GP) is a considerably
modified genetic algorithm and is now considered a field on its own. GP itself has proven
that evolutionary algorithms are definitely capable of solving complex problems such as
automatic generation of programs. However, a number of practical issues were discovered.
These later lead to extending GP with (usually context-free) grammars to make this method
more suitable to generate program source code (Wong & Leung, 1995) and (Patterson &
Livesey, 1997).
Problem number one is the overwhelming complexity of automatic generation of a program
code. The most straightforward approach is to split the code into subroutines (functions or
methods) the same way as human programmers do. In genetic programming this problem is
generally being solved using Automatically Defined Functions (ADF) extension to GP. When
using automatically defined function each program is split into definitions of one or more
functions, an expression and result producing branch. There are several methods to create
ADFs, from manual user definition to automatic evolution. Widely recognized approaches
include generating ADFs using genetic programing (Koza, 1994), genetic algorithms
(Ahluwalia & Bull, 1998), logic grammars (Wong & Leung, 1995) or gene expression
programming (Ferreira, 2006a).
Second very difficult problem is actually creating syntactically and semantically correct
programs. In genetic programming, the program code itself is represented using a concrete
syntax tree (parse tree). An important feature of GP is that all genetic operations are applied to
the tree itself, since GP algorithms generally lack any sort of genome. This leads to problems
when applying the crossover or mutation operators since it is possible to create a
syntactically invalid structure and since it limits evolutionary variability. A classic example
of the former is exchanging (within crossover operation) a function with two parameters for
a function with one parameter and vice versa – part of the tree is either missing or
superfluous. The latter problem is circumvented using very large initial populations which
contain all necessary prime building blocks. In subsequent populations these building
blocks are only combined into correct structure (Ferreira, 2006a).
Despite these problems, the achievements of genetic programming are very respectable; as
of year 2003 there are 36 human-competitive results known (Koza et al, 2003). These results
include various successful specialized algorithms or circuit topologies. However we would
like to concentrate on a more mainstream problems and programming languages. Our goal
are not algorithms competitive to humans, rather we focus on creating algorithms which are
just working. We are also targeting mainstream programming languages.

2.3 Grammatical evolution


The development of Grammatical Evolution (GE) algorithm (O’Neill & Ryan, 2003) can be
considered a major breakthrough when solving both problems mentioned in the previous
20 Advances in Computer Science and Engineering

paragraph. This algorithm directly uses a generative context-free grammar (CFG) to


generate structures in an arbitrary language defined by that grammar. A genetic algorithm
is used to direct the structure generation. The usage of a context-free grammar to generate a
solution ensures that a solution is always syntactically correct. It also enables to precisely
and flexibly define the form of a solution without the need to alter the algorithm
implementation.

Fig. 1. Production rules of grammar for generating arithmetic expressions


In grammatical evolution each individual in the population is represented by a sequence of
rules of a defined (context-free) grammar. The particular solution is then generated by
translating the chromosome to a sequence of rules which are then applied in specified order.
A context-free grammar G is defined as a tuple G = (Π,Σ,P,S) where Π is set of non-
terminals, Σ is set of terminals, S is initial non-terminal and P is table of production rules.
The non-terminals are items, which appear in the individuals’ body (the solution) only
before or during the translation. After the translation is finished all non-terminals are
translated to terminals. Terminals are all symbols which may appear in the generated
language, thus they represent the solution. Start symbol is one non-terminal from the non-
terminals set, which is used to initialize the translation process. Production rules define the
laws under which non-terminals are translated to terminals. Production rules are key part of
the grammar definition as they actually define the structure of the generated solution
(O’Neill & Ryan, 2003).
We will demonstrate the principle of grammatical evolution and the backward processing
algorithm on generating algebraic expressions. The grammar we can use to generate
arithmetic expressions is defined by equations (1) – (3); for brevity, the production rules are
shown separately in BNF notation on Figure 1 (Ošmera & Popelka, 2006).

∏ = {expr , fnc , num, var} (1)

Σ = {sin,cos, + , − , ÷, ⋅, x ,0,1,2,3, 4,5,6,7,8,9} (2)

S = expr (3)
Automatic Generation of Programs 21

Fig. 2. Process of the translation of the genotype to a solution (phenotype)


The beginning of the process of the translation is shown on Figure 2. At the beginning we
have a chromosome which consists of randomly generated integers and a non-terminal
<expr> (expression). Then all rules which can rewrite this non-terminal are selected and rule
is chosen using modulo operation and current gene value. Non-terminal <expr> is rewritten
to non-terminal <var> (variable). Second step shows that if only one rule is available for
rewriting the non-terminal, it is not necessary to read a gene and the rule is applied
immediately. This illustrates how the genome (chromosome) can control the generation of
solutions. This process is repeated for every solution until no non-terminals are left in its’
body. Then each solution can be evaluated and a genetic algorithm population cycle can
start and determine best solutions and create new chromosomes.
Other non-terminals used in this grammar can be <fnc> (function) and <num> (number).
Here we consider standard arithmetic operators as functions, the rules on Figure 1 are
divided by the number of arguments for a function (“u-“ stands for unary minus).

3. Two-level grammatical evolution


In the previous section, we have described original grammatical evolution algorithm. We
have further developed the original grammatical evolution algorithm by extending it with
22 Advances in Computer Science and Engineering

Backward Processing algorithm (Ošmera, Popelka & Pivoňka, 2006). The backward processing
algorithm just uses different order of processing the rules of the context free grammar than
the original GE algorithm. Although the change might seem subtle, the consequences are
very important. When using the original algorithm, the rules are read left-to-right and so is
the body of the individual scanned left-to-right for untranslated non-terminals.

State of the solution – nonterminals in


Chromosome Rule selection italics will be replaced , bold
Rule type
nonterminals are new

a 42 mod 4 = 2 <fnc >(<expr>, <expr >) N


b 23 mod 4 = 3 •(<expr >, <expr>) T
c 17 mod 4 = 1 •(<fnc>(<expr >), <expr>) N
d 11 mod 3 = 2 •(cos(<expr>), <expr>) T
e 38 mod 4 = 2 •(cos(<fnc>(<num>,<expr >)), <expr >) N
translation progress

f 45 mod 4 = 1 •(cos(+(<num><expr>)), <expr >) T


g 22 mod 10 = 2 •(cos(+(2,<expr>)), <expr >) T
h 8 mod 4 = 0 •(cos(+(2,<var >)), <expr>) N
i 78 mod 1 = 0 •(cos(+(2,x)), <expr>) T
j 37 mod 4 = 1 •(cos(+(2,x)), <fnc>(<expr >)) N
k 13 mod 3 = 1 •(cos(+(2,x)),sin (<expr >)) T
l 7 mod 4 = 3 •(cos(+(2,x)),sin(<fnc>(<num>,<exp >))) N
m 19 mod 4 = 3 •(cos(+(2,x)),sin(•(<num >,<exp>))) T
n 63 mod 10 = 3 •(cos(+(2,x)),sin(•(3,<exp>))) T
o 16 mod 4 = 0 •(cos(+(2,x)),sin(•(3,<var >))) N
p 27 mod 1 = 0 •(cos(+(2,x)),sin(•(3,x))) T

Fig. 3. Translation process of an expression specified by equation (4)

3.1 Backward processing algorithm


The whole process of translating a sample chromosome into an expression (equation 4) is
shown on figure 3 []. Rule counts and rule numbers correspond to figure 1, indexes of the
rules are zero-based. Rule selected in step a) of the translation is therefore the third rule in
table.

cos(2 + x ) ⋅ sin(3 ⋅ x ) (4)

The backward processing algorithm scans the solution string for non-terminals in right-to-
left direction. Figure 4 shows the translation process when this mode is used. Note that the
genes in the chromosome are the same; they just have been rearranged in order to create
same solution, so that the difference between both algorithms can be demonstrated. Figure 4
now contains two additional columns with rule type and gene mark.
Rule types are determined according to what non-terminals they translate. We define a T-
terminal as a terminal which can be translated only to terminals. By analogy N-terminal is a
terminal which can be translated only to non-terminals. T-rules (N-rules) are all rules
translating a given T-nonterminal (N-nonterminal). Mixed rules (or non-terminals) are not
Automatic Generation of Programs 23

allowed. Given the production rules shown on Figure 1, the only N-nonterminal is <expr>,
non-terminals <fnc>, <var> and <num> are all T-nonterminals (Ošmera, Popelka &
Pivoňka, 2006).

Type of selected rule Block pairs

Rule selection State of the solution – nonterminals in


Chromosome Gene mark
italics will be replaced , bold
nonterminals are new

a 42 mod 4 = 2 <fnc>(<expr >, <expr>) N B


b 37 mod 4 = 1 <fnc>(<expr >, <fnc>(<expr >)) N B
c 7 mod 4 = 3 <fnc>(<expr >, <fnc>(<fnc>(<num>, <expr >))) N B
d 16 mod 4 = 0 <fnc>(<expr >, <fnc>(<fnc >(<num >, <var >))) N B
e 27 mod 1 = 0 <fnc>(<expr >, <fnc>(<fnc >(<num >, x))) T E
f 63 mod 10 = 3 <fnc>(<expr >, <fnc>(<fnc >(3, x))) T I
g 19 mod 4 = 3 <fnc>(<expr >, <fnc>(•(3, x))) T E
h 13 mod 3 = 1 <fnc>(<expr >, sin (•(3, x))) T E
i 17 mod 4 = 1 <fnc>(<fnc>(<expr >), sin(•(3, x))) N B
j 38 mod 4 = 2 <fnc>(<fnc >(<fnc>(<num>, <expr >)), sin(•(3, x))) N B
k 8 mod 4 = 0 <fnc>(<fnc >(<fnc >(<num>, <var >)), sin(•(3, x))) N B
l 78 mod 1 = 0 <fnc>(<fnc >(<fnc >(<num>, x), sin(•(3, x))) T E
m 22 mod 10 = 2 <fnc>(<fnc >(<fnc >(2, x)), sin(•(3, x))) T I
n 45 mod 4 = 1 <fnc>(<fnc >(+(2, x)), sin(•(3, x))) T E
o 11 mod 3 = 2 <fnc>(cos(+(2,x)), sin(•(3, x))) T E
p 23 mod 4 = 3 •(cos(+(2,x)), sin(•(3, x))) T E

Fig. 4. Translation of an expression (equation (4)) using the backward processing algorithm
Now that we are able to determine type of the rule used, we can define gene marks. In step c)
at figure 4 a <expr> non-terminal is translated into a <fnc>(<num>, <expr>) expression.
This is further translated until step g), where it becomes 3 ⋅ x . In other words – in step c) we
knew that the solution will contain a function with two arguments; in step g) we realized
that it is multiplication with arguments 3 and x. The important feature of backward
processing algorithm that all genes which define this sub-expression including all its’
parameters are in a single uninterrupted block of genes. To explicitly mark this block we use
Block marking algorithm which marks:
- all genes used to select N-rule with mark B (Begin)
- all genes used to select T-rule except the last one with mark I (Inside)
- all genes used to select last T-rule of currently processed rule with mark E (End).
The B and E marks determine begin and end of logical blocks generated by the grammar. This
works independent of the structure generated provided that the grammar consists only of
N-nonterminals and T-nonterminals. These logical blocks can then be exchanged the same
way as in genetic programming (figure 5) (Francone et al, 1999).
Compared to genetic programing, all the genetic algorithm operations are still performed on
the genome (chromosome) and not on the actual solution. This solves the second problem
described in section 2.2 – the generation of syntactically incorrect solutions. Also the
24 Advances in Computer Science and Engineering

problem of lowered variability is solved since we can always insert or remove genes in case
we need to remove or add parts of the solution. This algorithm also solves analogical
problems existing in standard grammatical evolution (O’Neill et al, 2001).

2. parent 1. child 2. child


cos(2 + x) · sin(3 · x) cos(2 + x) · sin(3 · (2 + x)) cos (x) · sin(3 · x )

1. parent 1. parent part


cos (2 + x) · sin(3 · x) x

42 B 42 B 42 B 42 B
37 B 37 B 37 B 37 B
7 B 7 B 7 B 7 B
16 B 16 B 16 B 38 B 16 B
27 E 27 E 27 E 8 B 27 E
63 I 63 I 78 E 63 I
19 E 19 E 22 I 19 E
13 E 13 E 45 E 13 E
17 B 17 B 63 I 17 B
38 B 38 B 38 B 19 E 16 B
8 B 8 B 8 B 13 E 27 E
78 E 78 E 78 E 17 B 11 E
22 I 22 I 22 I 38 B 23 E
45 E 45 E 45 E 8 B
11 E 11 E 78 E
23 E 23 E 22 I
45 E
2. parent part 11 E
2+x
23 E

Fig. 5. Example of crossing over two chromosomes with marked genes


The backward processing algorithm of two-level grammatical evolution provides same results as
original grammatical evolution. However in the underlying genetic algorithm, the genes
that are involved in processing a single rule of grammar are grouped together. This
grouping results in greater stability of solutions during crossover and mutation operations
and better performance (Ošmera & Popelka, 2006). An alternative to this algorithm is Gene
expression programming method (Cândida Ferreira, 2006b) which solves the same problem
but is quite limited in the form of grammar which can be used.

3.2 Second level generation in two-level grammatical evolution


Furthermore, we modified grammatical evolution to separate structure generation and
parameters optimization (Popelka, 2007). This is motivated by poor performance of
grammatical evolution when optimizing parameters, especially real numbers (Dempsey et
al., 2007). With this approach, we use grammatical evolution to generate complex structures.
Instead of immediately generating the resulting string (as defined by the grammar), we store
Automatic Generation of Programs 25

the parse tree of the structure and use it in second level of optimization. For this second
level of optimization, a Differential evolution algorithm (Price, 1999) is used. This greatly
improves the performance of GE, especially when real numbers are required (Popelka &
Šťastný, 2007)

Initialization

Fitness computation
Apply to all
individuals
Differential evolution

Translate chromosome
No
Are there any variables to
be optimized ?

Fitness computation Yes

Initialization
Yes

Desired fitness
reached ? Fitness computation

No
Finish

Crossover Desired fitness


reached ?

Yes No
Mutation
Crossover +
Selection
Selection

Fig. 6. Flowchart of two-level grammatical evolution


The first level of the optimization is performed using grammatical evolution. According to
the grammar, the output can be a function containing variables (x in our case); and instead
of directly generating numbers using the <num> nonterminal we add several symbolic
constants (a, b, c) into to grammar. The solution expression cannot be evaluated and
assigned a fitness value since the values of symbolic constants are unknown. In order to
evaluate the generated function a secondary optimization has to be performed to find values
for constants. Input for the second-level of optimization is the function with symbolic
constants which is transformed to a vector of variables. These variables are optimized using
the differential evolution and the output is a vector of optimal values for symbolic constants
for a given solution. Technically in each grammatical evolution cycle there are hundreds of
differential evolution cycles executed. These optimize numeric parameters of each generated
individual (Popelka, 2007). Figure 6 shows the schematic flowchart of the two-level
grammatical evolution.
26 Advances in Computer Science and Engineering

3.3 Deformation grammars


Apart from generating the solution we also need to be able to read and interpret the
solutions (section 4.2). For this task a syntactic analysis is used. Syntactic analysis is a
process which decides if the string belongs to a language generated by a given grammar,
this can be used for example for object recognition (Šťastný & Minařík, 2006). It is possible to
use:
- Regular grammar – Deterministic finite state automaton is sufficient to analyse regular
grammar. This automaton is usually very simple in hardware and software realization.
- Context-free grammar – To analyse context-free grammar a nondeterministic finite state
automaton with stack is generally required.
- Context grammar – “Useful and sensible” syntactic analysis can be done with context-
free grammar with controlled re-writing.
There are two basic methods of syntactic analysis:
- Bottom-up parsing – We begin from analysed string to initial symbol. The analysis begins
with empty stack. In case of successful acceptance only initial symbol remains in the
stack, e.g. Cocke-Younger-Kasami algorithm (Kasami, 1965), which grants that the time
of analysis is proportional to third power of string length;
- Top-down parsing – We begin from initial symbol and we are trying to generate analysed
string. String generated so far is saved in the stack. Every time a terminal symbol
appears on the top of the stack, it is compared to actual input symbol of the analysed
string. If symbols are identical, the terminal symbol is removed from the top of the
stack. If not, the algorithm returns to a point where a different rule can be chosen (e.g.
with help of backtracking). Example of top down parser is Earley’s Parser (Aycock &
Horspool, 2002), which executes all ways of analysis to combine gained partial results.
The time of analysis is proportional to third power of string length; in case of
unambiguous grammars the time is only quadratic. This algorithm was used in
simulation environment.
When designing a syntactic analyser, it is useful to assume random influences, e.g. image
deformation. This can be done in several ways. For example, the rules of given grammar can
be created with rules, which generate alternative string, or for object recognition it is
possible to use some of the methods for determination of distance between attribute
description of images (string metric). Finally, deformation grammars can be used.
Methods for determination of distance between attribute descriptions of images (string
metric) determine the distance between attribute descriptions of images, i.e. the distance
between strings which correspond to the unknown object and the object class patterns.
Further, determined distances are analysed and the recognized object belongs to the class
from which the string has the shortest distance. Specific methods (Levenshtein distance
Ld(s, t), Needleman-Wunsch method) can be used to determine the distance between
attribute descriptions of image (Gusfield, 1997).
Results of these methods are mentioned e.g. in (Minařík, Šťastný & Popelka, 2008). If the
parameters of these methods are correctly set, these methods provide good rate of successful
identified objects with excellent classification speed. However, false object recognition or
non-recognized objects can occur.
From the previous paragraphs it is clear that recognition of non-deformed objects with
structural method is without problems, it offers excellent speed and 100% classification rate.
However, recognition of randomly deformed objects is nearly impossible. If we conduct
syntactic analysis of a string which describes a structural deformed object, it will apparently
Automatic Generation of Programs 27

not be classified into a given class because of its structural deformation. Further, there are
some methods which use structural description and are capable of recognizing randomly
deformed objects with good rate of classification and speed.
The solution to improve the rate of classification is to enhance the original grammar with
rules which describe errors – deformation rules, which cover up every possible random
deformation of object. Then the task is changed to finding a non-deformed string, which
distance from analysed string is minimal. Compared to the previous method, this is more
informed method because it uses all available knowledge about the classification targets – it
uses grammar. Original grammar may be regular or context-free, enhanced grammar is
always context-free and also ambiguous, so the syntactic analysis, according to the
enhanced grammar, will be more complex.
Enhanced deformation grammar is designed to reliably generate all possible deformations of
strings (objects) which can occur. Input is context-free or regular grammar G = (VN, VT, P,
S). Output of the processing is enhanced deformation grammar G’ = (VN’, VT’, P’, S’), where P’
is set of weighted rules. The generation process can be described using the following steps:
Step1:

VN’ = VN ∪ {S ’} ∪ {EB b ∈ VT } (5)

VT ⊆ VT’ (6)
Step 2:
If holds:

A → α 0b1α 1b2 ...α m − 1bmα m ; m ≥ 0; α 1 ∈ VN’ ∧ bi ∈ VT’ ; i = 1, 2,..., m ; l = 0,1,..., m (7)

Then add new rule into P’ with weight 0:

A → α 0Eb 1α 1Eb 2 ...α m − 1Ebmα m (8)


Step 3:
Into P’add the rules in table 1 with weight according to chosen metric. In this example
Levenshtein distance is used. In the table header L is Levenshtein distance, w is weighted
Levenshtein distance and W is weighted metric.

Rule L w W Rule for


S’ → S 0 0 0 -
S ’ → Sa 1 wl I ’( a ) a ∈ VT’
Ea → a 0 0 0 a ∈ VT
Ea → b 1 wS S( a , b ) a ∈ VT , b ∈ VT’ , a ≠ b
Ea → δ 1 wD D( a ) a ∈ VT
Ea → bEa 1 wl I( a, b) a ∈ VT , b ∈ VT’

Table 1. Rules of enhanced deformation grammar


These types of rules are called deformation rules. Syntactic analyser with error correction
works with enhanced deformation grammar. This analyser seeks out such deformation of
28 Advances in Computer Science and Engineering

input string, which is linked with the smallest sum of weight of deformation rules. G’ is
ambiguous grammar, i.e. its syntactic analysis is more complicated. A modified Earley
parser can be used for syntactic analyses with error correction. Moreover, this parser
accumulates appropriate weight of rules which were used in deformed string derivation
according to the grammar G’.

3.4 Modified Early algorithm


Modified Early parser accumulates weights of rules during the process of analysis so that
the deformation grammar is correctly analysed (Minařík, Šťastný & Popelka, 2008). The
input of the algorithms is enhanced deformation grammar G’ and input string w.

w = b1b2 ...b _ m (9)

Output of the algorithm is lists I 0 , I 1 ,...I m for string w (equation 9) and distance d of input
string from a template string defined by the grammar.
Step 1 of the algorithm – create list I 0 . For every rule S ’ → α ∈ P ’ add into I 0 field:

[S ’ → ⋅α ,0, x ] (10)

Execute until it is possible to add fields into I 0 . If

[ A → ⋅Bβ ,0, y ] (11)


is in I 0 field then add

Z
B → γ field [ B → ⋅γ ,0, z] (12)
into I 0 .
Step 2: Repeat for j = 1, 2,..., m the following sub-steps A – C:
a. for every field in I j − 1 in form of [ B → α ⋅ aβ , i , x ] such that a = b j , add the field

[B → α a ⋅ β , i, x] (13)

into I j . Then execute sub-steps B and C until no more fields can be added into I j .
b. If field [ A → α ⋅, i , x ] is in I j and field [ B → β ⋅ Aγ , k , y ] in I j , then
a. If exists a field in form of [ B → β A ⋅ γ , k , z] in I j , and then if x+y < z, do replace
the value z with value x + y in this field
b. If such field does not exist, then add new field [ B → β A ⋅ γ , k , x + y ]
c. For every field in form of [ A → α ⋅ Bβ , i , x ] in I j do add a field [ B → ⋅γ , j , z] for every
rule

Z
B→γ (14)
Step 3: If the field

[S ’ → α ⋅,0, x ] (15)

is in I m , then string w is accepted with distance weight x. String w (or its derivation tree) is
obtained by omitting all deformation rules from derivation of string w.
Automatic Generation of Programs 29

Designed deformation grammar reliably generates all possible variants of randomly


deformed object or string. It enables to use some of the basic methods of syntactic analysis
for randomly deformed objects. Compared to methods for computing the distance between
attribute descriptions of objects it is more computationally complex. Its effectiveness
depends on effectiveness of the used parser or its implementation respectively. This parses
is significantly are more complex than the implementation of methods for simple distance
measurement between attribute descriptions (such as Levenshtein distance).
However, if it is used correctly, it does not produce false object recognition, which is the
greatest advantage of this method. It is only necessary to choose proper length of words
describing recognized objects. If the length of words is too short, excessive deformation (by
applying only a few deformation rules) may occur, which can lead to occurrence of
description of completely different object. If the length is sufficient (approximately 20% of
deformed symbols in words longer than 10 symbols), this method gives correct result and
false object recognition will not occur at all.
Although deformed grammars were developed mainly for object recognition (where an
object is represented by a string of primitives), it has a wider use. The main feature is that it
can somehow adapt to new strings and it can be an answer to the problem described in
section 4.2.

4. Experiments
The goal of automatic generation of programs is to create a valid source code of a program,
which will solve a given problem. Each individual of a genetic algorithm is therefore one
variant the program. Evaluation of an individual involves compilation (and building) of the
source code, running the program and inputting the test values. Fitness function then
compares the actual results of the running program with learning data and returns the
fitness value. It is obvious that the evaluation of fitness becomes very time intensive
operation. For the tests we have chosen the PHP language for several reasons. Firstly it is an
interpreted language which greatly simplifies the evaluation of a program since compiling
and building can be skipped. Secondly a PHP code can be interpreted easily as a string
using either command line or library API call, which simplified implementation of the
fitness function into our system. Last but not least, PHP is a very popular language with
many tools available for programmers.

4.1 Generating simple functions


When testing the two-level grammatical evolution algorithm we stared with very simple
functions and a very limited grammar:
<statement> ::= <begin><statement><statement> |
<if><condition><statement> |
<function><expression><expression> |
<assign><var><expression>
<expression> ::= <function><expression> |
<const> |
<var> |
<function><expression><expression>
<condition> ::= <operator><expression><expression>
<operator> ::= < | > | != | == | >= | <=
30 Advances in Computer Science and Engineering

<var> ::= $a | $b | $result


<const> ::= 0 | 1| -1
<function> ::= + | - | * | /
<begin> ::= {}
<if> ::= if {}
<assign> ::= =
This grammar represents a very limited subset of the PHP language grammar (Salsi, 2007)
or (Zend, 2010). To further simplify the task, the actual generated source code was only a
body of a function. Before the body of the function, a header is inserted, which defines the
function name, number and names of its arguments. After the function body, the return
command is inserted. After the complete function definition, a few function calls with
learning data are inserted. The whole product is then passed to PHP interpreter and the text
result is compared with expected results according to given learning data.
The simplest experiment was to generate function to compute absolute value of a number
(without using the abs() function). The input for this function is one integer number; output
is absolute value of that number. The following set of training patterns was used:
P = {(−3, 3); (43, 43); (3, 3); (123, 123); (−345, 345); (−8, 8); (−11, 11); (0, 0)}.
Fitness function is implemented so that for each pattern it assigns points according to
achieved result (result is assigned, result is number, result is not negative, result is equal to
training value). Sum of the points then represents the achieved fitness. Following are two
selected examples of generated functions:
function absge($a) {
$result = null;
$result = $a;
if (($a) <= (((-(-((-($result)) + ((-($a)) - (1))))) - (-1)) - (0))) {
$result = -($result);
}
return $result;
}
function absge($a) {
$result = null;
$result = -($a);
if ((-($result)) >= (1)) {
$result = $a;
};
return $result;
}
While the result looks unintelligible, it must be noted that this piece of source code is correct
algorithm. The last line and first two lines are the mandatory header which was added
automatically for the fitness evaluation. Apart from that it has not been processed, it is also
important to note that it was generated in all 20 runs from only eight sample values in
average of 47.6 population cycles (population size was 300 individuals).
Another example is a classic function for comparing two integers. Input values are two
integer numbers a and b. Output value is integer c, which meets the conditions c > 0, for a >
b; c = 0, for a = b; c < 0, for a < b. Training data is a set of triples (a, b, c):
P = {(−3, 5,−1); (43, 0, 1); (8, 8, 0); (3, 4,−1); (−3,−4, 1);}
Automatic Generation of Programs 31

The values intentionally do not correspond to the usual implementation of this function: c =
a − b. Also the fitness function checks only if c satisfies the conditions and not if the actual
value is equal, thus the search space is open for many possible solutions. An example
solution is:
function comparege($a, $b) {
$result = null;
if ((($a) - (($b) * (-(($result) / (1))))) <= ($result)) {{
$result = 0;
$result = $b;
}}
$result = ($b) - ($a);;
$result = -($result);;
return $result;
}
The environment was the same like in the first example; generation took 75.1 population
cycles on average. Although these tests are quite successful, it is obvious, that this is not
very practical.
For each simple automatically generated function a programmer would need to specify a
very specific test, function header, function footer. Tests for genetic algorithms need to be
specific in the values they return. A fitness function which would return just “yes” or “no”
is insufficient in navigating the genetic algorithm in the state space – such function cannot
be properly optimized. The exact granularity of the fitness function values is unknown, but
as little as 5 values can be sufficient if they are evenly distributed (as shown in the first
example in this section).

4.2 Generating classes and methods


To make this system described above practical, we had to use standardized tests and not
custom made fitness functions. Also we wanted to use object oriented programming,
because it is necessary to keep the code complexity very low. Therefore we need to stick
with the paradigm of small simple “black box” objects. This is a necessity and sometimes an
advantage. Such well-defined objects are more reliable, but it is a bit harder to maintain their
connections (Büchi & Weck, 1999).
Writing class tests before the actual source code is already a generally recognized approach
– test-driven development. In test-driven development, programmers start off by writing tests
for the class they are going to create. Once the tests are written, the class is implemented and
tested. If all tests pass, a coverage analysis is performed to check whether the tests do cover
all the newly written source code (Beck, 2002). An example of a simple test using PHPUnit
testing framework:
class BankAccountTest extends PHPUnit_Framework_TestCase {
protected $ba;
protected function setUp() {
$this->ba = new BankAccount;
}
public function testBalanceIsInitiallyZero() {
$this->assertEquals(0, $this->ba->getBalance());
}
32 Advances in Computer Science and Engineering

public function testBalanceCannotBecomeNegative() {


try {
$this->ba->withdrawMoney(1);
}
catch (BankAccountException $e) {
$this->assertEquals(0, $this->ba->getBalance());
return;
}
$this->fail();
}
...
}
The advantage of modern unit testing framework is that it is possible to create class skeleton
(template) from the test. From the above test, the following code can be easily generated:
class BankAccount {
public function depositMoney() {}
public function getBalance() {}
public function withdrawMoney() {}
}
Now we can use a PHP parser to read the class skeleton and import it as a template
grammar rule into grammatical evolution. This task is not as easy as it might seem. The class
declaration is incomplete – it is missing function parameters and private members of the
class.
Function parameters can be determined from the tests by static code analysis, provided that
we refrain from variable function parameters. Function parameter completion can be solved
by extending the PHPUnit framework. Private members completion is more problematic,
since it should be always unknown to the unit test (per the black box principle). Currently
we created grammar rule for grammatical evolution by hand. In future, however, we would
like to use deformed grammar (as described in section 3.3) to derive initial rule for
grammatical evolution. We use <class_declaration_statement> as starting symbol, then we
can define first (and only) rewriting rule for that symbol as (in EBNF notation):

<class_declaration_statement> :==
“class BankAccount {“ <class_variable_declarations>
“public function depositMoney(“<variable_without_objects>”) {“
<statement_list>
“}
public function getBalance() {“
<statement_list>
“}
public function withdrawMoney(“<variable_without_objects>”) {“
<statement_list
“}
}”
This way we obtain the class declaration generated by the unit test, plus space for private
class members (only variables in this case) and function parameters. It is important to note
that the grammar used to generate a functional class needs at least about 20 production rules
Automatic Generation of Programs 33

(compared to approximately 10 in the first example). This way we obtain grammar to


generate example class BankAccount. This can now be fed to the unit test, which will return
number of errors and failures.
This experiment was only half successful. We used the concrete grammar described above –
that is grammar specifically designed to generate BankAccount class with all its’ public
methods. Within average of 65.6 generations (300 individuals in generation) we were able to
create individuals without errors (using only initialized variables, without infinite loops,
etc.). Then the algorithm remained in local minimum and failed to find a solution with
functionally correct method bodies.
After some investigation, we are confident that the problem lies in the return statement of a
function. We have analyzed hundreds of solution and found that the correct code is present,
but is preceded with return statement which exits from the function. The solution is to use
predefined function footer and completely stop using the return statement (as described in
section 4.1). This however requires further refinement of the grammar, and again
deformation grammars might be the answer. We are also confident that similar problems
will occur with other control-flow statements.
We have also tested a very generic production rules, such as:
<class_declaration_statement> :== “class BankAccount {“ {<class_statement>} “}”
<class_statement> :== <visibility_modifier> “function (“<parameter_list>”){“
<statement_list> “}”
| <visibility_modifier> <variable_without_objects> “;”
...
When such generic rules were used, no solution without errors was found within 150
allowed generations. This was expected as the variability of solutions and state space
complexity rises extremely quickly.

5. Conclusion
In this chapter, we have presented several methods and concepts suitable for code evolution a
fully automated generation of working source code using evolutionary algorithms. In the
above paragraphs, we described how code evolution could work together with code
generation. Code generation tools can be used to create a skeleton or template for an
application, while code evolution can fill in the actual algorithms. This way, the actual
generated functions can be kept short enough, so that the code evolution is finished within
reasonable time.
Our long term goal is to create a tool which would be capable of generating some code from
unit tests. This can have two practical applications – creating application prototypes and
crosschecking the tests. This former is the case where the code quality is not an issue. What
matters most is that the code is created with as little effort (money) as possible. The latter is
the case where a programmer would like to know what additional possible errors might
arise from a class.
The method we focused on in this chapter is unique in that its’ output is completely
controlled by a context-free grammar. Therefore this method is very flexible and without
any problems or modifications it can be used to generate programs in mainstream
programing languages. We also tried to completely remove the fitness function of the
genetic algorithm and replace it with standardized unit-tests. This can then be thought of as
an extreme form of test-driven development.
34 Advances in Computer Science and Engineering

6. Acknowledgement
This work was supported by the grants: MSM 6215648904/03 and IG1100791 Research
design of Mendel Univeristy in Brno.

7. References
Ahluwalia, M. & Bull, L. (1998). Co-evolving functions in genetic programming: Dynamic
ADF creation using GliB, Proceedings of Evolutionary Programming VII - 7th
International Conference, EP98 San Diego. LNCS Volume 1447/1998, Springer, ISBN-
13: 978-3540648918, USA
Aycock, J. & Horspool, R.N. (2002). Practical Early Parsing, The Computer Journal, Vol. 45,
No. 6, British Computer Society, pp. 620-630, DOI: 45:6:620-630
Beck, K. (2002). Test Driven Development: By Example, Addison-Wesley Professional, 240
p., ISBN 978-0321146533, USA
Büchi, M., Weck, W. (1999). The Greybox Approach: When Blackbox Specifications Hide
Too Much, Technical Report: TUCS-TR-297, Turku Centre for Computer Science,
Finland
Cândida Ferreira (2006a). Automatically Defined Functions in Gene Expression
Programming in Genetic Systems Programming: Theory and Experiences, Studies in
Computational Intelligence, Vol. 13, pp. 21-56, Springer, USA
Cândida Ferreira (2006b). Gene Expression Programming: Mathematical Modelling by an
Artificial Intelligence (Studies in Computational Intelligence), Springer, ISBN 978-
3540327967, USA
Czarnecki, K. & Eisenecker, U. (2000). Generative Programming: Methods, Tools, and
Applications, Addison-Wesley Professional, ISBN 978-0201309775, Canada
Dempsey, I., O’Neill, M. & Brabazon, A. (2007). Constant creation in grammatical evolution,
Innovative Computing and Applications, Vol. 1, No.1, pp. 23–38
Francone, D. F, Conrads, M., Banzhaf, W. & Nordin, P. (1999). Homologous Crossover in
Genetic Programming, Proceedings of the Genetic and Evolutionary Computation
Conference (GECCO), pp. 1021–1026. ISBN 1-55860-611-4, Orlando, USA
Goldberg, D. E. (2002). The Design of Innovation: Lessons from and for Competent
Genetic Algorithms. Kluwer Academic Publishers, 272 p. ISBN 1-4020-7098-5,
Boston, USA
Gunter, C. A. & Mitchell, J. C. (1994). Theoretical Aspects of Object-Oriented Programming:
Types, Semantics, and Language Design, The MIT Press, ISBN 978-0262071550,
Cambridge, Massachusetts, USA
Gusfield, D. (1997). Gusfield, Dan (1997). Algorithms on strings, trees, and sequences: computer
science and computational biology, Cambridge University Press. ISBN 0-521-58519-8.
Cambridge, UK
Kasami, T. (1965). An efficient recognition and syntax-analysis algorithm for context-free
languages. Scientific report AFCRL-65-758, Air Force Cambridge Research Lab,
Bedford, MA, USA
Koza, J. R. (1992). Genetic Programming: On the Programming of Computers by Means of Natural
Selection, The MIT Press, ISBN 978-0262111706, Cambridge, Massachusetts, USA
Koza, J. R. (1994). Gene Duplication to Enable Genetic Programming to Concurrently Evolve
Both the Architecture and Work-Performing Steps of a Computer Program, IJCAI-
Automatic Generation of Programs 35

95 – Proceedings of the Fourteenth International Joint Conference on Artificial Intelligence,


Vol. 1, pp. 734-740, Morgan Kaufmann, 20-25 August 1995, USA
Koza, J.R. et al (2003). Genetic Programming IV: Routine Human-Competitive Machine
Intelligence. Springer, 624 p., ISBN 978-1402074462, USA
Laddad, R. (2009). Aspectj in Action: Enterprise AOP with Spring Applications, Manning
Publications, ISBN 978-1933988054, Greenwich, Connecticut, USA
Mitchell, M. (1999). An Introduction to Genetic Algorithms, MIT Press, 162 p. ISBN 0-262-
63185-7, Cambridge MA, USA
Minařík, M., Šťastný, J. & Popelka, O. (2008). A Brief Introduction to Recognition of
Deformed Objects, Proceedings of International Conference on Soft Computing Applied
in Computer and Economic Environment ICSC, pp.191-198, ISBN 978-80-7314-134-9,
Kunovice, Czech Republic
O’Neill, M. & Ryan, C. (2003). Grammatical Evolution: Evolutionary Automatic Programming in
an Arbitrary Language, Springer, ISBN 978-1402074448, Norwell, Massachusetts,
USA
O'Neill, M., Ryan, C., Keijzer, M. & Cattolico, M. (2001). Crossover in Grammatical
Evolution: The Search Continues, Proceedings of the European Conference on
Genetic Programming (EuroGP), pp. 337–347, ISBN 3-540-41899-7, Lake Como,
Italy
Ošmera P. & Popelka O. (2006). The Automatic Generation of Programs with Parallel
Grammatical Evolution, Proceedings of: 13th Zittau Fuzzy Colloquium, Zittau,
Germany, pp. 332-339
Ošmera P., Popelka O. & Pivoňka P. (2006). Parallel Grammatical Evolution with Backward
Processing, Proceedings of ICARCV 2006, 9th International Conference on Control,
Automation, Robotics and Vision, pp. 1889-1894, ISBN 978-1-4244-0341-7, Singapore,
December 2006, IEEE Press, Singapore
Patterson, N. & Livesey, M. (1997). Evolving caching algorithms in C by genetic
programming, Proceedings of Genetic Programming 1997, pp. 262-267, San
Francisco, California, USA, Morgan Kaufmann
Poli, R. (2002). Automatic generation of programs: An overview of Lyee methodology,
Proceedings of 6th world multiconference on systemics, cybernetics and informatics, vol. I,
proceedings - information systems development I, pp. 506-511, Orlando, Florida,
USA, July 2002
Popelka O. (2007). Two-level optimization using parallel grammatical evolution and
differential evolution. Proceedings of MENDEL 2007, International Conference on Soft
Computing, Praha, Czech Republic. pp. 88-92. ISBN 978-80-214-3473-8., August 2007
Popelka, O. & Šťastný, J. (2007). Generation of mathematic models for environmental data
analysis. Management si Inginerie Economica. Vol. 6, No. 2A, 61-66. ISSN 1583-624X.
Price, K. (1999). An Introduction to Differential Evolution. In: New Ideas in Optimization.
Corne D., Dorigo, M. & Glover, F. (ed.) McGraw-Hill, London (UK), 79–108, ISBN
007-709506-5.
Salsi, U. (2007). PHP 5.2.0 EBNF Syntax, online: http://www.icosaedro.it/articoli/php-
syntax-ebnf.txt
Smith, D. R. (1999). Mechanizing the development of software, In: Nato Advanced Science
Institutes Series, Broy M. & Steinbruggen R. (Ed.), 251-292, IOS Press, ISBN 90-5199-
459-1
36 Advances in Computer Science and Engineering

Šťastný, J. & Minařík, M. (2006). Object Recognition by Means of New Algorithms,


Proceedings of International Conference on Soft Computing Applied in Computer and
Economic Environment ICSC, pp. 99-104, ISBN 80-7314-084-5, Kunovice, Czech
Republic
TIOBE Software (2010). TIOBE Programming Community Index for June 2010, online:
http://www.tiobe.com/index.php/content/paperinfo/tpci/
Wong M. L. & Leung K. S. (1995) Applying logic grammars to induce sub-functions in
genetic programming, Proceedings of 1995 IEEE International Conference on
Evolutionary Computation (ICEC 95), pp. 737-740, ISBN 0-7803-2759-4, Perth,
Australia, November 1995, IEEE Press
Zend Technologies (2010). Zend Engine – Zend Language Parser, online:
http://svn.php.net/repository/php/php src/trunk/Zend/zend_language_parser.y
3

Application of Computer Algebra into the


Analysis of a Malaria Model using MAPLE™
Davinson Castaño Cano
EAFIT University
Colombia

1. Introduction
At the moment, we are at the edge of a possible biological trouble. Some people say that the
19th century was the century of chemistry, the 20th was the century of physics, and they say
that the 21st will be the century of biology. If we think, the advances in the biological field in
the recent years have been incredible, and like the physics and its atomic bomb, with biology
could create global epidemics diseases. Also the climate change could produce a new virus
better than the existing virus, creating an atmosphere of panic, such as the influenza A (H1N1)
in recent years or Malaria who still killing people. To go a step further, we use computer
science in the improvement of disease prevention (Baker, 2007; Magal & Rouen, 2008).
For beginning, we mention quickly some plagues in history such as the Black Death as an
example of Bubonic plague, and we present from their basic concepts the most common
classical epidemic models.
We present a transmission malaria model with inhomogeneities in a human population,
which is proposed in terms of SIR coupled models for human and mosquitoes, which are
described by differential equations. The human population is considered divided into
several groups depending on genetics profiles, social condition, differentiation between
rural or urban people, etc. Within malaria model we consider that mosquitoes bite humans
in a differentiated way in accordance with the inhomogeneity. We use an algorithm for the
analysis from local stability of the infection-free equilibrium and that algorithm is
implemented on Maple™. This algorithm consists on determinate the characteristic
polynomial from Jacobian matrix of the model and the analysis of their eigenvalues using
Routh-Hurwitz theorem. As a result we obtain the basic reproductive number for malaria
(Ro) and the threshold condition for a malaria epidemic triggering (Ro>1). From this result
we can derivate effective control measures for avoiding malaria outbreaks and determinate
the minimum level of income for a community becomes free of malaria infection. This work
pretend to show the symbolic computing potential from CAS (Computer Algebra Systems),
in our case Maple™, for analysing automatically complex epidemic models and the
usefulness of them for designing and implementing public health politics.

2. Historical survey of epidemiological models


In this first part of the chapter, we are going to mention two aspects to capture your
attention, the first one is a little tour for history where we refer to some of the most tragic
38 Advances in Computer Science and Engineering

plagues, but we just pretend to show some examples of diseases for that reason it is not all
the history of each plague, and the second one is a presentation of the most common models
used in epidemics problems such as SIS, SIR and SEIR models, trying to explain their
dynamics. This model models can be used in other sciences such as economics, biology, etc.
(Perthame, 2007)

2.1 Epidemic infections


It’s true that in our time, every year is more difficult to find an outbreak in the developed
countries, but it isn’t the same situation in the developing countries, in which the epidemics
problems appear frequently (Porta, 2008).
Initially, human diseases began with the change of their way to live, the first change was
when humans learnt the agriculture which made possible that more people could live in the
same place, this situation produced problems on healthiness and then, the diseases started.
The next step in the change of life was domesticating animals, which gave us some disease
because of their genetic changes. Some of the diseases that we have thanks to animals are
Measles, Tuberculosis, Smallpox, Influenza, Malaria, between others.
We introduce the Bubonic Plague who had his biggest spreading with the name Black Death in
mid-fourteenth century, it received his name because of the black skin that people had when
they were dying. This plague is spread by vectors that could be rats and other small
mammals, and their fleas. Some cases of this plague were reported in Athens in the
Peloponnesian War, and after the 14th century, in the World War II, Japan spread infected
fleas over some cities in China (Christakos et al., 2005; Gottfried, 1983).
Now we talk about Malaria and Yellow Fever, both diseases are transmitted by flies and it for
that reason that these diseases are very dangerous because his range of spread could be
extremely wide. In the case of the Malaria the historians believe that its beginning was in the
apes in Africa, this disease is also called Burning Ague because of intermittent painful fevers.
The Yellow Fever is called “Yellow Jack”, the name yellow is for the colour that people have
with this illness. These diseases are described even in the bible, the old testament, Leviticus
26:16, “then I will do this to you: I will visit you with panic, with wasting disease and fever that
consume the eyes and make the heart ache...“ and Deuteronomy 28:22, “The LORD will strike you
with wasting disease and with fever, inflammation and fiery heat...“ And in present days still
happen even more in countries near to the equatorial line because the mosquitoes find ideal
conditions to survive, temperature between 20°C and 30°C, and humidity over 60%.
As a final example of infections, we bring the Smallpox and Measles, which are the most
severe example of how humans appear the diseases, and these diseases have the highest
fatality rate in the history, surpassing even the medieval Black Death. The Smallpox was
widely used in the process of America’s conquest with the intension of decimate the native
population. With the last phrase we note the human intention to use biological weapons,
and it’s worrying to think in the biological weapon that we could have with the actual
technologies (Bollet, 2004).

2.2 Models used


Now, we talk about some models used to predict the behaviour of the population along an
infection. The models we show here are classical in epidemiology and they are differential
equations systems (Stewart, 2002). We won’t show the equations systems because they
depend on the characteristics of the epidemic, but we will show some diagrams. If you want
Application of Computer Algebra into the Analysis of a Malaria Model using MAPLE™ 39

to find the mathematical expressions, you can see the references (Brauer et al., 2008;
Capasso, 2008; Ma & Xia, 2009; Daley & Gani, 2005). All these models have been formulated
by great researchers who have contributed to the development of the techniques of diseases
dynamics treatment, also it’s important to note that the difficulty for the accuracy in these
models is the obtaining of the parameters (Bellomo, 2008).
• SIS Model
This model is the simplest model in epidemiology because it has only two population
groups the susceptible and the infected, which are related by λ and γ functions that could
depend on time or be just a constant, these functions are named: λ is the infectious rate
function and γ is the recovering rate function. Also, it is a model with a boucle or feedback.
It could easily model a pneumonia disease (Ma & Xia, 2009).

Fig. 1. Representation of the SIS Model


• SIR Model
Now, we present a model which has been widely used. In this model is included a new
group, the Recovered group which is immune of the infection, in this chapter we are going
to use a modified version of this model, with this system we can model a lot of diseases
related to viruses such as Malaria, Influenza, Smallpox, Measles, Rubella, Yellow Fever,
Dengue Fever, etc. (Castaño C., 2009; Ma & Xia, 2009).

Fig. 2. Representation of the SIR Model


• SIRS Model
This model is basically the same SIR model except for the temporal immunity and the
recovered people will be susceptible again after a time. In this model apart from the λ and γ
functions is included a third relation function ξ which represent the susceptible creation
rate. This model is used in the same cases of the SIS model such as Gonorrhoea, Typhoid
Fever, Tuberculosis, Cholera, Meningitis, etc. The election depends on the person, if he
wants to have in count the immunity time (Capasso, 2008).
40 Advances in Computer Science and Engineering

Fig. 3. Representation of the SIRS Model


• SEIR and SEIRS Models
These models are more elaborated because they included another group which is called the
Exposed group that means; a person who has a contact with an infected person, he become
exposed and passed certain time he become infected and start infecting too. The dynamics of
the SEIR and SEIRS model is very similar to the SIR and SIRS models, respectively. Also, in
these models appear a new function β that is the exposition rate.

Fig. 4. Representation of the SEIR Model

Fig. 5. Representation of the SEIRS Model


Apart from these models there are others like the M-Models which included in the M-group
that is for the newborns who have a passive immunity in the moment of birth and after
they will be part of the susceptible group (S-Group). If you want to clarify some concept of
these models, we recommend reading the book of Basic Epidemiology (Bonita et al., 2006).

3. Malaria SIR coupled model


Now, we present the work we did based in the SIR model, which is coupled with other
equal. These coupled models are for the human population and the vectors that allow model
Other documents randomly have
different content
13Large sumi-yé. An actors' boating party on the Sumidagawa.
14Large tan-yé. The actors Yoshizawa Ayame and Kanto Koroku.
15Large tan-yé. The actors Kanto Koroku and Ikushima Daikichi.
16Large beni-yé. Ichikawa DanjuÌ roÌ as an enraged warrior.
17Beni-yé. Onoe KikugoroÌ in a female rôle.
18Beni-yé. Scene from a drama. The actors Tomazawa SaijiroÌ
(on horseback), OÌ tani Hiroji, and Segawa KikunojoÌ . The
beni has turned to a low-toned yellow.
19Urushi-yé. Scene from a drama. OÌ tani Oniji (on horseback)
threatening Sannogawa Ichimatsu in the rôle of a woman
who has seized his bridle rein.
20Beni-yé. Scene from a drama. Sawamura SojuÌ roÌ as
Sasaki no SaburoÌ and Nakamura TomijuÌ roÌ as Mago
no Koroku.

FURUYAMA MOROMASA

Pupil, and perhaps the son, of Moronobu. He devoted himself chiefly


to painting, but designed a few prints, most of which are ukiyé, or
perspective pictures, in the style of Okumura Masanobu.

LENT BY THE ESTATE OF FRANCIS LATHROP, DECEASED

21Large hand-coloured ukiyé, or perspective print. A game of


ken in a room in a nobleman's house.

OKUMURA MASANOBU

One of the most eminent of the Ukiyoé artists. His drawings were
greatly admired for their rare combination of force and refinement,
and he exercised wide influence over his contemporaries and
successors to the end of the eighteenth century. He was the first
artist to use blocks from which prints were coloured in flat tints.
These were printed in the red known as beni, green, and black, and
were known as beni-yé. He was also the first artist to make the tall,
narrow pillar prints (ha-shira-yé), and was the inventor of the
perspective prints which he called ukiyé. His true name was
Okumura Genpachi, and he was commonly known as honya
(bookseller) Genpachi, from the fact that he was the proprietor of a
wholesale and retail book and print shop at the sign of the “red
gourd” in Tori-shio choÌ , Yedo.

LENT BY THE ESTATE OF FRANCIS LATHROP, DECEASED

22Large sumi-yé. Woman seated by a writing-table, reading a


book.
23Urushi-yé. Bando Hikosaburo as a warrior resisting the
opening of a castle door.
24Tall beni-yé. A geisha playing upon a samisen.
25Large sumi-yé. A woman with a pet cat watching a man dip
water from a chozubachi.

LENT BY A COLLECTOR

26Large beni-yé. Segawa KikunojoÌ as an oiran lighting her


pipe at a hibachi in the hands of her kamuro, and Sannogawa
Ichimatsu as a man holding an umbrella over her.
27Undivided beni-yé triptych. Street scene. A boy kneeling to
put on a woman's geta; a man playing upon a shakuhachi;
and another man carrying an umbrella.
28Undivided triptych. Three women carrying umbrellas.
OKUMURA TOSHINOBU

Toshinobu, the son of Masanobu, was an artist of decided talent who


died young. His known works, which resemble those of his father,
are all urushi-yé, and were designed about 1730-1736.

LENT BY A COLLECTOR

29Ichimura Uzaemon as a dancing-girl.


30Woman dressing.
31Sanjo KentaroÌ in a female rôle.

TSUNEKAWA SHIGENOBU

An early Ukiyoé artist of whom little is known. His prints are


extremely rare.

LENT BY A COLLECTOR

32Urushi-yé. Arashi Wakano in the rôle of Shida no KotaroÌ .

NISHIMURA SHIGENAGA

Son of Shigenobu. Born in 1697 and died in 1756. An artist of ability


who exercised marked influence upon the development of the
school. His prints are very uneven in quality.

[pg 35]
LENT BY THE ESTATE OF FRANCIS LATHROP, DECEASED

33Tall hand-coloured print. The actor Sannogawa Ichimatsu as a


woman holding a folded letter.

LENT BY A COLLECTOR

34Urushi-yé. Segawa Kikunojo as a woman holding a warrior's


helmet.
35Beni-yé. Procession of the Corean ambassadors.

ISHIKAWA TOYONOBU

One of the most important of the Ukiyoé masters. Born in 1711, died
in 1785. Pupil of Shigenaga, and probably of Masanobu whose style
he closely assimilated.

LENT BY THE ESTATE OF FRANCIS LATHROP, DECEASED

36Large beni-yé. The actors Segawa Kikunojo and Sannogawa


Ichimatsu.

LENT BY SAMUEL ISHAM.

37Wide print from three colour-blocks. Women and children at


the seashore.

LENT BY A COLLECTOR.
Ì
38Tall hand-coloured print. Segawa KikunojoÌ as a woman
reading a letter.
39Two sheets from a beni-yé triptych. Musume carrying
umbrellas.

LENT BY HAMILTON EASTER FIELD.

40Beni-yé. Mother and son.


41Print from three colour-blocks. Boys rolling a large snowball.
42Print from three colour-blocks. Man struggling with a
refractory umbrella; a woman looking on.

[pg 36]

TORII KIYOHIRO
KIYONAGA. Picnic Party.
Pupil of Kiyomasu. His known works are exclusively beni-yé,
executed from about 1745 to about 1755.

LENT BY HAMILTON EASTER FIELD.

43Beni-yé. Nakamura HatsugoroÌ as Sakura no Suké.

TORII SHIRO

Known as Kiyonobu the second, all of his prints being signed Torii
Kiyonobu. He was the eldest son of Kiyomasu. Worked from about
1740 to about 1755, when it is probable that his death occurred.
Some of the most charming of the beni-yé prints are from his hand.

LENT BY HOWARD MANSFIELD.

44Beni-yé. Yamamoto IwanojoÌ as a woman dancing by a fox-


trap in a rice field under a blossoming cherry tree.

TORII KIYOMITSU

Second son of Kiyomasu, whom he succeeded as the head of the


Torii line. An artist of distinction. Was the first to add a third colour-
block to the original two. He was born in 1735 and died in 1785.
After 1765 he designed only a few prints, and appears to have
designed none later than about 1768.
LENT BY THE ESTATE OF FRANCIS LATHROP, DECEASED

45Wide print from three colour-blocks. The NoÌ performance


of “Musume DoÌ joÌ ji.”
46Wide print from three colour-blocks. Daimyo procession game
by women and children.
47Print from three colour-blocks. Iwai HanshiroÌ as a woman
reading a letter while seated upon a carabao.
48Beni-yé. Scene from a drama. Ichimura KamezoÌ (standing)
as Wakemi GoroÌ and Nakamura TomijuÌ roÌ as Akoya.

SUZUKI HARUNOBU

The central figure in Ukiyoé and the eminent master under whose
hand the art of colour-printing was brought to perfection in the
sixties of the eighteenth century. He was a draughtsman of extreme
elegance and power, and his works have a charm that is peculiarly
their own. He died on July 7, 1770, when, says Shiba Kokan in his
book “Kokan Kokai-ki,” he “had hardly passed his fortieth year.”

LENT BY SAMUAL ISHAM.

49Girl attendant in an archery gallery gathering up arrows. One


sheet of a diptych.
50A young woman showing a caged bird to a young man seated
before her, and surreptitiously taking a love letter from him.
51A vendor of fan mounts stopping to talk to a young woman
standing in front of a shop.
52Hashira-yé. Woman writing a love letter.
53Hashira-yé. Woman holding a pet dog.
54Burlesque scene. Girls carrying Daikoku (the genius of wealth
—one of the “Seven Fortune-beings”).

LENT BY HOWARD MANSFIELD.

55Girls carrying Daikoku. A later impression with different


colouring.
56An archer and two girls near a screen. Calendar for 1765.
57Young woman before a torii, carrying a hammer and nails
with which to perform an incantation.
58Two young women on their way to the public bath-house
through a storm of snow and rain.
59Two girls on a terrace near a torii, in the time of the cherry-
blossoming.
60Two girls gathering mume flowers from a tree overhanging a
wall.
61Woman reading a letter by the light of an andon (portable
lamp with wind screen) which another woman is trimming.
62Geisha and a young girl standing on the bank near the rapids
of the Tamagawa.
63Young woman seated in a window, conversing with another
young woman seated on the floor and holding a picture-book.
64Young man removing snow from the geta of a young woman.
65Woman lying upon the floor of a room, reading a book, and
another woman standing beside her, holding a pipe.
66Young woman seated on a veranda after her bath, having her
back massaged by her maid.
67Young man talking to a girl through the bars of a window.
68A burlesque apparition of Fugen. Instead of the Buddhist
divinity, a young woman seated on an elephant appears on a
cloud before a priest kneeling in prayer.
69Lovers walking in the snow under an umbrella. One of
Harunobu's most distinguished prints.
LENT BY THE ESTATE OF FRANCIS LATHROP, DECEASED.

70The Sleeping Elder Sister. First state. Early impression signed


by the printer, Kyosen.

LENT BY HAMILTON EASTER FIELD.

71The Sleeping Elder Sister. Second state. Changes made in the


blocks and colouring.

LENT BY A COLLECTOR.

72The Sleeping Elder Sister. Still later impression. Colouring


changed again, and the number of blocks increased from ten
to thirteen.

LENT BY HAMILTON EASTER FIELD.

73The Hole in the Wall.


74Mother holding her infant son.
75At the entrance gate.
76Mother taking her infant son from another woman and
handing her a letter.
77Lovers in a palace.

LENT BY A COLLECTOR.

78Musume walking up a flight of steps leading to a temple.


79Lovers playing battledore and shuttlecock; the young man
climbing a ladder to disengage the shuttlecock caught upon
the branch of a mume tree.
80Hashira-yé. Woman in night attire standing by her bedside
reading a letter.

SHIBA KOKAN

An artist who is best known as a clever imitator of his master,


Harunobu, whose signature he forged upon a number of prints. He
also used the “goÌ ,” or studio name, Harushige in signing prints in
the Harunobu manner. In later years he painted pictures in semi-
European style, and made copper-plate engravings which were
coloured by hand. He was born in 1747 and died in 1818.

LENT BY SAMUEL ISHAM.

81The courtyard of a house in the Yoshiwara. A woman reading


a letter and a girl attendant standing beside her holding a
tray. Signed Harunobu.

SHOSHOKEN

This is the pseudonym of an artist of distinction whose identity has


not been determined. His known works are calendar prints for 1765.

LENT BY SAMUEL ISHAM.

82Stout lady crossing a room in a palace supported by two


attendants. The use of gold leaf is notable.
[pg 40]

KITAO SHIGEMASA

One of the noted artists of the school. Was famous for his skill as a
calligrapher, being reputed to have no superior in his day in either of
the “three capitals,” Yedo, Kyoto, or Osaka. His prints, which are
rare, are generally of much distinction. He was born in 1740, and
died in the second month of Bunsei 3 (February or March, 1820).

LENT BY HOWARD MANSFIELD.

83Children's puppet show.

LENT BY THE ESTATE OF FRANCIS LATHROP, DECEASED.

84Beni-yé. Segawa KikunojoÌ and Ichimura Uzaemon as


Izumo no Okuni and Nagoya Sanza, two komuso, playing
upon shaku-hachi.

LENT BY A COLLECTOR.

85Two geishas.

ISODA KORYUSAI
The most important pupil of Harunobu, whose style he followed
closely in his early works. Later he developed a manner of his own.
As a designer of pillar prints and of prints of birds, he was especially
successful. He was a samurai and associated with samurai of the
superior class. The director of the mint was one of his most intimate
friends and patrons. About 1781 he gave up print-designing, devoted
himself to painting, and was given the honorary title of Hokyo. The
dates of his birth and death are not known.

LENT BY SAMUEL ISHAM.

86Hashira-yé. Musume leaping from the balcony of Kiyomidzu


temple with an umbrella as a parachute.
87Woman standing on the engawa of a house, admiring snow-
laden bamboo branches; back of her, a girl and a young boy
looking through a window.
88A Yoshiwara beauty arranging flowers; two girl attendants
looking on.

LENT BY A COLLECTOR.

89Hashira-yé. Musume carrying her infant brother.


90Hashira-yé. Young woman poling a boat in a lily-pond.

LENT BY THE ESTATE OF FRANCIS LATHROP, DECEASED.

91A Yoshiwara beauty on parade, attended by a girl and a boy.


92Hashira-yé. The bijin JuroÌ jin. A young woman is
represented in place of the long-life being whose attributes
are a crane and a tortoise.
KATSUKAWA SHUNSHO

A contemporary of Harunobu and one of the greatest of the Ukiyoé


artists. He was highly renowned in his day and had many pupils who
became famous. Most of his prints were portraits of actors in
character. He was born in 1726 and died on January 22, 1793.

LENT BY THE ESTATE OF FRANCIS LATHROP, DECEASED.

93Segawa Kikunojo as a woman holding a red fan.


94Two actors in character. The seated figure is DanjuÌ roÌ ,
the leading “star” of the Yedo stage.

LENT BY SAMUEL ISHAM.

95Actor in a female rôle.

LENT BY HOWARD MANSFIELD.

96Iwai HanshiroÌ as a woman standing and holding a fan


behind her.
97Yamashita Kinsaku in a female rôle.
98Actor of the Ichikawa line in the rôle of Shibaraku at the
Ichimura theatre.
99OÌ tani Hiroji as an Amazake vendor.
100Hashira-yé. Nobleman carrying a court lady on his back.
Probably a parody upon the suicide of Ohan and Choyaemon.
101Wide hashira-yé. The Woman in Red.

Ì
IPPITSUSAI BUNCHOÌ

An artist of samurai rank who, for a few years, designed actor prints
in the manner of Shunsho, which have great distinction of style and
colour. He was celebrated also as a writer of comic odes. He died on
May 18, 1796.

LENT BY THE ESTATE OF FRANCIS LATHROP, DECEASED.


BUNCHO. Actor as Woman talking to Men.
102Bando Hikosaburo as a woman of the Yoshiwara talking to a
group of men through the misé.
103Nakamura TomijuÌ roÌ as Josan no Miya.
KIYONAGA. Man and two Women approaching Temple.
LENT BY SAMUEL ISHAM.

104A Yoshiwara beauty accompanied by her kamuro (girl


attendant) bearing a cage of fireflies.

LENT BY HOWARD MANSFIELD.

105Ichikawa KorazoÌ as a man carrying an actor's dressing-


case.

LENT BY HAMILTON EASTER FIELD.

106Scene from a drama. Yamashita Kinsaku as a woman holding


a roll of paper, conversing with Ichikawa KomazoÌ , who
holds a letter in his hand.

KATSUKAWA SHUNKOÌ

Pupil of Shunsho and generally regarded as his most talented


follower. His career as a print-designer was cut short by a stroke of
paralysis when he was in his forty-fifth or forty-sixth year, but he
lived for about [pg 43] forty years thereafter as a recluse at
Zenfukuji temple, Azabu, Yedo, where he died in 1827.

LENT BY SAMUEL ISHAM.

107Iwai Hanshiro in a female rôle.


108The actor Ichikawa Monnosuke.
109Nakamura TomijūroÌ as a tsuzumi player.
LENT BY HOWARD MANSFIELD.

110Arashi Tatsuzo as a woman flower-vendor.

KATSUKAWA SHUNYEI

Pupil of ShunshoÌ and an artist of ability. At first, for a short time,


he called himself ShunjoÌ . He was born in 1767, and died on
December 13, 1819.

LENT BY THE ESTATE OF FRANCIS LATHROP, DECEASED.

111A bijin.

LENT BY HOWARD MANSFIELD.

112Ichikawa Monnosuke in a female rôle.

LENT BY SAMUEL ISHAM.

113Scene from the tenth act of “Chushingura.”


114Ichikawa KomazoÌ .

UTAGAWA TOYOHARU

Pupil of Toyonobu. As a painter his reputation is justly high. He did


not design many prints. He was born in 1735 and died on March 3,
1814.

LENT BY THE ESTATE OF FRANCIS LATHROP, DECEASED.

114Cock, hen and chickens.

[pg 44]

TORII KIYONAGA

Everything considered, the greatest artist of the Ukiyoé school and


the culminating figure in its forward movement. He was born in 1742
and died in 1815. His finest prints were designed between 1780 and
1790.

LENT BY SAMUEL ISHAM.

116The Writing-lesson.
117Fair travellers resting on a bench by the roadside.

LENT BY THE ESTATE OF FRANCIS LATHROP, DECEASED.

118Two geishas entertaining a young man.


119Court ladies on the engawa of a palace.

LENT BY HOWARD MANSFIELD.


120Three girls going to the baths at the hot springs near
Miyanoshita.
121Man and two women masquerading in komusoÌ attire.
122Group of three women and a boy.
123Two women standing beside a seated geisha who is playing
on a samisen.
124Yoshiwara beauty attended by two women (shinzo) and two
girls (kamuro).
125Two young women and a servant on the balcony of an inn.
126Family group on their way to a temple for the naming
ceremony of the boy who is carried on the shoulders of an
attendant.
127An actor and two women examining utensils for the tea
ceremony.
128Women and children promenading in summer costume.
129Scene from a drama. Two actors playing the game of “go”
with mume blossoms, and a third actor as a woman in the
rôle of an umpire standing between them.
130Two young women walking under an umbrella and followed
by a servant.
131Man in a black haori approaching a temple through the snow,
accompanied by two women.
132Diptych. Group of women under a cherry tree.
133Diptych. Holiday group under the cherry trees at Gotenyama.
One of a series of twelve diptychs that are among Kiyonaga's
finest works.
134Boating party under Ryogoku bridge. Two sheets of a triptych.
135Triptych. The Peony (botan) Show.
136Triptych. Women landing from a pleasure boat.

LENT BY A COLLECTOR.

137Hashira-yé. Woman in winter costume.


138Triptych. A picnic party under the cherry trees.
139Group of women on the bank of the Sumida river.
140Group of women near a temple.
141Three women at a public bath-house.

KATSUKAWA SHUNCHO

Pupil of ShunshoÌ . Followed the style of Torii Kiyonaga. His works


closely resemble those of the Torii master, but have less force.
Worked from about 1775 to about 1795. In some of his later prints
he imitated Eishi's prints in the Utamaro manner. The dates of his
birth and death are not known.

LENT BY SAMUAL ISHAM.

142One sheet of a triptych showing a nobleman's mansion from


the garden, with the people engaged in various occupations.

LENT BY HOWARD MANSFIELD.

143Women watching girls bouncing balls.


144Diptych. Group at the entrance to a temple.
145Three women in a temple compound.
SHUNCHO. Women watching Girls bouncing Balls.
[pg 46]

LENT BY HAMILTON EASTER FIELD.

146Group of girls at a tea booth by the seashore.

LENT BY A COLLECTOR.

147A picnic party. Two sheets of a triptych.


148Women picking wild flowers under a cherry tree in bloom.

HOSODA EISHI

One of the foremost artists of the school. He was a samurai of high


rank, and a pupil of Kano Eisen. For three years before he took to
Ukiyoé he held an official post in the household of the shogun
Iyeharu. Eishi was a master of all the resources of the art of colour-
printing and his prints are characterized by great elegance and
refinement. He worked from about 1782 to 1800, when he gave up
print-designing. He died in 1829.

LENT BY SAMUAL ISHAM.

149Triptych. Eight women and a man playing the game of “Catch


the fox.”
150Group of Yoshiwara women and attendants.
151Someyama and her kamuro playing with a pet dog.
152Yoshiwara women admiring a branch of mume tree with
unopened flower buds.
153Triptych. Fête in a nobleman's palace. Ladies composing
poems.
EISHI. Fête in a nobleman's palace.
LENT BY MRS. WILLIAM BENJAMIN WOOD.

154Another copy of the foregoing triptych. Shows how beautifully


the purple changes by chemical decomposition.

LENT BY HOWARD MANSFIELD.

155Oiran and attendants on parade.

LENT BY A COLLECTOR.

156A Yoshiwara beauty. Ink proof of the key block.


157Two women entering a room in the palace of Prince Genji,
where a young girl is seated playing with a kitten.

YEISHOSAI CHOKI

An artist of ability, though not quite of the first rank. His prints are
rare. He worked at first in the style of Kiyonaga. Later he imitated
Utamaro, and changed his “goÌ ,” or studio name, to Momokawa
Shiko.

LENT BY A COLLECTOR.

158Woman and child catching fireflies.

TOSHUSAI SHARAKU
This artist was by profession a performer of the stately and
aristocratic No dramas in the service of Hachisuka, Daimyo of Awa.
During the period from about 1790 to 1795 he designed a small
number of caricature portraits of actors, which have great force and
distinguished character.

LENT BY YAMANAKA & COMPANY.

159The actor7 Tanimura TorazoÌ in the rôle of Kakogawa


HonzoÌ .
160Ichikawa EbizoÌ in the rôle of Ko no Moronao. This print
bears an inscription, probably contemporary, giving the date
1794.
161Onoe Matsusuke as one of the Loyal Ronin.
162Rando HikosaburoÌ in the rôle of Yuranosuke.
163Iwai HanshiroÌ in the rôle of Oishi, wife of Yuranosuke.
164Ichikawa Monnosuke as one of the Loyal Ronin.
165Morita Kanya as one of the Loyal Ronin.
166Segawa TominojoÌ in the rôle of Kaoyo Gozen, wife of
Yenya.
167Sawamura SojuÌ roÌ in the rôle of Yenya Hanguwan.
168Arashi TatsuzoÌ in the rôle of Yoichibei.
169Sakata HangoroÌ as Ten-ichi-boÌ Hotaku.
170Segawa TominojoÌ and Nakamura ManjuÌ roÌ in female
rôles.
171Nakajima Utaemon and Nakamura KonozoÌ .
172Ichikawa OmezoÌ in the rôle of Sukeroku.
173Matsumoto KoshiroÌ in the rôle of the otokadaté Banzuin
Chobei. This print is commonly known as “The man with the
pipe.”
174Matsumoto YonesaburoÌ in the rôle of Okaru, wife of
Kampei.
175Ichikawa YaozoÌ in the rôle of Hayano Kampei.

Ì
Welcome to our website – the perfect destination for book lovers and
knowledge seekers. We believe that every book holds a new world,
offering opportunities for learning, discovery, and personal growth.
That’s why we are dedicated to bringing you a diverse collection of
books, ranging from classic literature and specialized publications to
self-development guides and children's books.

More than just a book-buying platform, we strive to be a bridge


connecting you with timeless cultural and intellectual values. With an
elegant, user-friendly interface and a smart search system, you can
quickly find the books that best suit your interests. Additionally,
our special promotions and home delivery services help you save time
and fully enjoy the joy of reading.

Join us on a journey of knowledge exploration, passion nurturing, and


personal growth every day!

ebookbell.com

You might also like