1 Introduction
Recent advances in sensing, actuation, communication, and computation technologies, as well as innovations in their integration within increasingly smaller, interconnected devices, has lead to the emergence of a new and fascinating class of systems, the socalled cyberphysical systems (CPS). Examples of CPS include smart grids, smart factories, smart transportation, and smart healthcare [4].
Similarly to living organisms, CPS operate in an uncertain, continuously evolving ecosystem, where they compete for a limited supply of resources. For survival, CPS need to continuously adapt, such that, they react in real time and optimal fashion, with regard to an overall survival metric, their partial knowledge, and their bounded sensing, actuation, communication and computation capabilities.
In order to equip CPS with such exceptional features, various researchers have started to wonder weather our current CPS analysis, design and implementation techniques are still adequate. Going back to Parnas, Chaudhuri and Lezama identified in a series of intriguing papers [25, 6, 7], the ifthenelse construct as the main culprit for program frailness. In a simple decision of the form if (x > a), the predicate acts like a step function (see Figure 1), with infinite plateaus to the left and to the right of the discontinuity point . In a typical midsize program, the nesting of thousands of ifthenelse conditions leads to a highly nonlinear program, consisting of a large number of plateaus separated by discontinuous jumps. This has important implications.
From a CPSanalysis point of view, predicates of the form , where is a nonlinear analytic function, are a disaster. They render CPS analysis undecidable. Intuitively, in order to separate all points on one side of the curve , from all on the other side, one needs to forever decrease the size of a grid, in all the rectangles that are crossed by the curve. Such a process does never terminate, except for linear functions where computation is still prohibitive. For this reason, a series of papers, of Fraenzle, Ratschan, Wang, Gao and Clarke [11, 27, 32, 12], proposed the use of an indifference region (see Figure 1), and rewrite the predicates in the form . This approach not only makes program analysis (wrt. reals) decidable, and computable in polynomial time, but it also aligns it with the finite computational precision available in today’s computers.
From a CPSdesign point of view, where one is interested to find the values of for which an optimization criterion is satisfied, predicates of the form are a nightmare. They render CPS optimization intractable. Intuitively, a gradientdescent method searching for a local minimum, gets stuck in plateaus, where a small perturbation to the left or to the right, still keeps the search on the same plateau. In order to alleviate this problem, Chaudhuri and Lezama [6] proposed to smoothen the steps, by passing a Gaussian input distribution through the CPS. This can be thought of as corresponding to the sensing and actuation noise. The parameters of this distribution control the position of the resulting sigmoidal curve (see Figure 1), and its steepness, that is, the width of the above indifference region . The authors however, stopped short of proposing a new programming paradigm, and the steplike functions in the programs to be optimized, posed considerable challenges in the analysis, as they cut the Gaussians in very undesirable ways.
From a CPSimplementation point of view, conditional statements of the form if (f(x) > a) are also a disaster. They render CPS frail and nonadaptive. In other words, a small change in the environment or the program itself, may lead to catastrophic consequences, as the CPS is not able to adapt. In the AI community, where steps are called hard neurons and sigmoid curves are called soft neurons
, adaptation and robustness is achieved by learning a particular form of Bayesian networks with softneuron distributions, called neural networks. Such networks, and in particular deep neural networks, have recently achieved amazing performance, for example in the recognition of sophisticated patterns
[8, 10]. This technology looks so promising that major companies such as Google and Amazon are actively recruiting experts in this area. However, the neuralnetworks learned are still met with considerable opposition, as it is very difficult, if not impossible, to humanly understand them.Having identified the ifthenelse programming construct as the major source of trouble in the analysis, design and implementation of CPS, the following important question still remains: Is there a simple, humanly understandable way to develop robust and adaptive CPS? It is our belief, that such a way not only exists, but it is also amazingly simple!
First, as program skeletons express domain knowledge and developer intuition, they are here to stay. However, one needs to replace hard neurons with their soft counterparts. We call such program statements neural ifthenelse statements, or nifthenelse for short. They represent probabilistic, probit distributions, and the decision to choose the left or the right branch is sampled from their associated Gaussian distributions. As a consequence, a program with nif statements represents not only one, but a very large (up to the computational precision) set of correct executions.
Second, the partial knowledge of such a program is encoded as a Bayesian network, expressing the conditional dependencies among the Gaussian distributions occurring within the nif statements. These dependencies may be given, learned through a preliminary phase and continuously improved during deployment, or inferred through optimization techniques. In this case, learning and optimization are considerably simplified, as the program is by definition smooth. The depth and the branching structure of these Bayesian networks reflect the sequential and parallel nesting within the program, which is an essential asset in program understanding.
For example, a parallel algorithm for pattern recognition, may possess a quadtree Bayesian structure, hierarchically reflecting the neighbourhood relation among subimages. The depth of the network is determined by the height of the tree. Similarly, a purely sequential program, representing successive decisions, will have a very linear Bayesian structure, whose depth is determined by the number of decisions.
In order to validate our new paradigm, we use the parking example from [5]. The goal of this example was to automatically learn the parameters of a program skeleton, intuitively expressing the control as follows: Go backwards up to a point , turn up to an angle , go backwards up to , turn again up to and finally go backwards up to . Since this program uses classical if statements, it is not adaptive, and a small perturbation such as a slippery environment, may lead to an accident. We therefore rewrite the program with nif statements, and learn the conditional Gaussian network associated with the predicates within these statements. Using its sensors, the control program is now able to detect the actual stopping or turning points, and to adequately sample its next targets. Although this program is written once and for all, it is able to adapt to a varying environment.
The main contributions of the work presented in this paper can be therefore briefly summarized as follows:

We propose a new programming paradigm for the development of smooth and adaptive CPS in which:

Troublesome ifs are replaced by neural ifs, thus improving analysis, design and implementation,

Partial knowledge is encoded within a learned Bayesian network, with Gaussian distributions.


We demonstrate the versatility of this programming paradigm on a parking example using Pioneer rovers. The associated youtube videos are available at [2].
Given obvious space limitations, we do not address CPSanalysis and CPSdesign (optimization) in this paper. They will be the subject of a series of follow up papers.
The rest of the paper is organized as follows. In Section 2
we introduce Bayesian inference, Bayesian networks, and Gaussian and Probit distributions. In Section
3 we introduce our programming paradigm. In Section 4 we discuss how to learn the Gaussian Bayesian network. In Section 5 we discuss our implementation platform and the associated results. In Section 6 we discuss related work. Finally in Section 7 we give our concluding remarks and directions for future work.2 Background
The main tool for logical inference is the ModusPonens rule: Assuming that proposition is true, and that from the truth of one can infer the truth of proposition , one can conclude that propositions and are both true. Formally:
In probability theory, the uncertainty in the truth of a proposition (also called an event) is expressed as a probability, and implication between propositions is expressed as a conditional probability. This leads to a probabilistic extension of ModusPonens, known as the
Bayes’ rule. Formally:This rule, consistent with logic, is the main mechanism for probabilistic inference [28]. It allows to reason in both forward, or causal way, and backwards, or diagnostic way. For example if is causally implied by , then the left term in the above equation denotes a causal relation, and the right term, a diagnostic relation. Equating the two, allows one to use causal information (or observed events), for diagnostic inference. In realworld systems, causal relations are usually chained and can form sophisticated structures.
Bayesian Networks
A probabilistic system is completely characterized by the joint probability distribution of all of its (possibly noisy) components. However, the size of this distribution typically explodes, and its use becomes intractable. In such cases, the Bayes’ rule, allows to successively decompose the joint distribution according to the conditional dependences among its
random variables (RV). These are both discrete or continuous variables, which associate to each value (or infinitesimal interval) in their range, the rate of its occurrence. Networks of conditional dependencies among random variables are known as
Bayesian networks (BN), and they have a very succinct representation.Syntactically, a BN is a direct acyclic graph , where each vertex represents a random variable and each edge represents a conditional dependence of the variable on the variable . To avoid the complications induced by the use of the joint probability distribution (or density), each variable is associated with a conditional probability distribution (CPD) that takes into account dependencies only between the variable and its direct parents [28, 20]. Such a compact representation keeps information about the system in a distributed manner and makes reasoning tractable even for large number of variables.
Although in many interesting applications the variables of a BN have discrete distributions (e.g. in fault detection, a device might have only a finite number of diagnosable errors, caused by a finite set of faults), in many other applications, continuous random variables naturally describe the entities of interest. For instance, in our
parallel parking running example, a Pioneer rover starting from an initial location, needs to execute a sequence of motion primitives (e.g. driving or turning forward or backward with fixed speed for a particular distance or angle ), which will result in parking the rover in a dedicated parking spot.Gaussian Distributions
Any real measurement of a physical quantity is affected by noise. Hence, the distances and the angles occurring in our parking example are naturally expressed as continuous RVs. In this paper we assume that variables have Normal, also called, Gaussian distributions (GD). These distributions naturally occur from the mixing of several (possibly unobservable) RVs, and they have mathematical properties making them very attractive.
An univariate Gaussian distribution (UGD) is denoted by and it is characterized by two parameters: The mean and the variance . In our example, the desired distance in the first motion is associated with
, which is perturbed by noise with variance
. The Gaussian probability density of a RV with values is defined as follows:(1) 
Parallel parking includes a sequence of motion primitives that are mutually dependent. To express these dependencies we use a multivariate Gaussian Distribution (MGD) [15], which generalizes the Gaussian distribution to multiple dimensions. For a
dimensional vector of random variables
the probability density function is characterized by a
dimensional mean vector and a symmetric positive definite covariance matrix . To express the probability density of a multivariate Gaussian distribution we use the inverse of covariance matrix, called precision matrix , which will be helpful later during the learning phase. The probability density then can be written as follows[24]:(2) 
where .
A Gaussian BN (GBN) is a BN where random variables associated to each node in the network have associated a Gaussian distribution, conditional on their parents .
Probit Distributions
In order to smoothen the decisions in a program, we need to choose a function without plateaus and discontinuities. Since we operate with Gaussian random variables, the natural candidate is their cumulative distribution function (CDF). This is an Sshaped function or a sigmoid (see Figure 2), whose steepness is defined by , where denotes the error function:
(3) 
For a particular value of , the function returns the probability that a random sample from the distribution will belong to the interval .
Since the sensors and actuators of the Pioneer rover are noisy, the trajectories it follows are each time different from the optimal one (assuming that such difference is tolerated by the parking configuration), even if the optimal trajectory of the parking example is known. To be adaptive we use a combined approach: we incorporate probabilistic control structures in the program (introduced in the Section 3
) and sample commands from a GBN, whose parameters were learned experimentally. To detect changes in the environment and get more accurate position estimates, data from various sensors are combined with a sensor fusion algorithm.
3 Neural Code
Traditional inequality relations (e.g. , , , ) define a sharp (or firm) boundary on the satisfaction of a condition, which represents a step function (see Fig 1). Using firm decisions in a program operating on Normal RVs, cuts distributions in halves, leaving unnormalized and invalid PDFs (see Figure 3: The upper right plot shows the approximation of the PDF after passing a Normal RV through a traditional conditional statement). Hence, to keep a proper PDF after passing a Normal RV through an if or a loop statement one needs to perform a renormalization of the PDF.
In order to avoid reshaping of probability density each time after a variable is passed through a condition, we introduce a special type of control structure called neural if, or nif for short. The name is coined to express the key novelty of our approach: We propose to use a smooth conditionals instead of firm ones (see Figure 1). A nif statement operates on an inequality relation and a variance , and decides which branch should be taken: nif(x y,), where can be replaced with (, , or ) and represents the uncertainty of making a decision. For the case when (no uncertainty) we require the nif statement to behave as a traditional if statement.
The evaluation of the nif() statement is explained on hand of the following example, where x, a and .
The evaluation is done in two steps: (i) Find an interval representing the confidence of making the decision; (ii) Check if a sample from the GD belongs to .
Since the input RV has a GD, and a GD is used to evaluate the condition, the result is a product of two GDs, which is also a GD scaled by some constant factor . To find in (i), we estimate the difference diff(x,a) between x and a. For the general case nif(x a,), with arbitrary , the difference diff(x,a) is defined as below, where represents the smallest real number on a computer.
Informally, our confidence is characterized by the difference: The larger diff(x,a) is, the larger is the probability of executing S1. The probability to execute S1 is given by and is used to obtain the interval
by calculating two symmetric quantiles
and such that:(4) 
In the second step a random sample from the distribution is checked to belong to the interval . If it is within the interval, S1 is executed, otherwise S2. At this point the probability value to execute S1 is influenced by the variance (see Figure 2). Hence, the dependence is twofold: diff(x,a) shows how confident we are in making a decision, and characterizes the uncertainty.
For the case the nif statement is
equivalent to the if statement. For infinitesimal
the PDF is expressed as a Dirac function , which has the
following properties:
(i) if else
(ii) .
The Dirac function essentially concentrates all the PD in a single
point . In this case the becomes a step function (see
Figure 1). We consider two cases, as follows:
(i) and
(ii) . In the first case the probability
of executing S1 is equal to , hence the interval is
and includes every possible sample; for the
second case the probability of taking S1 is , hence the
interval is empty and cannot contain any sample. An if
statement is an nif statement without uncertainty.
Let us illustrate the concept on a concrete example. Suppose that in the current execution and . Figure 2 illustrates how decisions are made if is: . Since diff(x,a) = 1, the probability of executing S1 is defined by and for the above cases is equal to 0.994, 0.714 and 0.599 respectively. The intervals for the above cases are as follows: [1.095;1.095], [1.890; 1.890] and [3.357; 3.357]. In the second step we sample from the distributions with the corresponding (, and ) and check whether the value lies within the intervals.
So far we were concerned with single samples . Figure 3 illustrates what happens to the distributions: The differences of passing a GD RV x through the statements if(x >= 0.15) and nif(x >= 0.15, 0.1). Using our approach the GD is not cut in undesirable ways, and it maintains its GD form after passing the nif statement.
We can introduce now the confidenceuncertainty tradeoff to loops. The neural while statement, or nwhile for short, is an extension of a traditional while statement which incorporates uncertainty. The statement takes an inequality relation and variance and executes the program according to the following rule: (1) Compute and obtain quantiles and according to the Equation 4; (2) Check if a random sample is within the interval ; (3) If the sample belongs to the interval, execute and go to step (1), else exit.
Since the nif and nwhile statements subsume the behavior of traditional if and while statements (the case ), we use them to define an imperative language with probabilistic control structures. Binary operators (such as addition multiplication), unary operators (negation), and constants are used to form expressions . A program is a statement or combination of statements.
In order to define the denotational semantics for the nif and the nwhile statements, we use , a function which: (1) Computes the difference , (2) Finds quantiles and (Equation 4), and (3) Checks if a sample belongs to the interval . If it does, it returns value , otherwise it returns value . The denotational semantics of neural programs is then defined as follows:
We are now ready to write the controlprogram skeleton for the parallel parking task of our Pioneer rover, as a sequence of nwhile statements, as shown in Listing 1. Each nwhile corresponds to executing one motion primitive of the informal description in Section 1. The functions moving() and getPose() are output and input statements, which for simplicity, were omitted from the denotational semantics.
The versatility of this approach is that the program skeleton is
written only once and comprises infinite number of controllers. The
question we need to answer next is:
What are the distances and
turning angles for each action and how uncertain are we about each
of them?
To find the unknown parameters from Listing 1, namely
the target locations targetLocations and variances
sigmas, we use the learning procedure described in
Section 4.
4 BayesianNetwork Learning
Parking can be seen as a sequence of moves and turns, where each action depends on the previous one. For example, the turning angle typically depends on the previously driven distance. Due to sensor noise and imprecision, inertia and friction forces, and also many possible ways to perform a parking task starting from one initial location, we assume that the dependence between actions is probabilistic, and in particular, the RVs are distributed according to Gaussian distributions (GD). We represent the dependencies between actions as the GBN in Figure 4, where or denotes a distance or a turning angle of the corresponding action and is a conditional dependence between consecutive actions.
In order to learn the conditional probability distributions of the GBN in Figure 4, and to fill in the targetLocations and the sigmas in Listing 1, we record trajectories of the successful parkings done by a human expert. Figure 5 shows example trajectories used during the learning phase.
We than use the fact that any GBN can be converted to an MGD [24] in our learning routine. Learning the parameters of the GBN can be divided into three steps:

Convert the GBN to the corresponding MGD,

Update the precision matrix of the MGD,

Extract s and conditional dependences from .
1. Conversion step. To construct MGD we need to obtain the mean vector and the precision matrix . The mean vector comprises the means of all the variables from the GBN. To find the symbolic form of the precision matrix, we use the recursive notation in [16], where the value of the coefficients , will be learned in the update step below.
(5) 
In order to apply Equation 5 we define an ordering starting with the initial node . Its precision matrix is equal to:
The vector comprises dependence coefficients for node on all its immediate parents it in the ordering. For example, the dependence vector for node in the Figure 4 equals to:
After applying the Equation 5 to each node in the GBN, we obtain the precision matrix , shown in Figure 12. Since each action in the parking task depends only on the previous one (for example, in Figure 4 the turning angle depends on the previously driven distance only), we can generalize the precision matrix for the arbitrary number of moves. For a GBN with moves, all nonzero elements of the precision matrix can be found according to the Equation 6, where is a th element in a th row of the precision matrix with indices started from one.
(6) 
2. Update step. Once we derived the symbolic form of the precision matrix ( in our example), we use the training set, in order to learn the actual values of its parameters, as described in the algorithm from [24]. Each training example corresponds to a vector of lengths and turning angles for a successful parking task. The total number of examples in the training set is . The procedure allows us to learn iteratively and adjust the prior belief by updating the values of the mean and covariance matrix of the prior, where is a size of a training set for the prior belief, and .
(7) 
The updated mean value incorporates prior value of the mean and the mean value of the new training examples .
(8) 
The size of the training set is updated to its new value:
(9) 
The updated covariance matrix combines the prior matrix with the covariance matrix of the training set :
(10) 
Finally, the new value of the matrix is used to calculate the covariance matrix , where .
(11) 
(12) 
3. Extraction step. The new parameters of the GBN can now be retrieved from the updated mean vector and from . If new traces are available at hand, one can update the distributions by recomputing and using Equations 811. We depict the whole process in Figure 6: Unknown parameters from the program skeleton are learned from successful traces and these dependencies are used during the execution phase to sample the commands.
5 Experimental results
We performed our experiments on a Pioneer P3ATSH mobile rover from Adept MobileRobots[1] (see Figure 7). The rover uses the Carma Devkit from SECO [21] as a main computational unit. The comprised Tegra 3 ARM CPU runs the Robot Operating System (ROS) on top of Ubuntu 12.04.
5.1 Structure of the Parking System
The parking system can be separated into several building blocks (see Figure 8). The block Rover Interface senses and controls the rover, that is, it establishes an interface to the hardware. The block Sensor Fusion takes the sensor values from the Rover Interface block, and provides the estimated pose of the rover to the highlevel controller Engine. The Engine uses the GBN block to update the motion commands based on the estimated pose. Furthermore, the Engine maps the (higher level) motion commands to velocity commands needed by the Rover Interface to control the rover.
5.1.1 The Gaussian Bayesian Network Block
The goal of the GBN block in Figure 8, is to generate motion commands for the Engine to execute. A motion command corresponds to a driving distance or a turning angle.
During the learning phase, the distributions of the random variables (RVs) in the Gaussian Bayesian network (GBN) in Figure 4 are collected in a CSV file of following format:
Parsing the CSV file initializes the GBN that will be used for sampling the motion commands. Before starting the run we obtain the initial command vector from the distributions learned. The distribution of the first move is independent from any other move and has the form . Starting from the second move , each motion depends on the previous one: For motion number , the distribution has the form . The initial command vector is obtained by sampling from , and each subsequent command vector is obtained by taking into account the previous sample, when sampling from its own distribution.
As the rover and its environment are uncertain (e.g., sensors are disturbed by noise) we use the pose provided by the sensor fusion unit to update the motion commands. Hence the motion commands are constantly adapted to take into account the actual driven distance (which could be different from the planned one due to the aforementioned uncertainty of the CPS). This allows us to incorporate the results of the sensor fusion algorithm in the updated commands.
5.1.2 The Engine Block
During the run we execute a motion command according to the semantics of the nwhile loop. In particular, the estimated pose is passed from the Sensor Fusion block to the Engine and compared with the target location, specified as a point on a 2D plane. Since the rover is affected by noise its path can deviate and never come to the target location. To be able to detect and overcome this problem we estimate the scalar product of two vectors: The first one is the initial target location, and the second one is the current target location. This product is monotonely decreasing and becomes negative after passing the goal even on a deviating path. In an nwhile statement we monitor the distance (or angle) and detect if we should process the next command.
To obtain the current state of the rover (its pose), and send velocity commands, we start two separate threads: (i) Receive the pose and (ii) Send the velocity command. The motion command (containing desired driving distance or turning angle) is converted to a suitable velocity or steering command respectively, for the Rover Interface. After each executed command, we resample the pose in order to take into account actual driving distance in subsequent moves.
5.1.3 The Rover Interface Block
The block Rover Interface implements the drivers for sensors and actuators. The wheel velocities are measured by encoders, already supplied within the Pioneer rover. A builtin microcontroller reads the encoders and sends their value to the Carma Devkit. Additionally the rover is equipped with an inertial measurement unit (IMU) including an accelerometer, measuring the linear acceleration, and a gyroscope, measuring the angular velocity of the rover. The Raspberry Pi mounted on top of the rover samples the accelerometer and gyroscope, and forwards the raw IMU measurements to the Carma Devkit. The rover is controlled according to the incoming velocity commands containing desired linear velocity into forward direction (xtranslation) and the desired angular velocity (zrotation). The desired translation and rotation is converted to the individual wheel velocities, which are sent to and applied by the builtin microcontroller.
5.1.4 The Sensor Fusion Block
Parking is often performed by applying predefined rules [22] or following a specific trajectory [22]. So typically an autonomously parking car stops at a specific position beside a parking space and then turns and moves for a fixed time, angle or distance. The car has to stop, move and turn exactly as designated to park successfully. The car has to be aware of its current pose, that is, position and heading, otherwise parking will most likely fail (whatsoever controller is used). However, the current pose is observed by sensors, which suffer from uncertainty. Measurements are distorted by noise, e.g., caused by fluctuations of the elements of the electrical circuit of the sensors. The environment may be unpredictable, e.g., the car may slip over water or ice when parking. To overcome such problems sensor fusion techniques are applied, i.e., several sensors are combined to estimate a more accurate state. A common method is state estimation (also called filtering) [23, 30].
In this application, an
unscented Kalman filter (UKF)
[31] is used. This filter combines the measurements listed in Table 1 with a suitable model describing the relations from the measured variables to the pose of the car.Sensor  Variance  

left wheel’s velocity  0.002  
right wheel’s velocity  0.002  
linear acceleration  0.25  
angular velocity  0.00017 
The belief state maintained by the UKF, e.g., the current linear velocity, will be continuously updated: (i) By predicting the state, and (ii) By updating the prediction with measurements. For example, the linear velocity will be predicted by the current belief of acceleration and the time elapsed since the previous estimation. Next, the measurements from accelerometer and wheel encoders are used to update the predicted velocity. Because the wheel encoders are much more accurate than the acceleration sensor (see variance in Table 1), the measurements from the wheel encoders will be trusted more (for simplicity one can think of weighting and averaging the measurements, where the particular weight corresponds to the reciprocal variance of the sensor). However, by using more than one sensor, the unscented Kalman filter reduces the error of estimated and actual velocity.
5.2 Integration into ROS
ROS [26] is a metaoperating system that provides common functionality for robotic tasks including process communication, package management, and hardware abstraction. A basic building block of a system in ROS is a socalled node, that performs computation and exchanges information with other entities. Nodes communicate with each other subscribing for or publishing messages to specific topics. So all the nodes subscribed to a particular topic A, will receive messages from nodes publishing to this topic A.
Since the application is implemented in ROS we use the utility roslaunch to start the required ROS nodes (as shown in Figure 9) corresponding to the blocks given in Section 5.1.
 Rover Interface:

The node RosAria is used to control the velocity of the rover and provide the values of the wheel encoders for the sensor fusion node. The ROS nodes imu3000 and kxtf9 running on the Raspberry Pi provide data from acceleromenter and gyroscope.
 Sensor Fusion:

sf_filter node reads sensor values, implements the sensor fusion algorithm and provides the estimated pose of the rover.
 GBN and Engine:

pioneer_driver is a node implementing resampling of commands based on the actual driven distance and constantly providing the required velocity commands to the RosAria node (see Figure 9).
5.3 Results
After the learning phase, we obtain the parameters of the GBN that we use in the program skeleton (Table. 2). Since we track the position using the data from the sensor fusion and each movement has the experimentally learned uncertainty, we are resistive to the perturbation of the actual driving distances and angles. If in the current distance of the robot deviates from the planned one, the commands, resampled from the GBN will try compensate the deviation with the dependencies obtained from the learning phase.
0.7968  0.2086  0.5475  

0.0062  0.0032  0.0019  0.022  
0.0045  1.1920  0.0968  
0.0008  0.0178  0.0013 
6 Related Work
Although probabilistic programs (PP), Gaussian Bayesian networks (GBN) and neural networks were considered before, to the best of our knowledge, the development of smooth control statements, related within a GBN ontology is new. The ontology represents the knowledge of the PP about both its environment and its own control logic.
Probabilistic programs are represented by different languages and frameworks [13, 14, 9]. The authors in [14]
differentiate probabilistic programs from “traditional” ones, by the ability to sample at random from the distribution and condition the values of variables via observation. Although they consider both discrete and continuous probability distributions, and transformation of Bayesian Networks and Discrete Time Markov Chains to probabilistic programs, they do not mention probabilistic control structures linked in GBN.
In [6], the authors adapted the signal and image processing technique called Gaussian smoothing (GS), for program optimization. Using GS, a program could be approximated by a smooth mathematical function, which is in fact a convolution of a denotational semantics of a program with a Gaussian function. This approximation is used to facilitate optimization for solving the parameter synthesis problem. In [7] this idea was developed further and soundness and robustness for smooth interpretation of programs was defined. In both papers the authors do not consider any means for eliminating the renormalization step of the probability density function when a variable is passed through a conditional branch in the current execution trace. Moreover, they stop short of proposing new, smooth control statements.
Learning Bayesian Networks comprises different tasks and problem formulations: Learning the structure of the network, Learning the conditional probabilities for the given structure and Performing queryinginference for a given Bayesian Network [24]. In [16] the authors introduce a unified method for both discrete and continuous domains to learn the parameters of Bayesian Network, using a combination of prior knowledge and statistical data.
Various formulations of a mobile parking problem were extensively studied for robots with different architectures [17, 18, 19, 29, 22]. For instance, in [22] the authors use a custom spatial configuration of the ultrasonic sensors and binaural method to perceive the environment and park the robot using predefined rules. In [19] the authors approximate the trajectory for the parking task with a polynomial curve, that the robot could follow with the constraints satisfied, and used fuzzy controller to minimize the difference between specified trajectory and actual path.
In order to govern a physical process (e.g., parking a car), the controller must be aware of the internal state of the process (e.g., the position of the car). Sensors measure the outputs of a process, whereof the state can be estimated. However, the measurements are distorted by noise and the environment may be unpredictable. State estimators [23, 30, 3] and in particular Kalman filters [30, 31] are commonly used methods to increase the confidence of the state estimate evaluated out of raw sensor measurements.
7 Conclusion
In this paper we introduced deep neural programs (DNP), a new formalism for writing robust and adaptive cyberphysicalsystem (CPS) controllers. Key to this formalism is: (i) The use of smooth Probit distributions in conditional and loop statements, instead of their classic stepwise counterparts, and (2) The use of a Gaussian Bayesian network, for capturing the dependencies among the Probit distributions within the conditional and loop statements in the DPN.
We validated the usefulness of DPNs by developing, once and for all, a parallel parking CPScontroller, which is able to adapt to unforeseen environmental situations, such as a slippery ground, or noisy actuators. No classic program has such ability: One would have to encode all this unforeseen situations, which would lead to an unintelligible code.
In future work, we plan to explore the advantages of DPNs in the analysis, as well as, in the design (optimization) of CPS controllers. The nice mathematical properties of DPNs make them an ideal formalism for these tasks.
References
 [1] Adept MobileRobots(2013). Pioneer 3AT. http://www.mobilerobots.com/ResearchRobots/ P3AT.aspx (Accessed 24.08.2014).
 [2] Parking Videos. http://youtu.be/xNOj_ ARSEYs?list=PLP5Gx6r7gK2cxjKv0K2V5fBedovfo8_3y (Accessed 12.10.2014).
 [3] M. Arulampalam, S. Maskell, N. Gordon, and T. Clapp. A Tutorial on Particle Filters for Online Nonlinear/NonGaussian Bayesian Tracking. IEEE Transactions on Signal Processing, 50(2):174–188, 2002.
 [4] M. Broy and E. Geisberger. Cyberphysical systems, driving force for innovation in mobility, health, energy and production. Acatech: The National Academy Of Science and Engineering, 2012.
 [5] S. Chaudhuri and A. SolarLezama. Smooth Interpretation: Presentation Slides. http://people.csail.mit.edu/asolar/Talks/ PLDI2010Final.pptx (Accessed 14.06.2014).
 [6] S. Chaudhuri and A. SolarLezama. Smooth interpretation. In PLDI, pages 279–291, 2010.
 [7] S. Chaudhuri and A. SolarLezama. Smoothing a program soundly and robustly. In CAV, pages 277–292, 2011.
 [8] D. Ciresan, U. Meier, and J. Schmidhuber. Multicolumn deep neural networks for image classification. In Computer Vision and Pattern Recognition (CVPR), 2012 IEEE Conference on, pages 3642–3649, June 2012.

[9]
A. Dekhtyar and V. Subrahmanian.
Hybrid Probabilistic Programs .
The Journal of Logic Programming
, 43(3):187 – 250, 2000. 
[10]
D. Erhan, Y. Bengio, A. Courville, P.A. Manzagol, P. Vincent, and S. Bengio.
Why does unsupervised pretraining help deep learning?
J. Mach. Learn. Res., 11:625–660, Mar. 2010.  [11] M. Fraenzle. Analysis of hybrid systems: An ounce of realism can save an infinity of states. In Computer Science Logic, volume 1683 of Lecture Notes in Computer Science, pages 126–139. Springer Berlin Heidelberg, 1999.
 [12] S. Gao, S. Kong, W. Chen, and E. M. Clarke. Deltacomplete analysis for bounded reachability of hybrid systems. CoRR, abs/1404.7171, 2014.
 [13] W. R. Gilks, A. Thomas, and D. J. Spiegelhalter. A Language and Program for Complex Bayesian Modelling. Journal of the Royal Statistical Society. Series D (The Statistician), 43(1):pp. 169–177, 1994.
 [14] A. D. Gordon, T. A. Henzinger, A. V. Nori, and S. K. Rajamani. Probabilistic Programming. In International Conference on Software Engineering (ICSE Future of Software Engineering). IEEE, May 2014.
 [15] G. Grimmett and D. Stirzaker. Probability and random processes. Oxford science publications. Clarendon Press, 1985.
 [16] D. Heckerman and D. Geiger. Learning bayesian networks: A unification for discrete and gaussian domains. In UAI, pages 274–284, 1995.
 [17] M.A. IbarraManzano, J.H. DeAndaCuellar, C.A. PerezRamirez, O.I. VeraAlmanza, F.J. MendozaGalindo, M.A. CarbajalGuillen, and D.L. AlmanzaOjeda. Intelligent algorithm for parallel selfparking assist of a mobile robot. In Electronics, Robotics and Automotive Mechanics Conference (CERMA), 2012 IEEE Ninth, pages 37–41, Nov 2012.
 [18] K. Jiang and L. Seneviratne. A sensor guided autonomous parking system for nonholonomic mobile robots. In Robotics and Automation, 1999. Proceedings. 1999 IEEE International Conference on, volume 1, pages 311–316 vol.1, 1999.
 [19] M. Khoshnejad and K. Demirli. Autonomous parallel parking of a carlike mobile robot by a neurofuzzy behaviorbased controller. In Fuzzy Information Processing Society, 2005. NAFIPS 2005. Annual Meeting of the North American, pages 814–819, June 2005.

[20]
D. Koller and N. Friedman.
Probabilistic Graphical Models: Principles and Techniques  Adaptive Computation and Machine Learning
. The MIT Press, 2009.  [21] M. A. Lee. CUDA on ARM: Tegra3 Based LowPower GPU Compute Node, 2013. Poster presented at GPU Technical Conference, 2013.
 [22] T. Li, Y.C. Yeh, J.D. Wu, M.Y. Hsiao, and C.Y. Chen. Multifunctional Intelligent Autonomous Parking Controllers for Carlike Mobile Robots. Industrial Electronics, IEEE Transactions on, 57(5):1687–1700, May 2010.
 [23] H. Mitchell. MultiSensor Data Fusion  An Introduction. Springer, Berlin, Heidelberg, New York, 2007.
 [24] R. E. Neapolitan. Learning Bayesian Networks. PrenticeHall, Inc., Upper Saddle River, NJ, USA, 2003.
 [25] D. L. Parnas. Software aspects of strategic defense systems. Commun. ACM, 28(12):1326–1335, Dec. 1985.
 [26] M. Quigley, K. Conley, B. Gerkey, J. Faust, T. B. Foote, J. Leibs, R. Wheeler, and A. Y. Ng. ROS: an opensource robot operating system. In ICRA Workshop on Open Source Software, 2009.
 [27] S. Ratschan and Z. She. Constraints for continuous reachability in the verification of hybrid systems. In J. Calmet, T. Ida, and D. Wang, editors, Artificial Intelligence and Symbolic Computation, volume 4120 of Lecture Notes in Computer Science, pages 196–210. Springer Berlin Heidelberg, 2006.
 [28] S. Russell and P. Norvig. Artificial Intelligence: A Modern Approach. PrenticeHall, 3rd edition, 2010.
 [29] N. Scicluna, E. Gatt, O. Casha, I. Grech, and J. Micallef. Fpgabased autonomous parking of a carlike robot using fuzzy logic control. In Electronics, Circuits and Systems (ICECS), 2012 19th IEEE International Conference on, pages 229–232, Dec 2012.
 [30] S. Thrun, W. Burgard, and D. Fox. Probabilistic Robotics. MIT Press, Cambridge, 2006.
 [31] E. Wan and R. Van der Merwe. The Unscented Kalman Filter for Nonlinear Estimation. In Adaptive Systems for Signal Processing, Communications, and Control Symposium 2000. ASSPCC. The IEEE 2000, pages 153–158, 2000.
 [32] Q. Wang, P. Zuliani, S. Kong, S. Gao, and E. M. Clarke. Sreach: Combining statistical tests and bounded model checking for nonlinear hybrid systems with parametric uncertainty. CoRR, abs/1404.7206, 2014.
Comments
There are no comments yet.