Guiding the Self-Organization of Cyber-Physical Systems

Self-organization offers a promising approach for designing adaptive systems. Given the inherent complexity of most cyber-physical systems, adaptivity is desired, as predictability is limited. Here I summarize different concepts and approaches that can facilitate self-organization in cyber-physical systems, and thus be exploited for design. Then I mention real-world examples of systems where self-organization has managed to provide solutions that outperform classical approaches, in particular related to urban mobility. Finally, I identify when a centralized, distributed, or self-organizing control is more appropriate.


Introduction
We are submerged in complexity.And this complexity is increasing.But what is complexity?There are dozens of definitions and measures in the literature (Lloyd, 2001;Gershenson and Heylighen, 2005), but not a definite one.Well, life is not properly defined either, and it is not a hindrance for biology.Still, to have an idea of what we refer to, let us go to its etymological root.Complexity comes from the Latin plexus, which means entwined.In other words, something complex is difficult to separate.This is because the interactions among its components are relevant (Gershenson, 2013b).Relevant because they co-determine the future of the system.Thus, if we do not consider such interactions, but study components in isolation, we will not be able to understand the system properly.Also, interactions can generate novel information, not present in initial nor boundary conditions.This novel information limits predictability (Gershenson, 2013a) and is the source of computational irreducibility (Wolfram, 2002), i.e. there is no shortcut to know the future: one must go through all intermediate steps, because the information produced in the process is required to reach/compute the future.
A recent collaborative effort produced this definition: "Complexity science, also called complex systems science, studies how a large collection of components -locally interacting with each other at small scales -can spontaneously self-organize to exhibit non-trivial global structures and behaviors at larger scales, often without external intervention, central authorities or leaders.The properties of the collection may not be understood or predicted from the full knowledge of its constituents alone.Such a collection is called a complex system and it requires new mathematical frameworks and scientific methodologies for its investigation."(De Domenico et al., 2019) One of the core concepts explained in De Domenico et al. ( 2019) is self-organization: "Interactions between components of a complex system may produce a global pattern or behavior.This is often described as self-organization, as there is no central or external controller.Rather, the "control" of a self-organizing system is distributed across components and integrated through their interactions.Self-organization may produce physical/functional structures like crystalline patterns of materials and morphologies of living organisms, or dynamic/informational behaviors like shoaling behaviors of fish and electrical pulses propagating in animal muscles.As the system becomes more organized by this process, new interaction patterns may emerge over time, potentially leading to the production of greater complexity."Common examples of self-organizing systems (Camazine et al., 2003) include flocks of birds, schools of fishes, insect swarms, herds, crowds, and other collective phenomena (Vicsek and Zafeiris, 2012), although self-organization is not restricted to living systems (Nicolis and Prigogine, 1977;Haken, 1988;Gershenson and Heylighen, 2003).
There are many cases where self-organization has been used as an approach in engineering (Di Marzo Serugendo et al., 2004;De Wolf et al., 2005;Zambonelli and Rana, 2005).In this case, we can describe a system as self-organizing when elements interact to achieve dynamically a global function or behavior (Gershenson, 2007).In other words, instead of designing directly a solution, one regulates the potential interactions among elements.This is useful in non-stationary problems: when the situation changes, then the system adapts by itself.Since interactions in complex systems produce novel information, it is common that this information will change a complex problem.Not only its state, but also its state space.Thus, self-organization can be useful to face complexity by providing general adaptation mechanisms.Several methodologies using self-organization have been proposed (see Frei and Di Marzo Serugendo (2011) for an overview), although the approach has not been widely applied.
In a parallel effort, guided self-organization attempts to combine seemingly opposed processes: design to define and regulate the properties and behavior of a system, and self-organization that implies certain autonomy and adaptability (Prokopenko, 2009(Prokopenko, , 2014) ) Guided self-organization can be understood as "the steering of the self-organizing dynamics of a system towards a desired configuration" (Gershenson, 2012).
In this paper, I complie concepts and approaches useful for designing self-organizing systems in the physical realm.I illustrate these with case studies from urban mobility before concluding.

Concepts
Several concepts are useful to design and guide self-organizing systems.In this section, a non-exhaustive list is presented.

Adaptation
Adaptation can be defined as a change in an agent or system as a response to a state of its environment that will help the agent or system to fulfill its goals (Gershenson, 2007).Living systems naturally adapt to changes in their environment, and artificial systems can benefit from exhibiting adaptation (Holland, 1975;Steels and Brooks, 1995;Bedau et al., 2013).
If problems are stationary, i.e. do not change, then it is worthwhile attempting to predict the future of a system to control it.However, for non-stationary problems, predictability by definition is limited.Novel information generated by interactions in complex systems can lead to non-stationarity.In this case, adaptation is desirable to complement the unpredictable aspects of a problem (Gershenson, 2013a).
For example, city traffic is changing constantly: every time a red light switches to green, the number of vehicles waiting changes.Thus, the timing of the traffic lights should also change.Traditional adaptive traffic light control methods (e.g.Sydney, Dublin, Singapore) use sensors to shift phases depending on recent average demands.This is usually better than not having adaptation, where the best possible option would be to take average measurements, set fixed phases, and perhaps change the programs a few times per day.However, if traffic lights can adapt at the same timescale as the traffic demand does, i.e. every cycle, then the performance would be much improved (Goel et al., 2017).

Robustness
A system is robust if it continues to function in the face of perturbations (Wagner, 2005).As with adaptation, robustness is prevalent in living systems and desirable in artificial ones (Jen, 2005).
Robustness and adaptability are complementary: a system has to be robust enough to survive while it adapts, and adaptation can favor robustness.
For example, the Internet is quite robust.The TCP/IP protocol was designed to resist nuclear warfare.At the content level, self-organization has led to a scale-free topology (Barabási et al., 2000), which is also robust to random failures (although fragile to directed attacks).

Antifragility
A fragile system is damaged by perturbations.A robust system is unaffected by perturbations.An antifragile system benefits from perturbations (Taleb, 2012).
For example, the immune system is antifragile.Children who grow up in extremely sanitized conditions are not exposed to pathogens (perturbations), so their immune systems do not develop, leading to stronger infections in adulthood.Certainly, children should not be infected intentionally, but being exposed to a "normal" amount of pathogens and falling ill now and then helps train the immune system.
We have recently proposed a measure of antifragility (Pineda et al., 2019), which captures the idea of being positive when perturbations improve the performance of a system, is negative when perturbations decrease the performance (fragility), and is zero when perturbations do not affect the performance (robustness).An important aspect is that there is no "optimal" antifragility independent of an environment.A system should be as antifragile as its environment varies (this is related with requisite variety, discussed in Section 3).

Mediators
Interactions can be classified as positive, neutral, or negative, depending on the effect they have on the goals of a system (Gershenson, 2007(Gershenson, , 2011b) ) A mediator arbitrates among the elements of a system, to minimize conflict, interferences and frictions (negative interactions); and to maximize cooperation and synergy (positive interactions) (Michod, 2003;Heylighen, 2006;Gershenson, 2007).
For example, traffic rules aim at reducing conflict in urban mobility.Without these rules, we would need to decide constantly on which side of the streets to drive, how to give way, make turns, etc.Even when rules and norms vary from country to country, and in some cases from city to city, when everybody follows the same set of rules (mediators), conflicts tend to be reduced.If they were not, then the rules should be changed.
Designing mediators can be useful for regulating systems where the elements cannot be modified.Still, mediators can change the interactions between elements, leading to different systemic behavior and properties (See case study in Section 4.1).

Slower-is-faster effect
Probably this effect was first described less than twenty years ago (Helbing et al., 2000b,a) while modeling crowd dynamics.If people trying to evacuate a room are panicked (trying to exit faster), then they create friction which leads to a "turbulent" flow that is slower than if people exit calmly, thus with a "laminar" flow.The same effect has been studied in vehicular traffic, logistics, public transport, social dynamics, ecological systems, and adaptive processes (Gershenson and Helbing, 2015).
In general, the slower-is-faster effect occurs when a system performs worse as its components try to do better.This implies that a balance between doing "too few" and doing "too much" is necessary.However, in many cases this balance is dynamic.For example, the optimal speed for highway traffic (that maximizes flow) depends on the vehicular density.For this reason, systems that present a slower-is-faster effect, require constant adaptation, that can be achieved through self-organization.
The slower-is-faster effect may refer to any variable, not only speed.For example, growth or profits are not necessarily maximized in the long term with a short-term maximization strategy.Managing natural resources, such as fisheries, requires this understanding: if all resources are depleted, then in the near future there will be no profits.Maximizing profits requires a careful balance between short-term action and long-term planning.As with the case of highway traffic, usually this balance is non-stationary.

Heterogeneity
Most of our models of complex systems are homogeneous: all components have the same properties.This simplification is useful when we face computational limitations.However, increasing processing power and data availability have allowed us to make more realistic models, where different elements of a system have varying properties.
Perhaps the most studied heterogeneity in complex systems is the one of network topologies (Albert and Barabási, 2002;Newman et al., 2006;Gershenson and Prokopenko, 2011;Barabási, 2016).Different organizations of the same elements can lead to radically different functionalities.A classical example is different arrangements (allotropes) of carbon atoms, which can lead to charcoal, diamond, graphite, graphene, nanotubes, buckyballs, etc.The components are the same, but changing their organization leads to radically different properties of these materials.Many networks are heterogeneous, with few elements having lots of connections and many elements having few connections.
More recently, temporal heterogeneity has been also studied (Cocho et al., 2015;Morales et al., 2018).In a similar way, few elements change slower than most elements that change faster.This heterogeneity seems to lead to a balance where slow elements are robust and fast elements are adaptable.In homogeneous systems, this balance is achieved only in phase transitions, which can be characterized as "critical" (Balleza et al., 2008).However, heterogeneity seems to expand the balance beyond criticality, making it easier to search an unknown parameter space, simply because different components diversify any search procedure.

Approaches
How to implement the properties related to self-organization in cyber-physical systems?The concept of self-organizing systems originated within cybernetics (Ashby, 1947;von Foerster, 1960;Ashby, 1962), where useful approaches were already developed.
Ashby not only coined the term "self-organizing system", but he also proposed the law of requisite variety (Ashby, 1956;Heylighen and Joslyn, 2001;Bar-Yam, 2004;Gershenson, 2015).Variety can be understood as the possible number of states that a system can have.This law states that a controller must have at least as much variety as the system it is trying to control.For example, if we want a robot at a manufacturing plant to deal with seven different types of boxes, then it should be able to distinguish and make the appropriate decisions to handle each type of box.A common problem is that complexity explodes variety and vice versa.Therefore, traditional approaches become limited.To handle the variety of a system, we can either reduce its variety (using mediators), or increase the variety of the controller, but then the latter will imply an increase in the complexity of the controller as well.
There is an interesting relationship between variety and heterogeneity.Heterogenous systems by definition have more variety, so in principle they should be able to control more situations than similar homogeneous systems.However, they might be less robust and more complicated to design and understand.For example, "if there is a system of ten agents each able to solve ten tasks, a homogeneous system will be able to solve ten tasks robustly (if we do not consider combinations as new tasks).A fully heterogeneous system would be able to solve a hundred tasks, but it would be fragile if one agent failed."(Gershenson, 2007, p. 53).Thus, a balance between homogeneity and heterogeneity should also give us a balance between robustness and adaptability (Langton, 1990;Kauffman, 1993).
We can consider computers as telescopes of complexity (Pagels, 1989).In other words, without computers, our cognitive abilities are limited to studying models considering only two or three variables.To explore models with thousands or millions of variables, computer simulations are necessary (Gershenson, 2007) because of computational irreducibility (Wolfram, 2002).Complexity implies that new information is generated by interactions, so there is no "shortcut" to the future and all intermediate steps are necessary.This limits inherently the predictability of systems (Gershenson, 2013a).
Agent-based modeling (Bonabeau, 2002;Epstein, 2006;Wilensky and Rand, 2015) has been a useful approach to describe complex systems.Considering elements as agents, with states, goals, and rules allows us to study how changes at one scale lead to effects at another scale.The effects can go in both directions: changes in agents leading to changes in the system and vice versa.
Another approach that is becoming more and more popular as data availability and computing power increase is network science (Newman, 2003;Newman et al., 2006;Barabási, 2016).Networks have the benefit of being able to represent naturally elements (nodes) and interactions (links).The relationship between the structure and function of networks has been an intense area of study, where self-organization can play a relevant role (Gershenson, 2012).
Ethology -the study of animal behavior -has been taken as an inspiration to build adaptive systems (Beer, 1990;Maes, 1994;Steels and Brooks, 1995) and to study complex artificial systems (Rahwan et al., 2019).Animals have evolved to survive in complex environments, so adaptive strategies and self-organizing mechanisms found in nature have been used in cyber-physical systems.In this sense, living technology (Bedau et al., 2009;Gershenson et al., 2018) takes the advantageous properties of living systems and applies them in socio-technical systems, from protocells (Rasmussen et al., 2008) to cities (Gershenson, 2013c).
The robustness and antifragility of systems can be promoted through different mechanisms (Gershenson, 2012), such as redundancy (having several copies of the same element), degeneracy (having different elements perform the same function), modularity (short-range links stronger than long-range ones), and scale-free-like (heterogeneous) topologies (few elements with several links, several elements with few links) .

Case studies
In this section, I illustrate the previous concepts and approaches with case studies we have worked with in recent years, related to urban mobility.

Crowd control
More than a hundred million people use the hundred busiest metro systems in the world every day, a number that is growing fast as the urban population is increasing and cities develop.In the Mexico City Metro and other systems, people would normally push each other, not letting passengers exit trains, collapsing the systems.How to regulate passenger behavior, when a selfish approach might seem to bring individual benefit but lead to collective inefficiency?One can think of different mediators, but they can be costly to try in real systems.To explore alternatives, we first used crowd simulations (Helbing et al., 2000a) and then implemented a pilot study in the Balderas station of the Mexico City Metro on December, 2016 (Carreón et al., 2017).The pilot was a success and it has since been extended to several other busy stations.
The intervention consisted of "simple" signs that indicate passengers roughly where the train doors will be, asking them to leave free space for exiting passengers, as shown in Figure 1.What we did not expect nor suggest was that people would queue (Figure 2), and that these queues could even go upstairs as people respected them.
This intervention managed to change the behavior of the passengers and thus the crowd, without changing the elements of the system (where could we get different "educated" passengers from?).The signs mediated interactions between people.This is an example of a passive control, where interactions are regulated "simply" providing useful information.

Traffic light coordination
The coordination of traffic lights is an EXP-complete problem, meaning that in theory it takes exponentially more time to find a solution as more intersections are added to a street network.Also, the precise number of vehicles changes every cycle, so in practice the problem changes faster than it can be optimized.An active controller should adapt as fast as the controlled changes (requisite temporal variety), and for that sensors are required to provide relevant information to the controller.
With this in mind, we have proposed self-organizing algorithms that can coordinate traffic flows and adapt to constant changes in the demand as fast as it changes (Gershenson, 2005;Zapotecatl et al., 2017), achieving close-to-optimal performance (Gershenson and Rosenblueth, 2012).The main idea behind the algorithms is that streets with a higher demand get a preference.Thus, busier directions will wait less for a green light.This increases the probability that vehicles will aggregate behind red lights with few cars, leading to the formation of platoons.As platoons reach a certain size, they can request a green light before they even reach an intersection, so vehicles do not need to stop, unless there are other vehicles or pedestrians crossing.Platoons are easier to coordinate than individual vehicles, as they leave spaces between them that other platoons can use without interference.When densities are high, the preference is given to the street that has more space after the intersection, preventing gridlocks.
It is difficult to compare the performance of self-organizing traffic lights, as there are no benchmarks in traffic light coordination.However, they are close to optimal.Also, we have found that self-organizing traffic lights would improve traffic more than if all vehicles were autonomous but with traditional traffic lights.Nevertheless, autonomous vehicles and self-organizing traffic lights are even better.
By distributing control locally (we have made simulations with up to ten thousand intersections achieving efficient or optimal coordination), the requisite variety of the traffic light coordination can be tackled as conditions change, while the formation of platoons selforganizes the traffic flows and assists the coordination of intersection controllers at the city scale.In this way, the traffic lights are mediators of vehicles, but the vehicles are also mediators of traffic lights.

Public transport regulation
In theory, passengers in public transport are served optimally when vehicle headway -the time between arrivals at a station -is equal.However, as we have shown, an equal headway configuration is unstable by nature (Gershenson and Pineda, 2009), as delays become amplified by positive feedbacks.Thus, many approaches are taken by transportation engineers to prevent the "equal headway instability", also known as the "bus bunching problem".
To keep equal headways, all vehicles -trains, trams, buses -must wait the same time at each station.This time can vary from station to station, but it must be fixed or some vehicles will go faster than others, leading to unequal headways and potentially to the collapse of the system.Since the precise number of passengers varies each time a vehicle reaches a station, and thus the required waiting time, then either vehicles will require a margin and be idle, or they will depart before servicing all passengers when these are more than expected.
We proposed a self-organizing algorithm inspired by ant colony communication (Gershenson, 2011a;Carreón et al., 2017), where each vehicle "simply" tries to keep equal distance to the vehicles in front and behind, but is flexible enough to serve passengers at stations and at the same time prevent idling.Equal headways are not maintained, but the system does not collapse.Rather, its performance is even better than the case with equal headways, i.e. it is supraoptimal.This is because of the slower-is-faster effect: It is true that passengers minimize their waiting time at stations with equal headways (what theory says).But their total travel time is not independent of the equal headways, so idling will increase their total travel time.With the self-organizing algorithm, passengers wait more at stations, but once they board a vehicle, they will reach their destination faster, as there is no idling.Again, adaptation takes place at the scales at which the system changes.

Discussion
We cannot reduce the complexity of several systems we have to deal with.Novel information produced by interactions leads to changes, making problems non-stationary.Selforganization has been used in a broad variety of cyber-physical systems.It allows systems to adapt at the scales at which the problem they are solving changes in a robust fashion.In addition to the case studies mentioned in the previous section, dynamic road pricing in Singapore and variable parking cost in San Francisco are examples of self-organization being used to regulate urban mobility.We can see that the same principles apply in other cyber-physical systems, from telecommunications (Amoretti and Gershenson, 2015) to organizations (Gershenson, 2008).
A relevant step towards adopting self-organizing controllers is to give up the desire to control completely our systems.As complexity limits our predictability, systems require certain autonomy to make the "right decisions".Even if we use traditional approaches, we do not have full control of our systems, as they are constantly entering unexpected situations.We would like to be able to be sure that our systems will never fail, but they will.We can have formal proofs but these are also limited, since they assume idealized/closed/predefined situations.Self-organizing systems can do the same as traditional engineered systems and more, as they can deal with more realistic/open/variable situations.We just have to try and see, constantly adapting (Gershenson, 2007).Even if a solution already worked, it does not assure that it will continue working (as conditions change) or that it can be applied in the same way in a different context.
The best solution depends on the context/environment/problem.In some cases, centralized control will be good, in others distributed is more appropriate, in yet others selforganizing.As shown in Table 1, centralized control is appropriate when causality should be top-down.Because of the law of requisite variety, systems with a high variety/complexity will require a controller with a high variety/complexity, so the centralized approach becomes less viable.Distributed control can deal with a greater complexity, but it is still limited, because the integration of the distributed solutions is not necessarily trivial.This limits distributed control to homogeneous systems: since information flow across the system is limited, the local solutions assume that each local problem is similar.Self-organizing control can deal with top-down and bottom-up causality (multiscale), as components can interact in a distributed fashion to change system properties (bottom-up), but then the system properties can mediate (top-down) to regulate the behavior of components.Self-organization can be scalable, adaptive, robust, and can deal with a high complexity and homogenous or heterogeneous problems.It is not that one approach is better than others, but they are more appropriate for different problems.Centralized control is easier to implement and understand, but is useful for low complexity/variety problems.Distributed control can deal with a greater complexity, but only for heterogeneous systems.Self-organizing systems might be more difficult to design and test, but they can handle greater complexity/variety/diversity.As the complexity of our cyber-physical systems increases, and also our understanding of it, we will see more self-organizing approaches.Perhaps names will differ, but the concepts presented here are required to control cyber-physical systems by guiding their selforganization.

Figure 1 :
Figure 1: Signs installed to mediate passenger boarding and descent in Mexico City Metro(Carreón et al., 2017).

Figure 2 :
Figure 2: Passengers queuing waiting for a train in Mexico City Metro during rush hour, San Lázaro metro station(Carreón et al., 2017).

Table 1 :
Different control approaches are more appropriate for different causalities, complexities, and diversities.