HOME

TheInfoList



OR:

In
computer science Computer science is the study of computation, automation, and information. Computer science spans theoretical disciplines (such as algorithms, theory of computation, information theory, and automation) to Applied science, practical discipli ...
, macroprogramming is a
programming paradigm Programming paradigms are a way to classify programming languages based on their features. Languages can be classified into multiple paradigms. Some paradigms are concerned mainly with implications for the execution model of the language, suc ...
aimed at expressing the macroscopic, global behaviour of an entire system of agents or computing devices. In macroprogramming, the local programs for the individual components of a
distributed system A distributed system is a system whose components are located on different networked computers, which communicate and coordinate their actions by passing messages to one another from any system. Distributed computing is a field of computer sci ...
are compiled or interpreted from a ''macro-program'' typically expressed by a system-level perspective or in terms of the intended global goal. The aim of macroprogramming approaches is to support expressing the macroscopic interactive behaviour of a whole distributed system of computing devices or agents in a single program, or, similarly, to promote their
collective intelligence Collective intelligence (CI) is shared or group intelligence (GI) that emerges from the collaboration, collective efforts, and competition of many individuals and appears in consensus decision making. The term appears in sociobiology, politic ...
. It has not to be confused with macros, the mechanism often found in programming languages (like C or Scala) to express substitution rules for program pieces. Macroprogramming originated in the context of
wireless sensor network Wireless sensor networks (WSNs) refer to networks of spatially dispersed and dedicated sensors that monitor and record the physical conditions of the environment and forward the collected data to a central location. WSNs can measure environmental c ...
programming and found renewed interest in the context of the
Internet of Things The Internet of things (IoT) describes physical objects (or groups of such objects) with sensors, processing ability, software and other technologies that connect and exchange data with other devices and systems over the Internet or other comm ...
and
swarm robotics Swarm robotics is an approach to the coordination of multiple robots as a system which consist of large numbers of mostly simple physical robots. ″In a robot swarm, the collective behavior of the robots results from local interactions between ...
. Macroprogramming shares similar goals (related to programming a system by a global perspective) with
multitier programming Multitier programming (or tierless programming) is a programming paradigm for distributed software, which typically follows a multitier architecture, physically separating different functional aspects of the software into different ''tiers'' (e.g ...
,
choreographic programming In computer science, choreographic programming is a programming paradigm where programs are compositions of interactions among multiple concurrent participants. Overview Choreographies In choreographic programming, developers use a choreogr ...
, and aggregate computing.


Context and motivation

Programming
distributed systems A distributed system is a system whose components are located on different networked computers, which communicate and coordinate their actions by passing messages to one another from any system. Distributed computing is a field of computer sci ...
,
multi-agent systems A multi-agent system (MAS or "self-organized system") is a computerized system composed of multiple interacting intelligent agents.Hu, J.; Bhowmick, P.; Jang, I.; Arvin, F.; Lanzon, A.,A Decentralized Cluster Formation Containment Framework fo ...
, and
collectives A collective is a group of entities that share or are motivated by at least one common issue or interest, or work together to achieve a common objective. Collectives can differ from cooperatives in that they are not necessarily focused upon an ...
of software agents (e.g., robotic swarms) is difficult, for many issues (like communication, concurrency, and failure) have to be properly considered. In particular, a general recurrent problem is how to induce the intended global behaviour by defining the behaviour of the individual components or agents involved. The problem can be addressed through learning approaches, such as
multi-agent reinforcement learning ] Multi-agent reinforcement learning (MARL) is a sub-field of reinforcement learning. It focuses on studying the behavior of multiple learning agents that coexist in a shared environment. Each agent is motivated by its own rewards, and does acti ...
, or by manually defining the control program driving each component. However, addressing the problem by a fully individual (or single-node) perspective may be error-prone, because it is generally difficult to foresee the overall behaviour emerging from complex networks of activities and interactions (cf.
complex systems A complex system is a system composed of many components which may interact with each other. Examples of complex systems are Earth's global climate, organisms, the human brain, infrastructure such as power grid, transportation or communication s ...
and
emergence In philosophy, systems theory, science, and art, emergence occurs when an entity is observed to have properties its parts do not have on their own, properties or behaviors that emerge only when the parts interact in a wider whole. Emergence ...
). Therefore, researchers have started investigated ways to raise the abstraction level, promoting programming of distributed systems by a more global perspective or in terms of the overall goal to be collectively attained.


Examples


ScaFi

The following program in the ScaFi aggregate programming language
defines the loop control logic needed to compute a channel (a Boolean field where the devices yielding true are those connecting, through a hop-by-hop path, a source device to a target device) across a large set of situated devices interacting with neighbours. class SelfContainedChannel extends AggregateProgram with SensorDefinitions What is interesting to note is that the channel function, as well as the functions that are used to implement it, namely distanceTo, distanceBetween, dilate, broadcast etc. can be interpreted not just in terms of the individual behaviour of a device, but rather ''by a macroscopic perspective''. In fact, for instance, distanceTo(s) is used to compute the field of minimum distances from the closest device for which expression s yields true: this is effectively a ''distributed data structure'' that is sustained through processing ''and'' communication with neighbours, in a self-organising way. Semantically, such functions define a macro-level (or collective) behaviour that yields a macro-level (or collective) data structure. Such macro-level functions/behaviours can be ''composed'' together to obtain another more complex macro-level function/behaviours.


Regiment

The following program in the Regiment language can be used to compute the mean temperature perceived by the whole system: % function definition doSum :: float (float, int) -> (float, int); doSum(temperature, (sum, count)) % functional reactive program logic temperatureRegion = rmap(fun(node), world); sumSignal = rfold(doSum, (0.0, 0), temperatureRegion) avgSignal = smap(fun((sum,count)), sumSignal) BASE <- avgSignal % move such information to the base station


PyoT

The following program in PyoT can be used to turn on a fan if the mean temperature computed by several sensors exceeds a certain threshold. temperatures = Resource.objects.filter(title="temp") results = emp.GET() for temp in temperaturesavg = sum(results) / len(results) TEMP_THRESHOLD = 24 if avg > TEMP_THRESHOLD: Resource.objects.get(title="fan").PUT("on")


TinyDB

In TinyDB, a data-oriented macroprogramming approach is used where the programmer writes a query which turns into single-node operations and routing in a wireless sensor network. SELECT nodeId , temperature WHERE temperature > k FROM sensors SAMPLE PERIOD 5 minutes


See also

*
Multitier programming Multitier programming (or tierless programming) is a programming paradigm for distributed software, which typically follows a multitier architecture, physically separating different functional aspects of the software into different ''tiers'' (e.g ...
*
Choreographic programming In computer science, choreographic programming is a programming paradigm where programs are compositions of interactions among multiple concurrent participants. Overview Choreographies In choreographic programming, developers use a choreogr ...
* Aggregate computing *
Distributed computing A distributed system is a system whose components are located on different computer network, networked computers, which communicate and coordinate their actions by message passing, passing messages to one another from any system. Distributed com ...


References

{{Programming paradigms navbox Programming paradigms Programming languages Distributed computing Articles with example Python (programming language) code Articles with example Scala code