<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.weizmann.ac.il/bp/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.weizmann.ac.il/bp/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=BpAdmin</id>
		<title>BP Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.weizmann.ac.il/bp/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=BpAdmin"/>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Special:Contributions/BpAdmin"/>
		<updated>2026-06-10T18:55:30Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.22.4</generator>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-05-20T07:32:35Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* Downloads */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Examples =&lt;br /&gt;
The examples below demonstrates the control of a toy helicopter - AR DRONE by Parrot Inc. &lt;br /&gt;
&lt;br /&gt;
= Basic Composite Behavior =&lt;br /&gt;
The following movies show flight of the helicopter, as well as simulation. The flight was generated by independent concurrent LSCs - where one directs the helicopter through a rectangular flight path without changing altitude, and another directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|nMTbQc_iq5Y|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|sMp8QTetobc|640}}&lt;br /&gt;
&lt;br /&gt;
= Detailed Example: Wall Painting =&lt;br /&gt;
In this example, the mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
The example is implemented with a simulator. &lt;br /&gt;
&lt;br /&gt;
Below we describe the requirements and the associated b-threads, along with screen images and a movie of the helicopter behavior as it evolves with the addition of new b-threads.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|6cSqPGvRWw0|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads: &lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes: &lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements: &lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location: &lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
== Download the wall painting example ==&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the wall painting example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects:&lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-05-20T07:26:53Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* Download */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Examples =&lt;br /&gt;
The examples below demonstrates the control of a toy helicopter - AR DRONE by Parrot Inc. &lt;br /&gt;
&lt;br /&gt;
= Basic Composite Behavior =&lt;br /&gt;
The following movies show flight of the helicopter, as well as simulation. The flight was generated by independent concurrent LSCs - where one directs the helicopter through a rectangular flight path without changing altitude, and another directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|nMTbQc_iq5Y|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|sMp8QTetobc|640}}&lt;br /&gt;
&lt;br /&gt;
= Detailed Example: Wall Painting =&lt;br /&gt;
In this example, the mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
The example is implemented with a simulator. &lt;br /&gt;
&lt;br /&gt;
Below we describe the requirements and the associated b-threads, along with screen images and a movie of the helicopter behavior as it evolves with the addition of new b-threads.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|6cSqPGvRWw0|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads: &lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes: &lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements: &lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location: &lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Downloads =&lt;br /&gt;
== Download the wall painting example ==&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the wall painting example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects:&lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;br /&gt;
&lt;br /&gt;
== Download the drone BP infrastructure ==&lt;br /&gt;
# Click [[Media:rovtool.zip | here]] to download the drone BP infrastructure.&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-05-20T07:25:47Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* Download the helicopter example */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Examples =&lt;br /&gt;
The examples below demonstrates the control of a toy helicopter - AR DRONE by Parrot Inc. &lt;br /&gt;
&lt;br /&gt;
= Basic Composite Behavior =&lt;br /&gt;
The following movies show flight of the helicopter, as well as simulation. The flight was generated by independent concurrent LSCs - where one directs the helicopter through a rectangular flight path without changing altitude, and another directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|nMTbQc_iq5Y|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|sMp8QTetobc|640}}&lt;br /&gt;
&lt;br /&gt;
= Detailed Example: Wall Painting =&lt;br /&gt;
In this example, the mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
The example is implemented with a simulator. &lt;br /&gt;
&lt;br /&gt;
Below we describe the requirements and the associated b-threads, along with screen images and a movie of the helicopter behavior as it evolves with the addition of new b-threads.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|6cSqPGvRWw0|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads: &lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes: &lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements: &lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location: &lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
== Download the wall painting example ==&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the wall painting example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects:&lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;br /&gt;
&lt;br /&gt;
== Download the drone BP infrastructure ==&lt;br /&gt;
# Click [[Media:rovtool.zip | here]] to download the drone BP infrastructure.&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-05-20T07:25:02Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* Download */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Examples =&lt;br /&gt;
The examples below demonstrates the control of a toy helicopter - AR DRONE by Parrot Inc. &lt;br /&gt;
&lt;br /&gt;
= Basic Composite Behavior =&lt;br /&gt;
The following movies show flight of the helicopter, as well as simulation. The flight was generated by independent concurrent LSCs - where one directs the helicopter through a rectangular flight path without changing altitude, and another directs the helicopter to go up and down without changing its horizontal location. The result is a composite motion, traveling the prescribed path while going up and down.&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|nMTbQc_iq5Y|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|sMp8QTetobc|640}}&lt;br /&gt;
&lt;br /&gt;
= Detailed Example: Wall Painting =&lt;br /&gt;
In this example, the mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
The example is implemented with a simulator. &lt;br /&gt;
&lt;br /&gt;
Below we describe the requirements and the associated b-threads, along with screen images and a movie of the helicopter behavior as it evolves with the addition of new b-threads.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
{{#ev:youtube|6cSqPGvRWw0|640}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads: &lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes: &lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements: &lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location: &lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
== Download the helicopter example ==&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the helicopter example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects:&lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;br /&gt;
&lt;br /&gt;
== Download the drone BP infrastructure ==&lt;br /&gt;
# Click [[Media:rovtool.zip | here]] to download the drone BP infrastructure.&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=RunMode</id>
		<title>RunMode</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=RunMode"/>
				<updated>2014-04-29T08:41:01Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* Application-specific parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BPJ Model Checking Parameters =&lt;br /&gt;
==Specifying Run Modes ==&lt;br /&gt;
&lt;br /&gt;
BPJ model checking is activated by specifying the runmode paramater in the run configuration, under VM parameters, as follows:&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=Det ===&lt;br /&gt;
* Description: “Normal”  / standard  / deterministic run.&lt;br /&gt;
* Use: when you want the program to “do something”.&lt;br /&gt;
* Nondeterminism specification: Ignored. All priorities are considered distinct.&lt;br /&gt;
* Event Selection: Always the first requested event that is not blocked.&lt;br /&gt;
* Backtracking: none.&lt;br /&gt;
* Stops: When all b-threads end, or when there are no enabled events.&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=MCSafety ===&lt;br /&gt;
* Description: A model-checking run. Explore all possible executions paths – looking to validate safety properties.&lt;br /&gt;
* Use: Model checking: explore safety properties (including deadlocks), discover desired paths, etc.&lt;br /&gt;
* Nondeterminism specification: Allowed (actually required by definition).&lt;br /&gt;
* Event selection: Systematically makes all possible combinations of event selections&lt;br /&gt;
* Backtracking: systematic as part of exploring the state-graph - as described in [[Nondeterminism | section on nondetermism]].&lt;br /&gt;
* Stops:  When counterexample is found, or when verification of all transitions / states is complete.&lt;br /&gt;
* Additional related parameters: -Dsearch=BFS/DFS,  -Drecursive=true/false&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=MCLiveness ===&lt;br /&gt;
* Description: A model-checking run– explore all execution paths looking to validate liveness properties subject to fairness assumptions.&lt;br /&gt;
* Use: Model checking for liveness properties - (with fairness assumptions),.&lt;br /&gt;
* Nondeterminism specification: Allowed (actually required by definition).&lt;br /&gt;
* Event selection: Systematically makes all possible combinations of event selections.&lt;br /&gt;
* Backtracking: systematic as part of exploring the state-graph - as described in [[Nondeterminism | section on nondetermism]].&lt;br /&gt;
Stops:  When counterexample is found, or when verification of all transitions / states is complete.&lt;br /&gt;
* Additional related parameters:   Conditional, strong and weak fairness assumptions provided as sets of events&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=Random ===&lt;br /&gt;
* Description: One possible run out of many.&lt;br /&gt;
* Use: Demonstration or manual exploration of different possible runs.&lt;br /&gt;
* Nondeterminism specification: Allowed.&lt;br /&gt;
* Event selection: Random among all nondeterministic choices.&lt;br /&gt;
* Backtracking: none.&lt;br /&gt;
* Stops: When all b-threads end, or when there are no enabled events.&lt;br /&gt;
* Additional related parameters: -DrandomSeed= nnnn.&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=Iter ===&lt;br /&gt;
* Description: An iterative run – explore all possible executions.&lt;br /&gt;
* Use: to assess traces and results of all possible runs resulting from nondeterministic choices.&lt;br /&gt;
* Nondeterminism specification: Allowed.&lt;br /&gt;
* Event selection: Systematically makes all possible combinations of event selections  - in different runs.&lt;br /&gt;
* Backtracking:  When a run ends , it is restarted , and a new combination of event selections is used - from the beginning - not at the next higher nondeterminstic choice.&lt;br /&gt;
* Stops: When the last run of all possible runs  ends (all possible combinations of event selections exhausted).&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=MCDet ===&lt;br /&gt;
Description: A deterministic run, with model-checking instrumentation. No nondeterminism. The event selection mechanism always picks  the first event that is requested and not blocked. It is the same as defining the priority delta for equal priority b-threads as zero.&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=Learning/Training ===&lt;br /&gt;
(In development)&lt;br /&gt;
&lt;br /&gt;
== Run-control Parameters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== -Dsearch=BFS or -Dsearch=DFS ===&lt;br /&gt;
Breadth-first or depth-first search.&lt;br /&gt;
&lt;br /&gt;
=== -Drecursive=true ===&lt;br /&gt;
Depth first search by recursive calls instead of by a application-maintained stack&lt;br /&gt;
&lt;br /&gt;
=== -DdisableStateHashing ===&lt;br /&gt;
BPJ will not recognize previously visited states.&lt;br /&gt;
&lt;br /&gt;
=== -DestimatedStates ===&lt;br /&gt;
Control initial space allocation for state hashing&lt;br /&gt;
&lt;br /&gt;
=== -DsuppressDeadlock=true ===&lt;br /&gt;
deadlocks will not cause a verification failure.&lt;br /&gt;
&lt;br /&gt;
=== -DlogBacktracking=true ===&lt;br /&gt;
Issues a message with every visited  BProgram state&lt;br /&gt;
&lt;br /&gt;
=== -ea ===&lt;br /&gt;
Enable assertions. This standard Java JUnit parameter causes assertions in the code to be enabled and evaluated at run time, causing AssertionErrors when not true.&lt;br /&gt;
&lt;br /&gt;
=== -noverify ===&lt;br /&gt;
Resolving Java7 compatibility issues with the bytecode instrumentation.&lt;br /&gt;
&lt;br /&gt;
== Memory Management Parameters ==&lt;br /&gt;
=== -DShallow=true/false ===&lt;br /&gt;
&lt;br /&gt;
This parameter controls the serialization of objects not on the stack for backtracking during execution. See details in &amp;quot;Enabling your application for Model Checking&amp;quot;.&lt;br /&gt;
=== -Xmn=,-Xms=,-Xmx= ===&lt;br /&gt;
These parameters are standard Java memory allocation parameters, and are used to define sufficient memory for large model-checking run. E.g.:&lt;br /&gt;
&lt;br /&gt;
 -Xmn200M&lt;br /&gt;
 -Xms700M&lt;br /&gt;
 -Xmx700M&lt;br /&gt;
&lt;br /&gt;
Explanation:&lt;br /&gt;
&lt;br /&gt;
* As Java starts, it creates within the systems memory a Java Virtual Machine (JVM). JVM is where the complete processing of any Java program takes place. All Java applications (including IQv6) by default allocate &amp;amp; reserve up to 64 MB of memory resource pool from the system on which it is running.&lt;br /&gt;
* The Xms is the initial / minimum Java memory (heap) size within the JVM. Setting the initial memory (heap) size higher can help in a couple of ways. First, it will allow garbage collection (GC) to work less which is more efficient. The higher initial memory value will cause the size of the memory (heap) not to have to grow as fast as a lower initial memory (heap) size, thereby saving the overhead of the Java VM asking the OS for more memory.&lt;br /&gt;
* The Xmx is the maximum Java memory (heap) size within the Java Virtual Memory (JVM). As the JVM gets closer to fully utilizing the initial memory, it checks the Xmx settings to find out if it can draw more memory from the system resources. If it can, it does so. For the JVM to allocate contiguous memory to itself is a very expensive operation. So as the JVM gets closer to the initial memory, the JVM will use aggressive garbage collection (to clean the memory and if possible avoid memory allocation), increasing the load on the system.&lt;br /&gt;
* If JVM is in need of memory beyond the value set in Xmx, the JVM will not be able to draw more memory from system resource (even if available) and run out of memory. Hence, the -Xms and -Xmx memory parameters should be increased depending upon the demand estimation of the system. Ideally both should be the same value (set at maximum possible as per demand estimation). This ensure that the maximum memory is allocated right at the start-up eliminating the need for extra memory allocation during program execution. It is sometimes recommended to use aggressive maximum memory (heap) size of between 1/2 and 3/4 of physical memory.&lt;br /&gt;
* -Xmn: the size of the heap for the young generation.&lt;br /&gt;
See more details in general Java reference information.&lt;br /&gt;
&lt;br /&gt;
= Application-specific parameters =&lt;br /&gt;
You can pass parameters to your own application, and process them in standard Java techniques. E.g.,&lt;br /&gt;
* - nPhils=5              number of philosophers.&lt;br /&gt;
* leftyPhil=false         is any of the philosophers left handed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 static int nPhils; // number of philosophers&lt;br /&gt;
 static boolean leftyPhil = false; // Last Philosopher is left handed.&lt;br /&gt;
 static {&lt;br /&gt;
 nPhils = Integer.parseInt(System.getProperty(&amp;quot;nPhils&amp;quot;, &amp;quot;3&amp;quot;));&lt;br /&gt;
 parmString += &amp;quot;nPhils=&amp;quot; + nPhils;&lt;br /&gt;
 leftyPhil = (System.getProperty(&amp;quot;leftyPhil&amp;quot;,&amp;quot;false&amp;quot;).equals(&amp;quot;true&amp;quot;));&lt;br /&gt;
 parmString += &amp;quot;, leftyPhil=&amp;quot; + leftyPhil;&lt;br /&gt;
 System.out.println(parmString);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run Configuration Examples:&lt;br /&gt;
&lt;br /&gt;
   -DrunMode=MCSafety&lt;br /&gt;
   -Drecursive=true&lt;br /&gt;
   -Dshallow=true&lt;br /&gt;
   -noverify&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   -DrunMode=MCSafety&lt;br /&gt;
   -Dsearch=DFS&lt;br /&gt;
   -Xms300M&lt;br /&gt;
   -Xmx1000M&lt;br /&gt;
   -DestimatedStates=10000&lt;br /&gt;
   -DlogBacktracking=false&lt;br /&gt;
   -ea&lt;br /&gt;
   -noverify&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=RunMode</id>
		<title>RunMode</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=RunMode"/>
				<updated>2014-04-29T08:40:00Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* Run-control Parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BPJ Model Checking Parameters =&lt;br /&gt;
==Specifying Run Modes ==&lt;br /&gt;
&lt;br /&gt;
BPJ model checking is activated by specifying the runmode paramater in the run configuration, under VM parameters, as follows:&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=Det ===&lt;br /&gt;
* Description: “Normal”  / standard  / deterministic run.&lt;br /&gt;
* Use: when you want the program to “do something”.&lt;br /&gt;
* Nondeterminism specification: Ignored. All priorities are considered distinct.&lt;br /&gt;
* Event Selection: Always the first requested event that is not blocked.&lt;br /&gt;
* Backtracking: none.&lt;br /&gt;
* Stops: When all b-threads end, or when there are no enabled events.&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=MCSafety ===&lt;br /&gt;
* Description: A model-checking run. Explore all possible executions paths – looking to validate safety properties.&lt;br /&gt;
* Use: Model checking: explore safety properties (including deadlocks), discover desired paths, etc.&lt;br /&gt;
* Nondeterminism specification: Allowed (actually required by definition).&lt;br /&gt;
* Event selection: Systematically makes all possible combinations of event selections&lt;br /&gt;
* Backtracking: systematic as part of exploring the state-graph - as described in [[Nondeterminism | section on nondetermism]].&lt;br /&gt;
* Stops:  When counterexample is found, or when verification of all transitions / states is complete.&lt;br /&gt;
* Additional related parameters: -Dsearch=BFS/DFS,  -Drecursive=true/false&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=MCLiveness ===&lt;br /&gt;
* Description: A model-checking run– explore all execution paths looking to validate liveness properties subject to fairness assumptions.&lt;br /&gt;
* Use: Model checking for liveness properties - (with fairness assumptions),.&lt;br /&gt;
* Nondeterminism specification: Allowed (actually required by definition).&lt;br /&gt;
* Event selection: Systematically makes all possible combinations of event selections.&lt;br /&gt;
* Backtracking: systematic as part of exploring the state-graph - as described in [[Nondeterminism | section on nondetermism]].&lt;br /&gt;
Stops:  When counterexample is found, or when verification of all transitions / states is complete.&lt;br /&gt;
* Additional related parameters:   Conditional, strong and weak fairness assumptions provided as sets of events&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=Random ===&lt;br /&gt;
* Description: One possible run out of many.&lt;br /&gt;
* Use: Demonstration or manual exploration of different possible runs.&lt;br /&gt;
* Nondeterminism specification: Allowed.&lt;br /&gt;
* Event selection: Random among all nondeterministic choices.&lt;br /&gt;
* Backtracking: none.&lt;br /&gt;
* Stops: When all b-threads end, or when there are no enabled events.&lt;br /&gt;
* Additional related parameters: -DrandomSeed= nnnn.&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=Iter ===&lt;br /&gt;
* Description: An iterative run – explore all possible executions.&lt;br /&gt;
* Use: to assess traces and results of all possible runs resulting from nondeterministic choices.&lt;br /&gt;
* Nondeterminism specification: Allowed.&lt;br /&gt;
* Event selection: Systematically makes all possible combinations of event selections  - in different runs.&lt;br /&gt;
* Backtracking:  When a run ends , it is restarted , and a new combination of event selections is used - from the beginning - not at the next higher nondeterminstic choice.&lt;br /&gt;
* Stops: When the last run of all possible runs  ends (all possible combinations of event selections exhausted).&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=MCDet ===&lt;br /&gt;
Description: A deterministic run, with model-checking instrumentation. No nondeterminism. The event selection mechanism always picks  the first event that is requested and not blocked. It is the same as defining the priority delta for equal priority b-threads as zero.&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=Learning/Training ===&lt;br /&gt;
(In development)&lt;br /&gt;
&lt;br /&gt;
== Run-control Parameters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== -Dsearch=BFS or -Dsearch=DFS ===&lt;br /&gt;
Breadth-first or depth-first search.&lt;br /&gt;
&lt;br /&gt;
=== -Drecursive=true ===&lt;br /&gt;
Depth first search by recursive calls instead of by a application-maintained stack&lt;br /&gt;
&lt;br /&gt;
=== -DdisableStateHashing ===&lt;br /&gt;
BPJ will not recognize previously visited states.&lt;br /&gt;
&lt;br /&gt;
=== -DestimatedStates ===&lt;br /&gt;
Control initial space allocation for state hashing&lt;br /&gt;
&lt;br /&gt;
=== -DsuppressDeadlock=true ===&lt;br /&gt;
deadlocks will not cause a verification failure.&lt;br /&gt;
&lt;br /&gt;
=== -DlogBacktracking=true ===&lt;br /&gt;
Issues a message with every visited  BProgram state&lt;br /&gt;
&lt;br /&gt;
=== -ea ===&lt;br /&gt;
Enable assertions. This standard Java JUnit parameter causes assertions in the code to be enabled and evaluated at run time, causing AssertionErrors when not true.&lt;br /&gt;
&lt;br /&gt;
=== -noverify ===&lt;br /&gt;
Resolving Java7 compatibility issues with the bytecode instrumentation.&lt;br /&gt;
&lt;br /&gt;
== Memory Management Parameters ==&lt;br /&gt;
=== -DShallow=true/false ===&lt;br /&gt;
&lt;br /&gt;
This parameter controls the serialization of objects not on the stack for backtracking during execution. See details in &amp;quot;Enabling your application for Model Checking&amp;quot;.&lt;br /&gt;
=== -Xmn=,-Xms=,-Xmx= ===&lt;br /&gt;
These parameters are standard Java memory allocation parameters, and are used to define sufficient memory for large model-checking run. E.g.:&lt;br /&gt;
&lt;br /&gt;
 -Xmn200M&lt;br /&gt;
 -Xms700M&lt;br /&gt;
 -Xmx700M&lt;br /&gt;
&lt;br /&gt;
Explanation:&lt;br /&gt;
&lt;br /&gt;
* As Java starts, it creates within the systems memory a Java Virtual Machine (JVM). JVM is where the complete processing of any Java program takes place. All Java applications (including IQv6) by default allocate &amp;amp; reserve up to 64 MB of memory resource pool from the system on which it is running.&lt;br /&gt;
* The Xms is the initial / minimum Java memory (heap) size within the JVM. Setting the initial memory (heap) size higher can help in a couple of ways. First, it will allow garbage collection (GC) to work less which is more efficient. The higher initial memory value will cause the size of the memory (heap) not to have to grow as fast as a lower initial memory (heap) size, thereby saving the overhead of the Java VM asking the OS for more memory.&lt;br /&gt;
* The Xmx is the maximum Java memory (heap) size within the Java Virtual Memory (JVM). As the JVM gets closer to fully utilizing the initial memory, it checks the Xmx settings to find out if it can draw more memory from the system resources. If it can, it does so. For the JVM to allocate contiguous memory to itself is a very expensive operation. So as the JVM gets closer to the initial memory, the JVM will use aggressive garbage collection (to clean the memory and if possible avoid memory allocation), increasing the load on the system.&lt;br /&gt;
* If JVM is in need of memory beyond the value set in Xmx, the JVM will not be able to draw more memory from system resource (even if available) and run out of memory. Hence, the -Xms and -Xmx memory parameters should be increased depending upon the demand estimation of the system. Ideally both should be the same value (set at maximum possible as per demand estimation). This ensure that the maximum memory is allocated right at the start-up eliminating the need for extra memory allocation during program execution. It is sometimes recommended to use aggressive maximum memory (heap) size of between 1/2 and 3/4 of physical memory.&lt;br /&gt;
* -Xmn: the size of the heap for the young generation.&lt;br /&gt;
See more details in general Java reference information.&lt;br /&gt;
&lt;br /&gt;
= Application-specific parameters =&lt;br /&gt;
You can pass parameters to your own application, and process them in standard Java techniques. E.g.,&lt;br /&gt;
* - nPhils=5              number of philosophers.&lt;br /&gt;
* leftyPhil=false         is any of the philosophers left handed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 static int nPhils; // number of philosophers&lt;br /&gt;
 static boolean leftyPhil = false; // Last Philosopher is left handed.&lt;br /&gt;
 static {&lt;br /&gt;
 nPhils = Integer.parseInt(System.getProperty(&amp;quot;nPhils&amp;quot;, &amp;quot;3&amp;quot;));&lt;br /&gt;
 parmString += &amp;quot;nPhils=&amp;quot; + nPhils;&lt;br /&gt;
 leftyPhil = (System.getProperty(&amp;quot;leftyPhil&amp;quot;,&amp;quot;false&amp;quot;).equals(&amp;quot;true&amp;quot;));&lt;br /&gt;
 parmString += &amp;quot;, leftyPhil=&amp;quot; + leftyPhil;&lt;br /&gt;
 System.out.println(parmString);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run Configuration Examples:&lt;br /&gt;
&lt;br /&gt;
   -DrunMode=MCSafety&lt;br /&gt;
   -Drecursive=true&lt;br /&gt;
   -Dshallow=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   -DrunMode=MCSafety&lt;br /&gt;
   -Dsearch=DFS&lt;br /&gt;
   -Xms300M&lt;br /&gt;
   -Xmx1000M&lt;br /&gt;
   -DestimatedStates=10000&lt;br /&gt;
   -DlogBacktracking=false&lt;br /&gt;
   -ea&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=File:Sudoku1.zip</id>
		<title>File:Sudoku1.zip</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=File:Sudoku1.zip"/>
				<updated>2014-04-29T08:36:09Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Sudoku</id>
		<title>Sudoku</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Sudoku"/>
				<updated>2014-04-29T08:35:50Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Sudoku =&lt;br /&gt;
In this example one can see two properties of behavioral programming&lt;br /&gt;
* How different heuristics and pieces of knowledge about the problem domain can be used separately to program an application&lt;br /&gt;
* How model-checking can be used to help find a desired scenario.&lt;br /&gt;
&lt;br /&gt;
= Requirements =&lt;br /&gt;
In the cells of a 9X9 grid which is also divided into 9 3X3 boxes, place the digits 1-9 such that in each row, column and box, each digit appears exactly once.&lt;br /&gt;
&lt;br /&gt;
= Events =&lt;br /&gt;
&lt;br /&gt;
* Move: A single event class with 9X9X9 = 721 instances, indicating the writing of a given digit in a given cell. The class has the following data fields:&lt;br /&gt;
&lt;br /&gt;
** number: the digit written in the cell  (1-9)&lt;br /&gt;
** row: The row  of the cell (1-9)&lt;br /&gt;
** col: the column of the cell  (1-9)&lt;br /&gt;
** boxrow: The row of the 3X3 box in which this cell resides (1-3)&lt;br /&gt;
** boxcol: the column of the 3X3 box in which this cell resides (1-3)&lt;br /&gt;
&lt;br /&gt;
When enough data is provided, the strategies below are sufficient for solving the game.&lt;br /&gt;
When not enough data is provided, model checking explores the different possibilities until a solution is found.&lt;br /&gt;
&lt;br /&gt;
== Playing b-threads ==&lt;br /&gt;
* MakeGivenMoves: This b-thread provides the opening input to the riddle - filling in the known cells.&lt;br /&gt;
* DefaultMove: Each of the 81 instances of this b-thread class, is associated with a cell, and requests all possible 9 digits. Once an event occurs, all other events for the cell are blocked.&lt;br /&gt;
* DetectWin: This b-thread simply counts until 81 events have been triggered. The correctness of the solution is guaranteed&lt;br /&gt;
* EliminateTwoInABox: This b-thread tries to write a number in a cell after  the same number was written in two other columns of this box. It does not check if the cell is occopied or if the digit was already written in the present column - this is provided by event-blocking in other b-threads.&lt;br /&gt;
* PlaceANumberInARow: With an instance for each digit and each row, this b-thread tries to place a particular digit in the row. It waits till there is only one place to put it, and then requests the corresponding event.&lt;br /&gt;
* PlaceANumberInAColumn: With an instance for each digit and each row, this b-thread tries to place a particular digit in the Column. It waits till there is only one place to put it,  and then requests the corresponding event.&lt;br /&gt;
* EliminateEight: For each cell, an instance of this b-thread checks the possibilities for the cell, and eliminates possibilities as conflicting events occur elsewhere. When the number of remaining possibilities is one, the b-thread requests the remaining digit.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== b-threads that support model-checking ==&lt;br /&gt;
PruneWhenNoSolution: This b-thread requests an event at a low priority. If it is triggered, it means that all move events are blocked, hence the game has failed. It then calls the model-checking API to prune the search.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Design Notes ==&lt;br /&gt;
* The b-thread DefaultMove could have been split into two. One that requests the default moves and terminates, and one that waits for any event in a cell and blocks all alternative digits in the cell. The present design works because a pending request of DefaultMove is unified with any granted request due to the stratgies/heuristics b-threads, as well as the GivenMoves b-thread.&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
# Click [[Media:Sudoku1.zip | here]] to download the sudoku example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The sudoku example project is now part of your workspace.&lt;br /&gt;
##Refer to the readme.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Learning</id>
		<title>Learning</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Learning"/>
				<updated>2014-04-28T10:03:15Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* Reference Materials */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Adaptive Behavioral Programming =&lt;br /&gt;
&lt;br /&gt;
We introduce a way to program adaptive reactive&lt;br /&gt;
systems, using behavioral programming.&lt;br /&gt;
Extending the semantics of BPJ with reinforcements&lt;br /&gt;
allows the programmer not only to specify what&lt;br /&gt;
the system should do or must not do, but also what it should&lt;br /&gt;
try to do, in an intuitive and incremental way. By integrating&lt;br /&gt;
behavioral programs with reinforcement learning methods,&lt;br /&gt;
the program can adapt to the environment, and try to achieve&lt;br /&gt;
the desired goals.&lt;br /&gt;
&lt;br /&gt;
== Reference Materials ==&lt;br /&gt;
* Paper: [http://www.wisdom.weizmann.ac.il/~harel/papers/Adaptive%20BP.pdf Adaptive Behavioral Programming]&lt;br /&gt;
* [http://www.wisdom.weizmann.ac.il/~bprogram/code/ReinforcementLearningBPJ.zip Code and examples]: &amp;lt;br/&amp;gt;&lt;br /&gt;
** A base version of BPJ.&lt;br /&gt;
** A Java library with extensions to BPJ for reinforcement learning. Import and add to the classpath.&lt;br /&gt;
** Example: A Salad cutting robot. The b-threads provide an incomplete specification for a simulated robot that needs to pick up vegetables, cut them and serve them to customers. Using reinforcement learning, the robot learns the correct order in which to execute these actions.&lt;br /&gt;
** Example: Tic Tac Toe, where the application learns how to play despite underspecification.&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=File:Helicopter.zip</id>
		<title>File:Helicopter.zip</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=File:Helicopter.zip"/>
				<updated>2014-04-17T09:22:22Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission</id>
		<title>Helicopter flight and mission</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Helicopter_flight_and_mission"/>
				<updated>2014-04-17T09:16:31Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Helicopter Flight Example =&lt;br /&gt;
This example demonstrates the control of a toy helicopter. The mission here is to paint a wall with different colors. This can be considered as an analogy to a photography mission where a particular area as to be covered.&lt;br /&gt;
&lt;br /&gt;
== Requirements==&lt;br /&gt;
The requirements below were added incrementally, and b-threads were added to deal with each requirement. In the simulator - the painting of the wall is by drawing a line on the screen.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
*The helicopter should go up and down along the wall.&lt;br /&gt;
*When the helicopter reaches the ceiling or the floor it should move to the right&lt;br /&gt;
*Every fixed number of pixels the paint color should be changed&lt;br /&gt;
*Since the line drawn by the helicopter is thin, after every small vertical move, the helicopter should move right and left with horizontal brush strokes,  before moving vertically again.&lt;br /&gt;
*The helicopter may move from its present location due to wind.&lt;br /&gt;
*If the helicopter is moved by wind, it should return to its last known location.&lt;br /&gt;
&lt;br /&gt;
In the integration with LSC, two more requirements were added&lt;br /&gt;
*The amount of paint is limited. After a certain number of points is painted - the paint runs out.&lt;br /&gt;
*When paint of a certain color runs out, this color can no longer be used.&lt;br /&gt;
*When all paint colors run out, the helicopter must stop.&lt;br /&gt;
*Paint cans may be re-filled. This is simulated by a user clicking on a button on the screen.&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
&lt;br /&gt;
== General control events ==&lt;br /&gt;
* BeginPainting: Start the painting process&lt;br /&gt;
* StopPainting: End the painting process&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels.&lt;br /&gt;
* EndOfColUp: End painting wall going up&lt;br /&gt;
* DoColDownL Start painting wall going down&lt;br /&gt;
* EndOfColDown: End painting wall going up&lt;br /&gt;
* DoRowRight: Start painting wall going right&lt;br /&gt;
* EndOfRowRight: Stop moving right.&lt;br /&gt;
* ChangeColor: This is an event class of which there are four events, indicating a request to change the painting color to the corresponding one in the event name:&lt;br /&gt;
** eChangeColorBLACK&lt;br /&gt;
** eChangeColorRED&lt;br /&gt;
** eChangeColorBLUE&lt;br /&gt;
** eChangeColorGreen&lt;br /&gt;
* UpdateArrived: simulate information from a GPS with actual helicopter location&lt;br /&gt;
&lt;br /&gt;
=== Move Events ===&lt;br /&gt;
&lt;br /&gt;
The following events indicate the desire to move a fixed number of pixels in the desired direction. These events have a data field - indicating whether the movement is for a mission or for maintenance, which serves in correcting wind shifts.&lt;br /&gt;
&lt;br /&gt;
* MoveUp: Move down a fixed number of pixels&lt;br /&gt;
* MoveDown: Move down a fixed number of pixels&lt;br /&gt;
* MoveLeft: Move left a fixed number of pixels&lt;br /&gt;
* MoveRight: Move right a fixed number of pixels&lt;br /&gt;
&lt;br /&gt;
== BPJ b-threads ==&lt;br /&gt;
&lt;br /&gt;
=== General control b-threads ===&lt;br /&gt;
* DoColD2U: Controls coloring in the up direction;&lt;br /&gt;
* YAxis: Reports when helicopter reaches top or bottom end of wall (ceiling of floor)&lt;br /&gt;
* EndColUp: Handle reaching of ceiling. Stop moving vertically, start moving right.&lt;br /&gt;
* DoRowL2R: Left to right painting - waits for  DoRowRight and then repeatedly requests movement to the right until end of right movement is reached.&lt;br /&gt;
* XAxis: Monitor horizontal coordinates. Report reaching of right and left borders of wall, and report end of movement right to start a new column&lt;br /&gt;
* DoColU2D: Controls coloring in the up direction&lt;br /&gt;
* EndColDown: Handles reaching the floor - requests a movement to the right&lt;br /&gt;
* BrushMove: Move the brush right and left (horizontal moves) to create a thicker line and paint continuous area. This b-thread performs its actions between any two vertical moves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== Actuator b-threads ===&lt;br /&gt;
&lt;br /&gt;
The following b-threads wait for the corresponding move event and call the helicopter API (or the simulator) to cause the actual movement.&lt;br /&gt;
* MovingRight&lt;br /&gt;
* MovingLeft&lt;br /&gt;
* MovingDown&lt;br /&gt;
* MovingUp&lt;br /&gt;
&lt;br /&gt;
=== Color control b-threads ===&lt;br /&gt;
* ChangePaintingColor: Waits for the need to change color and changes the color randomly.&lt;br /&gt;
&lt;br /&gt;
=== Location correction b-threads ===&lt;br /&gt;
* FixWind: When a report comes in that the helicopter is not where it is supposed to be - stop painting movement and return to last known location.&lt;br /&gt;
&lt;br /&gt;
=== Environment Simulation ===&lt;br /&gt;
&lt;br /&gt;
* ColorControl: Counts movements and announces the need to change color.&lt;br /&gt;
* Wind: Every certain random number of steps, report a random location of the helicopter&lt;br /&gt;
&lt;br /&gt;
= Incremental Development Notes =&lt;br /&gt;
&lt;br /&gt;
With only basic movements and no color change b-threads&lt;br /&gt;
&lt;br /&gt;
[[Image: Black - thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Basic movements with color changes&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thin.jpg]]&lt;br /&gt;
&lt;br /&gt;
Adding horizontal brush movements&lt;br /&gt;
&lt;br /&gt;
[[Image: Color-thick.jpg]]&lt;br /&gt;
&lt;br /&gt;
Random movements due to wind, and return by horizontal movement and then vertical to last known location&lt;br /&gt;
&lt;br /&gt;
[[Image: FixWind.jpg]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
= LSC Integration =&lt;br /&gt;
&lt;br /&gt;
The BPJ-based system was then integrated with the LSC language via PlayGo.&lt;br /&gt;
For details how  to integrate a BPJ application with LSC see a separate section in this documentation.&lt;br /&gt;
&lt;br /&gt;
The following LSC (scenario) was added&lt;br /&gt;
&lt;br /&gt;
* PaintCanEmpty:  Waits for a certain number of movements with a given color and block subsequent changes to that color, simulating and empty can, until an event of PaintFilled arrives. This event is generated by the user clicking on a corresponding GUI Button.&lt;br /&gt;
&lt;br /&gt;
= Design Notes =&lt;br /&gt;
&lt;br /&gt;
The following design patterns and choices can be seen throughout the example.&lt;br /&gt;
&lt;br /&gt;
* Events can be distinguishes from each other by&lt;br /&gt;
** Class - different classes of events&lt;br /&gt;
** Name - multiple instances of an events of the same class distinguished by their name (e.g. the color change events).&lt;br /&gt;
** Data field - Two instances of events of the same class, with arbitrary names can be distinguished by a value in one of the event data fields (e.g. the maintenance vs. mission indicator in the move events).&lt;br /&gt;
&lt;br /&gt;
* One activity can interfere with another by using&lt;br /&gt;
** priority - (relative priority among b-thread)&lt;br /&gt;
** blocking the events of the other activity (which can be distinguished as described above)&lt;br /&gt;
&lt;br /&gt;
* Distinguishing internal and external events - those generated by the system/application and those generated by the environment (and which may be reported by sensors).&lt;br /&gt;
&lt;br /&gt;
** External events should not be blocked (enforced by convention only).&lt;br /&gt;
** When external events are produced by simulator, the concepts of Logical Execution Time should be enforced by convention, where all internal events reacting to the last external event should be processed before generating the next external event.&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
# Click [[Media:Helicopter.zip | here]] to download the helicopter example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The helicopter example projects are now part of your workspace.&lt;br /&gt;
### The example includes three projects: &lt;br /&gt;
#### BDrone - The main project that includes the b-threads that implement the drawing/scanning tasks.&lt;br /&gt;
#### HeliSim - A simple java-based simulator.&lt;br /&gt;
#### il.ac.wis.cs.rovtool.blender - A blender-based simulator.&lt;br /&gt;
##Refer to the BDrone/HowToRun.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=File:Flock.zip</id>
		<title>File:Flock.zip</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=File:Flock.zip"/>
				<updated>2014-04-17T08:04:47Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Flight_of_a_flock_of_birds</id>
		<title>Flight of a flock of birds</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Flight_of_a_flock_of_birds"/>
				<updated>2014-04-17T08:03:46Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* Download */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulating Flight of a Flock of Birds =&lt;br /&gt;
In this example we simulate the flight of a flock of birds, with each bird having a simple set of rules implemented as b-threads.&lt;br /&gt;
The example highlights&lt;br /&gt;
* Multi-agent activity&lt;br /&gt;
* Emergent group behaviors - emanating from individual agent behavior&lt;br /&gt;
* Implementation of animation with BPJ - and handling of associated design issues.&lt;br /&gt;
&lt;br /&gt;
= Requirements - from each bird =&lt;br /&gt;
* Always try to move towards the center of the flock&lt;br /&gt;
* Always avoid colliding with other birds&lt;br /&gt;
* When getting close to a wall - change direction - in the same &amp;quot;reflection&amp;quot; angle&lt;br /&gt;
* When the &amp;quot;Scare&amp;quot; button is hit - fly away from the center of the flock.&lt;br /&gt;
&lt;br /&gt;
A video example of the result can be seen here ** add link **&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
# Click [[Media:Flock.zip | here]] to download the flock of birds example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The flock of birds example project is now part of your workspace.&lt;br /&gt;
##Refer to the readme.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Tic-Tac-Toe</id>
		<title>Tic-Tac-Toe</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Tic-Tac-Toe"/>
				<updated>2014-04-17T07:57:19Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= A behavioral program for the game of Tic-Tac-Toe =&lt;br /&gt;
&lt;br /&gt;
== Game Description ==&lt;br /&gt;
Two players, X and O, alternately mark squares on a 3X3 grid whose squares are identified by &amp;lt;row,column&amp;gt; pairs: &amp;lt;0,0&amp;gt;, &amp;lt;0,1&amp;gt;, ...,&amp;lt;2,2&amp;gt;. The winner is the player who manages to form a full horizontal, vertical or diagonal line with three of his/her marks.&lt;br /&gt;
If the entire grid becomes marked but no player has formed a line, the result is a draw.&lt;br /&gt;
&lt;br /&gt;
In our example, player X should be played by a human user, and player O is played by the application. Each move (marking of a square by a player) is represented by an event, X_&amp;lt;row,col&amp;gt; or O_&amp;lt;row,col&amp;gt;. Three additional events, XWin, OWin, and draw$, represent the respective victories and a draw.&lt;br /&gt;
&lt;br /&gt;
A play of the game may be described as a sequence of events. E.g., the sequence&lt;br /&gt;
X_&amp;lt;0,0&amp;gt;, O_&amp;lt;1,1&amp;gt;, X_&amp;lt;2,1&amp;gt;, O_&amp;lt;0,2&amp;gt;, X_&amp;lt;2,0&amp;gt;, O_&amp;lt;1,0&amp;gt;, X_&amp;lt;2,2&amp;gt;, XWin  describes a play in which X wins, and whose final configuration is:&lt;br /&gt;
&lt;br /&gt;
[[Image:TTT01.jpg ]]&lt;br /&gt;
&lt;br /&gt;
== b-Threads ==&lt;br /&gt;
Below are listed the b-threads of the application.&lt;br /&gt;
&lt;br /&gt;
=== Rules of the game ===&lt;br /&gt;
* SquareTaken: block further marking of a square already marked by X or O.&lt;br /&gt;
* EnforceTurns: alternately block O moves while waiting for X moves, and vice versa (we assume that X always plays first).&lt;br /&gt;
* DetectXWin: wait for placement of three X marks in a line and request XWin.&lt;br /&gt;
* DetectOWin: wait for placement of three O marks in a line and request OWin.&lt;br /&gt;
* DetectDraw: wait for nine moves and request draw event.&lt;br /&gt;
&lt;br /&gt;
=== Strategies ===&lt;br /&gt;
*DefaultMoves: a b-thread that repeatedly requests all nine possible O moves in the following order of center, corners and edges:  O_&amp;lt;1,1&amp;gt;,O_&amp;lt;0,0&amp;gt;,O_&amp;lt;0,2&amp;gt;,O_&amp;lt;2,0&amp;gt;,O_&amp;lt;2,2&amp;gt;, O_&amp;lt;0,1&amp;gt;,O_&amp;lt;1,0&amp;gt;,O_&amp;lt;1,2&amp;gt;,O_&amp;lt;2,1&amp;gt;.&lt;br /&gt;
*PreventThirdX: when two Xs are noticed in a line, add an O in that line (and prevent an immediate loss).&lt;br /&gt;
*AddThirdO: when two Os are located on a single line,  add a third O (and win).&lt;br /&gt;
*PreventXFork: when two Xs are noticed, in a corner and opposing edge such that X may force a win,  mark an O in the intersection corner of the potential fork, thus preventing its creation.&lt;br /&gt;
*PreventAnotherXFork: when the first two Xs are marked in two opposite corners  and the first O is marked at the center, request O_&amp;lt;0,1&amp;gt;.&lt;br /&gt;
In the spirit of ``the best defense is a good offense'', this move creates an attack that forces X to play X_&amp;lt;2,1&amp;gt;, and seems to avoid the immediate fork threat.&lt;br /&gt;
*PreventYetAnotherXFork: when two Xs are noticed in two edge squares that are adjacent to a common corner, mark an O in that corner.&lt;br /&gt;
&lt;br /&gt;
== Other Classes ==&lt;br /&gt;
*ExternalApp: The main class of the application. Loads and starts the b-threads&lt;br /&gt;
*GUI: Manages the display&lt;br /&gt;
&lt;br /&gt;
== Design Notes ==&lt;br /&gt;
For some b-threads such as DefaultMoves there is a single instance. Other b-threads, such as AddThirdO are parametric, and there is a separate instance of the b-thread for each ordering of the three events in each row, column and diagonal. Thus, in the present design such b-threads do not maintain a copy of the board, but instead are simply waiting for very specific two events in a given order and responding with other events. Other designs are of course possible&amp;gt; for example a b-thread can be responsible for three events in any order, wait for any two in any order and then request the third. In another design a b-thread can maintain a copy of the board, wait for almost any event, keep track of board configuration changes, look for lines to complete, and request the corresponding move events.&lt;br /&gt;
&lt;br /&gt;
== Download ==&lt;br /&gt;
# Click [[Media:TicTacToe.zip | here]] to download the tic-tac-toe example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The tic-tac-toe example project is now part of your workspace.&lt;br /&gt;
##Refer to the readme.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Flight_of_a_flock_of_birds</id>
		<title>Flight of a flock of birds</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Flight_of_a_flock_of_birds"/>
				<updated>2014-04-17T07:56:38Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Simulating Flight of a Flock of Birds =&lt;br /&gt;
In this example we simulate the flight of a flock of birds, with each bird having a simple set of rules implemented as b-threads.&lt;br /&gt;
The example highlights&lt;br /&gt;
* Multi-agent activity&lt;br /&gt;
* Emergent group behaviors - emanating from individual agent behavior&lt;br /&gt;
* Implementation of animation with BPJ - and handling of associated design issues.&lt;br /&gt;
&lt;br /&gt;
= Requirements - from each bird =&lt;br /&gt;
* Always try to move towards the center of the flock&lt;br /&gt;
* Always avoid colliding with other birds&lt;br /&gt;
* When getting close to a wall - change direction - in the same &amp;quot;reflection&amp;quot; angle&lt;br /&gt;
* When the &amp;quot;Scare&amp;quot; button is hit - fly away from the center of the flock.&lt;br /&gt;
&lt;br /&gt;
A video example of the result can be seen here ** add link **&lt;br /&gt;
&lt;br /&gt;
= Download =&lt;br /&gt;
# Click [[Media:TicTacToe.zip | here]] to download the flock of birds example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The flock of birds example project is now part of your workspace.&lt;br /&gt;
##Refer to the readme.txt file for execution instructions.&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Tic-Tac-Toe</id>
		<title>Tic-Tac-Toe</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Tic-Tac-Toe"/>
				<updated>2014-04-17T07:48:50Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* A behavioral program for the game of Tic-Tac-Toe */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= A behavioral program for the game of Tic-Tac-Toe =&lt;br /&gt;
&lt;br /&gt;
# Click [[Media:TicTacToe.zip | here]] to download the tic-tac-toe example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the 'File' menu choose 'Import'--&amp;amp;gt;'General'--&amp;amp;gt;'Existing Projects into Workspace'.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###Click the 'Select archive file' option and then click the 'Browse...' button to select the downloaded zip file.&lt;br /&gt;
###Click 'Finish'.&lt;br /&gt;
##The tic-tac-toe example project is now part of your workspace.&lt;br /&gt;
##Refer to the readme.txt file for execution instructions.&lt;br /&gt;
&lt;br /&gt;
== Game Description ==&lt;br /&gt;
Two players, X and O, alternately mark squares on a 3X3 grid whose squares are identified by &amp;lt;row,column&amp;gt; pairs: &amp;lt;0,0&amp;gt;, &amp;lt;0,1&amp;gt;, ...,&amp;lt;2,2&amp;gt;. The winner is the player who manages to form a full horizontal, vertical or diagonal line with three of his/her marks.&lt;br /&gt;
If the entire grid becomes marked but no player has formed a line, the result is a draw.&lt;br /&gt;
&lt;br /&gt;
In our example, player X should be played by a human user, and player O is played by the application. Each move (marking of a square by a player) is represented by an event, X_&amp;lt;row,col&amp;gt; or O_&amp;lt;row,col&amp;gt;. Three additional events, XWin, OWin, and draw$, represent the respective victories and a draw.&lt;br /&gt;
&lt;br /&gt;
A play of the game may be described as a sequence of events. E.g., the sequence&lt;br /&gt;
X_&amp;lt;0,0&amp;gt;, O_&amp;lt;1,1&amp;gt;, X_&amp;lt;2,1&amp;gt;, O_&amp;lt;0,2&amp;gt;, X_&amp;lt;2,0&amp;gt;, O_&amp;lt;1,0&amp;gt;, X_&amp;lt;2,2&amp;gt;, XWin  describes a play in which X wins, and whose final configuration is:&lt;br /&gt;
&lt;br /&gt;
[[Image:TTT01.jpg ]]&lt;br /&gt;
&lt;br /&gt;
== b-Threads ==&lt;br /&gt;
Below are listed the b-threads of the application.&lt;br /&gt;
&lt;br /&gt;
=== Rules of the game ===&lt;br /&gt;
* SquareTaken: block further marking of a square already marked by X or O.&lt;br /&gt;
* EnforceTurns: alternately block O moves while waiting for X moves, and vice versa (we assume that X always plays first).&lt;br /&gt;
* DetectXWin: wait for placement of three X marks in a line and request XWin.&lt;br /&gt;
* DetectOWin: wait for placement of three O marks in a line and request OWin.&lt;br /&gt;
* DetectDraw: wait for nine moves and request draw event.&lt;br /&gt;
&lt;br /&gt;
=== Strategies ===&lt;br /&gt;
*DefaultMoves: a b-thread that repeatedly requests all nine possible O moves in the following order of center, corners and edges:  O_&amp;lt;1,1&amp;gt;,O_&amp;lt;0,0&amp;gt;,O_&amp;lt;0,2&amp;gt;,O_&amp;lt;2,0&amp;gt;,O_&amp;lt;2,2&amp;gt;, O_&amp;lt;0,1&amp;gt;,O_&amp;lt;1,0&amp;gt;,O_&amp;lt;1,2&amp;gt;,O_&amp;lt;2,1&amp;gt;.&lt;br /&gt;
*PreventThirdX: when two Xs are noticed in a line, add an O in that line (and prevent an immediate loss).&lt;br /&gt;
*AddThirdO: when two Os are located on a single line,  add a third O (and win).&lt;br /&gt;
*PreventXFork: when two Xs are noticed, in a corner and opposing edge such that X may force a win,  mark an O in the intersection corner of the potential fork, thus preventing its creation.&lt;br /&gt;
*PreventAnotherXFork: when the first two Xs are marked in two opposite corners  and the first O is marked at the center, request O_&amp;lt;0,1&amp;gt;.&lt;br /&gt;
In the spirit of ``the best defense is a good offense'', this move creates an attack that forces X to play X_&amp;lt;2,1&amp;gt;, and seems to avoid the immediate fork threat.&lt;br /&gt;
*PreventYetAnotherXFork: when two Xs are noticed in two edge squares that are adjacent to a common corner, mark an O in that corner.&lt;br /&gt;
&lt;br /&gt;
== Other Classes ==&lt;br /&gt;
*ExternalApp: The main class of the application. Loads and starts the b-threads&lt;br /&gt;
*GUI: Manages the display&lt;br /&gt;
&lt;br /&gt;
== Design Notes ==&lt;br /&gt;
For some b-threads such as DefaultMoves there is a single instance. Other b-threads, such as AddThirdO are parametric, and there is a separate instance of the b-thread for each ordering of the three events in each row, column and diagonal. Thus, in the present design such b-threads do not maintain a copy of the board, but instead are simply waiting for very specific two events in a given order and responding with other events. Other designs are of course possible&amp;gt; for example a b-thread can be responsible for three events in any order, wait for any two in any order and then request the third. In another design a b-thread can maintain a copy of the board, wait for almost any event, keep track of board configuration changes, look for lines to complete, and request the corresponding move events.&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=File:TicTacToe.zip</id>
		<title>File:TicTacToe.zip</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=File:TicTacToe.zip"/>
				<updated>2014-04-17T07:42:59Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Tic-Tac-Toe</id>
		<title>Tic-Tac-Toe</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Tic-Tac-Toe"/>
				<updated>2014-04-17T07:36:02Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= A behavioral program for the game of Tic-Tac-Toe =&lt;br /&gt;
&lt;br /&gt;
# Click [[Media:TicTacToe.zip | here]] to download the tic-tac-toe example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the File menu choose Import--&amp;amp;gt;General--&amp;amp;gt;Existing Projects into Workspace.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###When prompted, select the downloaded zip file.&lt;br /&gt;
###Click finish.&lt;br /&gt;
##The tic-tac-toe example project is now part of your workspace.&lt;br /&gt;
##Refer to the readme.txt file for execution instructions.&lt;br /&gt;
&lt;br /&gt;
== Game Description ==&lt;br /&gt;
Two players, X and O, alternately mark squares on a 3X3 grid whose squares are identified by &amp;lt;row,column&amp;gt; pairs: &amp;lt;0,0&amp;gt;, &amp;lt;0,1&amp;gt;, ...,&amp;lt;2,2&amp;gt;. The winner is the player who manages to form a full horizontal, vertical or diagonal line with three of his/her marks.&lt;br /&gt;
If the entire grid becomes marked but no player has formed a line, the result is a draw.&lt;br /&gt;
&lt;br /&gt;
In our example, player X should be played by a human user, and player O is played by the application. Each move (marking of a square by a player) is represented by an event, X_&amp;lt;row,col&amp;gt; or O_&amp;lt;row,col&amp;gt;. Three additional events, XWin, OWin, and draw$, represent the respective victories and a draw.&lt;br /&gt;
&lt;br /&gt;
A play of the game may be described as a sequence of events. E.g., the sequence&lt;br /&gt;
X_&amp;lt;0,0&amp;gt;, O_&amp;lt;1,1&amp;gt;, X_&amp;lt;2,1&amp;gt;, O_&amp;lt;0,2&amp;gt;, X_&amp;lt;2,0&amp;gt;, O_&amp;lt;1,0&amp;gt;, X_&amp;lt;2,2&amp;gt;, XWin  describes a play in which X wins, and whose final configuration is:&lt;br /&gt;
&lt;br /&gt;
[[Image:TTT01.jpg ]]&lt;br /&gt;
&lt;br /&gt;
== b-Threads ==&lt;br /&gt;
Below are listed the b-threads of the application.&lt;br /&gt;
&lt;br /&gt;
=== Rules of the game ===&lt;br /&gt;
* SquareTaken: block further marking of a square already marked by X or O.&lt;br /&gt;
* EnforceTurns: alternately block O moves while waiting for X moves, and vice versa (we assume that X always plays first).&lt;br /&gt;
* DetectXWin: wait for placement of three X marks in a line and request XWin.&lt;br /&gt;
* DetectOWin: wait for placement of three O marks in a line and request OWin.&lt;br /&gt;
* DetectDraw: wait for nine moves and request draw event.&lt;br /&gt;
&lt;br /&gt;
=== Strategies ===&lt;br /&gt;
*DefaultMoves: a b-thread that repeatedly requests all nine possible O moves in the following order of center, corners and edges:  O_&amp;lt;1,1&amp;gt;,O_&amp;lt;0,0&amp;gt;,O_&amp;lt;0,2&amp;gt;,O_&amp;lt;2,0&amp;gt;,O_&amp;lt;2,2&amp;gt;, O_&amp;lt;0,1&amp;gt;,O_&amp;lt;1,0&amp;gt;,O_&amp;lt;1,2&amp;gt;,O_&amp;lt;2,1&amp;gt;.&lt;br /&gt;
*PreventThirdX: when two Xs are noticed in a line, add an O in that line (and prevent an immediate loss).&lt;br /&gt;
*AddThirdO: when two Os are located on a single line,  add a third O (and win).&lt;br /&gt;
*PreventXFork: when two Xs are noticed, in a corner and opposing edge such that X may force a win,  mark an O in the intersection corner of the potential fork, thus preventing its creation.&lt;br /&gt;
*PreventAnotherXFork: when the first two Xs are marked in two opposite corners  and the first O is marked at the center, request O_&amp;lt;0,1&amp;gt;.&lt;br /&gt;
In the spirit of ``the best defense is a good offense'', this move creates an attack that forces X to play X_&amp;lt;2,1&amp;gt;, and seems to avoid the immediate fork threat.&lt;br /&gt;
*PreventYetAnotherXFork: when two Xs are noticed in two edge squares that are adjacent to a common corner, mark an O in that corner.&lt;br /&gt;
&lt;br /&gt;
== Other Classes ==&lt;br /&gt;
*ExternalApp: The main class of the application. Loads and starts the b-threads&lt;br /&gt;
*GUI: Manages the display&lt;br /&gt;
&lt;br /&gt;
== Design Notes ==&lt;br /&gt;
For some b-threads such as DefaultMoves there is a single instance. Other b-threads, such as AddThirdO are parametric, and there is a separate instance of the b-thread for each ordering of the three events in each row, column and diagonal. Thus, in the present design such b-threads do not maintain a copy of the board, but instead are simply waiting for very specific two events in a given order and responding with other events. Other designs are of course possible&amp;gt; for example a b-thread can be responsible for three events in any order, wait for any two in any order and then request the third. In another design a b-thread can maintain a copy of the board, wait for almost any event, keep track of board configuration changes, look for lines to complete, and request the corresponding move events.&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Tic-Tac-Toe</id>
		<title>Tic-Tac-Toe</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Tic-Tac-Toe"/>
				<updated>2014-04-17T07:34:59Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= A behavioral program for the game of Tic-Tac-Toe =&lt;br /&gt;
&lt;br /&gt;
# Click [[Media:BPJ_1.1.0.zip | here]] to download the tic-tac-toe example.&lt;br /&gt;
# Installation Instructions:&lt;br /&gt;
##Import the downloaded project to your workspace:&lt;br /&gt;
###From the File menu choose Import--&amp;amp;gt;General--&amp;amp;gt;Existing Projects into Workspace.&lt;br /&gt;
###Click the 'Next' button.&lt;br /&gt;
###When prompted, select the downloaded zip file.&lt;br /&gt;
###Click finish.&lt;br /&gt;
##The tic-tac-toe example project is now part of your workspace.&lt;br /&gt;
##Refer to the readme.txt file for execution instructions.&lt;br /&gt;
&lt;br /&gt;
== Game Description ==&lt;br /&gt;
Two players, X and O, alternately mark squares on a 3X3 grid whose squares are identified by &amp;lt;row,column&amp;gt; pairs: &amp;lt;0,0&amp;gt;, &amp;lt;0,1&amp;gt;, ...,&amp;lt;2,2&amp;gt;. The winner is the player who manages to form a full horizontal, vertical or diagonal line with three of his/her marks.&lt;br /&gt;
If the entire grid becomes marked but no player has formed a line, the result is a draw.&lt;br /&gt;
&lt;br /&gt;
In our example, player X should be played by a human user, and player O is played by the application. Each move (marking of a square by a player) is represented by an event, X_&amp;lt;row,col&amp;gt; or O_&amp;lt;row,col&amp;gt;. Three additional events, XWin, OWin, and draw$, represent the respective victories and a draw.&lt;br /&gt;
&lt;br /&gt;
A play of the game may be described as a sequence of events. E.g., the sequence&lt;br /&gt;
X_&amp;lt;0,0&amp;gt;, O_&amp;lt;1,1&amp;gt;, X_&amp;lt;2,1&amp;gt;, O_&amp;lt;0,2&amp;gt;, X_&amp;lt;2,0&amp;gt;, O_&amp;lt;1,0&amp;gt;, X_&amp;lt;2,2&amp;gt;, XWin  describes a play in which X wins, and whose final configuration is:&lt;br /&gt;
&lt;br /&gt;
[[Image:TTT01.jpg ]]&lt;br /&gt;
&lt;br /&gt;
== b-Threads ==&lt;br /&gt;
Below are listed the b-threads of the application.&lt;br /&gt;
&lt;br /&gt;
=== Rules of the game ===&lt;br /&gt;
* SquareTaken: block further marking of a square already marked by X or O.&lt;br /&gt;
* EnforceTurns: alternately block O moves while waiting for X moves, and vice versa (we assume that X always plays first).&lt;br /&gt;
* DetectXWin: wait for placement of three X marks in a line and request XWin.&lt;br /&gt;
* DetectOWin: wait for placement of three O marks in a line and request OWin.&lt;br /&gt;
* DetectDraw: wait for nine moves and request draw event.&lt;br /&gt;
&lt;br /&gt;
=== Strategies ===&lt;br /&gt;
*DefaultMoves: a b-thread that repeatedly requests all nine possible O moves in the following order of center, corners and edges:  O_&amp;lt;1,1&amp;gt;,O_&amp;lt;0,0&amp;gt;,O_&amp;lt;0,2&amp;gt;,O_&amp;lt;2,0&amp;gt;,O_&amp;lt;2,2&amp;gt;, O_&amp;lt;0,1&amp;gt;,O_&amp;lt;1,0&amp;gt;,O_&amp;lt;1,2&amp;gt;,O_&amp;lt;2,1&amp;gt;.&lt;br /&gt;
*PreventThirdX: when two Xs are noticed in a line, add an O in that line (and prevent an immediate loss).&lt;br /&gt;
*AddThirdO: when two Os are located on a single line,  add a third O (and win).&lt;br /&gt;
*PreventXFork: when two Xs are noticed, in a corner and opposing edge such that X may force a win,  mark an O in the intersection corner of the potential fork, thus preventing its creation.&lt;br /&gt;
*PreventAnotherXFork: when the first two Xs are marked in two opposite corners  and the first O is marked at the center, request O_&amp;lt;0,1&amp;gt;.&lt;br /&gt;
In the spirit of ``the best defense is a good offense'', this move creates an attack that forces X to play X_&amp;lt;2,1&amp;gt;, and seems to avoid the immediate fork threat.&lt;br /&gt;
*PreventYetAnotherXFork: when two Xs are noticed in two edge squares that are adjacent to a common corner, mark an O in that corner.&lt;br /&gt;
&lt;br /&gt;
== Other Classes ==&lt;br /&gt;
*ExternalApp: The main class of the application. Loads and starts the b-threads&lt;br /&gt;
*GUI: Manages the display&lt;br /&gt;
&lt;br /&gt;
== Design Notes ==&lt;br /&gt;
For some b-threads such as DefaultMoves there is a single instance. Other b-threads, such as AddThirdO are parametric, and there is a separate instance of the b-thread for each ordering of the three events in each row, column and diagonal. Thus, in the present design such b-threads do not maintain a copy of the board, but instead are simply waiting for very specific two events in a given order and responding with other events. Other designs are of course possible&amp;gt; for example a b-thread can be responsible for three events in any order, wait for any two in any order and then request the third. In another design a b-thread can maintain a copy of the board, wait for almost any event, keep track of board configuration changes, look for lines to complete, and request the corresponding move events.&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=JavaFlow</id>
		<title>JavaFlow</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=JavaFlow"/>
				<updated>2014-03-19T09:49:01Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* Enabling your application for model checking */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Enabling your application for model checking=&lt;br /&gt;
In addition to the controls described in earlier sections, there are certain constraints on how the application should be coded to enable model checking.&lt;br /&gt;
BPJ uses the package Javaflow to perform backtracking as needed for model checking. Depending on the run mode, BPJ instruments the application for Javaflow. As part of traversing all possible execution paths, BPJ model checking uses Javaflow for backtracking and saves and restores the thread’s stack using an object called &amp;quot;continuation&amp;quot;. The stack contains the non-static fields/variables from the b-thread class and the variables defined in-line in the runBThread method. Objects (which are not on the stack) are saved and restored by the BPJ model checking using serialization and deserialization of the continuation object. Serialization translates each field and each object pointed to from the continuation into a bit stream. Deserialization turns such bit streams into program objects and fully restores the state.&lt;br /&gt;
&lt;br /&gt;
= Programming Requirement 1=&lt;br /&gt;
When two pointers on the stack point to the same object, Javaflow deserialization creates two copies of the object, and the application that relied on the two being one object no longer works. Therefore,  do not use the operator &amp;quot;==&amp;quot; to compare objects that are part of the b-thread's state. Instead, use the equals() method.  A default equals() method based on object ids already exists for events.&lt;br /&gt;
&lt;br /&gt;
=Programming Requirement 2=&lt;br /&gt;
Serialization and desrialization may significantly slow the application. Therefore, if you have objects that do not change from one bt-state to another,  mark them as transient static (for the class or for the instance, as needed). Objects marked as transient are not processed by serialization and deserialization resets them to their initial value.&lt;br /&gt;
&lt;br /&gt;
=Programming Tip=&lt;br /&gt;
If all the objects pointed to from the stack can be transient as defined above, you  do not have to specify them as transient, and instead you can just specify static, and specify the run time parameter &amp;quot;–Dshallow=true&amp;quot; (the default&lt;br /&gt;
is &amp;quot;-Dshallow=false&amp;quot;). Then, the when BPJ uses Javaflow to save and restore the stack(s) it does not perform serialization and deserialization.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Image:Dshallow.png | 600px | &amp;lt;span style=&amp;quot;color: rgb(0, 128, 128);&amp;quot;&amp;gt;&amp;lt;span style=&amp;quot;font-family: Tahoma;&amp;quot;&amp;gt; Object serialization&amp;lt;/span&amp;gt; &amp;lt;/span&amp;gt;]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Example:&lt;br /&gt;
Examine the code snippet below:&lt;br /&gt;
&lt;br /&gt;
   Integer x = new Integer(5);&lt;br /&gt;
   bSync(...)&lt;br /&gt;
   x++;&lt;br /&gt;
   bSync(...)&lt;br /&gt;
&lt;br /&gt;
If -Dshallow=true is specified, in the second visit to the second bSync (after backtracking to try an execution with a different choice of event in the first bSync) the value of X will be 7, because X was not restored. Solution:  Use int and not Integer - and then the variable is on the stack, and is always restored with backtracking, or use&lt;br /&gt;
-Dshallow=false, to force full serialization.&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Nondeterminism</id>
		<title>Nondeterminism</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Nondeterminism"/>
				<updated>2014-03-19T09:47:52Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* Nondeterministic execution in BPJ model checking */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Nondeterministic execution in BPJ model checking =&lt;br /&gt;
In common processing event selection in BP is deterministic.&lt;br /&gt;
However, in some cases it is desired to specify nondetermistic choices - e.g., when simulating environment behavior using b-threads as part of model checking. Model checking explores all possible execution paths defined by this nondeterminism.&lt;br /&gt;
&lt;br /&gt;
== Specifiying nondeterminism ==&lt;br /&gt;
* In BP, event selection is deteremined by the unique priority of each b-thread, and by the order of events in the requested event set.&lt;br /&gt;
* When the difference in priority of two b-threads is less than a given &amp;quot;epsilon&amp;quot; (a real number provided by the user), the two b-threads  are considered of same priority.  For example, to create 48 bthreads of the same priority, choose epsilon of 1.00 and  create the set of these b-threads so that their priorities have the same whole part and differ only by fractional part.  (e.g. priority values of 7.001 – 7.048). The value of &amp;quot;epsilon&amp;quot; is determined by&lt;br /&gt;
&lt;br /&gt;
 . . .&lt;br /&gt;
&lt;br /&gt;
== Nondeterministic execution ==&lt;br /&gt;
&lt;br /&gt;
* In a given requested-events set, events that are in the same second level event set are considered of same priority . E.g. in the requested event set R={a, {b,c,d},{e,f,g}}. b,c,d are considered of the same priority, and e,f,g are considered of the same priority.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
When executing in model-checking mode, nondetereministic event selection is performed according to the following algorithm :&lt;br /&gt;
&lt;br /&gt;
* Scan b-threads in order of priority&lt;br /&gt;
* Scan the requested event set of each b-thread in event order (the set is enumerable).&lt;br /&gt;
* When the first event that is requested and not blocked is found  it is remembered as one alternative.&lt;br /&gt;
* If the selected event was in a  second level event set (a set within a set),  all its siblings in the same second level set that are not blocked are considered having the same priority, and are added as alternatives.&lt;br /&gt;
* If the event is in a first level of the requested event set, this event is the only one from this b-thread.&lt;br /&gt;
* After exploring all execution subtrees anchored at the alternatives from one b-thread go to the next b-thread of “same” priority as defined with epsilon, and repeat the above . At most one second-level set will be selected from the requested events of that b-thread, but not necessarily the first one.&lt;br /&gt;
* When all alternatives in a given execution path are explored the execution returns to the next higher level in the nondeterminstic execution path to select the next alternative at that level.&lt;br /&gt;
* BPJ model checking uses the Java package javaflow to restore the stack of all b-threads in order to resume execution of another subtree at a previously visited synchronization point.&lt;br /&gt;
* Example&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=RunMode</id>
		<title>RunMode</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=RunMode"/>
				<updated>2014-03-19T09:46:28Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* BPJ Model Checking Parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BPJ Model Checking Parameters =&lt;br /&gt;
==Specifying Run Modes ==&lt;br /&gt;
&lt;br /&gt;
BPJ model checking is activated by specifying the runmode paramater in the run configuration, under VM parameters, as follows:&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=Det ===&lt;br /&gt;
* Description: “Normal”  / standard  / deterministic run.&lt;br /&gt;
* Use: when you want the program to “do something”.&lt;br /&gt;
* Nondeterminism specification: Ignored. All priorities are considered distinct.&lt;br /&gt;
* Event Selection: Always the first requested event that is not blocked.&lt;br /&gt;
* Backtracking: none.&lt;br /&gt;
* Stops: When all b-threads end, or when there are no enabled events.&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=MCSafety ===&lt;br /&gt;
* Description: A model-checking run. Explore all possible executions paths – looking to validate safety properties.&lt;br /&gt;
* Use: Model checking: explore safety properties (including deadlocks), discover desired paths, etc.&lt;br /&gt;
* Nondeterminism specification: Allowed (actually required by definition).&lt;br /&gt;
* Event selection: Systematically makes all possible combinations of event selections&lt;br /&gt;
* Backtracking: systematic as part of exploring the state-graph - as described in [[Nondeterminism | section on nondetermism]].&lt;br /&gt;
* Stops:  When counterexample is found, or when verification of all transitions / states is complete.&lt;br /&gt;
* Additional related parameters: -Dsearch=BFS/DFS,  -Drecursive=true/false&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=MCLiveness ===&lt;br /&gt;
* Description: A model-checking run– explore all execution paths looking to validate liveness properties subject to fairness assumptions.&lt;br /&gt;
* Use: Model checking for liveness properties - (with fairness assumptions),.&lt;br /&gt;
* Nondeterminism specification: Allowed (actually required by definition).&lt;br /&gt;
* Event selection: Systematically makes all possible combinations of event selections.&lt;br /&gt;
* Backtracking: systematic as part of exploring the state-graph - as described in [[Nondeterminism | section on nondetermism]].&lt;br /&gt;
Stops:  When counterexample is found, or when verification of all transitions / states is complete.&lt;br /&gt;
* Additional related parameters:   Conditional, strong and weak fairness assumptions provided as sets of events&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=Random ===&lt;br /&gt;
* Description: One possible run out of many.&lt;br /&gt;
* Use: Demonstration or manual exploration of different possible runs.&lt;br /&gt;
* Nondeterminism specification: Allowed.&lt;br /&gt;
* Event selection: Random among all nondeterministic choices.&lt;br /&gt;
* Backtracking: none.&lt;br /&gt;
* Stops: When all b-threads end, or when there are no enabled events.&lt;br /&gt;
* Additional related parameters: -DrandomSeed= nnnn.&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=Iter ===&lt;br /&gt;
* Description: An iterative run – explore all possible executions.&lt;br /&gt;
* Use: to assess traces and results of all possible runs resulting from nondeterministic choices.&lt;br /&gt;
* Nondeterminism specification: Allowed.&lt;br /&gt;
* Event selection: Systematically makes all possible combinations of event selections  - in different runs.&lt;br /&gt;
* Backtracking:  When a run ends , it is restarted , and a new combination of event selections is used - from the beginning - not at the next higher nondeterminstic choice.&lt;br /&gt;
* Stops: When the last run of all possible runs  ends (all possible combinations of event selections exhausted).&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=MCDet ===&lt;br /&gt;
Description: A deterministic run, with model-checking instrumentation. No nondeterminism. The event selection mechanism always picks  the first event that is requested and not blocked. It is the same as defining the priority delta for equal priority b-threads as zero.&lt;br /&gt;
&lt;br /&gt;
=== -DrunMode=Learning/Training ===&lt;br /&gt;
(In development)&lt;br /&gt;
&lt;br /&gt;
== Run-control Parameters ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=== -Dsearch=BFS or -Dsearch=DFS ===&lt;br /&gt;
breadth or depth first search.&lt;br /&gt;
&lt;br /&gt;
=== -Drecursive=true ===&lt;br /&gt;
Depth first search by recursive calls instead of by a application-maintained stack (ToDo...elaborate)&lt;br /&gt;
&lt;br /&gt;
=== -DdisableStateHashing ===&lt;br /&gt;
BPJ will not recognize previously visited states.&lt;br /&gt;
&lt;br /&gt;
=== -DestimatedStates ===&lt;br /&gt;
Control initial space allocation for state hashing&lt;br /&gt;
&lt;br /&gt;
=== -DsuppressDeadlock=true ===&lt;br /&gt;
deadlocks will not cause a verification failure.&lt;br /&gt;
&lt;br /&gt;
=== -DlogBacktracking=true ===&lt;br /&gt;
Issues a message with every visited  BProgram state&lt;br /&gt;
&lt;br /&gt;
=== -ea ===&lt;br /&gt;
Enable assertions. This standard Java JUnit parameter causes assertions in the code to be enabled and evaluated at run time, causing AssertionErrors when not true.&lt;br /&gt;
&lt;br /&gt;
== Memory Management Parameters ==&lt;br /&gt;
=== -DShallow=true/false ===&lt;br /&gt;
&lt;br /&gt;
This parameter controls the serialization of objects not on the stack for backtracking during execution. See details in &amp;quot;Enabling your application for Model Checking&amp;quot;.&lt;br /&gt;
=== -Xmn=,-Xms=,-Xmx= ===&lt;br /&gt;
These parameters are standard Java memory allocation parameters, and are used to define sufficient memory for large model-checking run. E.g.:&lt;br /&gt;
&lt;br /&gt;
 -Xmn200M&lt;br /&gt;
 -Xms700M&lt;br /&gt;
 -Xmx700M&lt;br /&gt;
&lt;br /&gt;
Explanation:&lt;br /&gt;
&lt;br /&gt;
* As Java starts, it creates within the systems memory a Java Virtual Machine (JVM). JVM is where the complete processing of any Java program takes place. All Java applications (including IQv6) by default allocate &amp;amp; reserve up to 64 MB of memory resource pool from the system on which it is running.&lt;br /&gt;
* The Xms is the initial / minimum Java memory (heap) size within the JVM. Setting the initial memory (heap) size higher can help in a couple of ways. First, it will allow garbage collection (GC) to work less which is more efficient. The higher initial memory value will cause the size of the memory (heap) not to have to grow as fast as a lower initial memory (heap) size, thereby saving the overhead of the Java VM asking the OS for more memory.&lt;br /&gt;
* The Xmx is the maximum Java memory (heap) size within the Java Virtual Memory (JVM). As the JVM gets closer to fully utilizing the initial memory, it checks the Xmx settings to find out if it can draw more memory from the system resources. If it can, it does so. For the JVM to allocate contiguous memory to itself is a very expensive operation. So as the JVM gets closer to the initial memory, the JVM will use aggressive garbage collection (to clean the memory and if possible avoid memory allocation), increasing the load on the system.&lt;br /&gt;
* If JVM is in need of memory beyond the value set in Xmx, the JVM will not be able to draw more memory from system resource (even if available) and run out of memory. Hence, the -Xms and -Xmx memory parameters should be increased depending upon the demand estimation of the system. Ideally both should be the same value (set at maximum possible as per demand estimation). This ensure that the maximum memory is allocated right at the start-up eliminating the need for extra memory allocation during program execution. It is sometimes recommended to use aggressive maximum memory (heap) size of between 1/2 and 3/4 of physical memory.&lt;br /&gt;
* -Xmn: the size of the heap for the young generation.&lt;br /&gt;
See more details in general Java reference information.&lt;br /&gt;
&lt;br /&gt;
= Application-specific parameters =&lt;br /&gt;
You can pass parameters to your own application, and process them in standard Java techniques. E.g.,&lt;br /&gt;
* - nPhils=5              number of philosophers.&lt;br /&gt;
* leftyPhil=false         is any of the philosophers left handed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
 static int nPhils; // number of philosophers&lt;br /&gt;
 static boolean leftyPhil = false; // Last Philosopher is left handed.&lt;br /&gt;
 static {&lt;br /&gt;
 nPhils = Integer.parseInt(System.getProperty(&amp;quot;nPhils&amp;quot;, &amp;quot;3&amp;quot;));&lt;br /&gt;
 parmString += &amp;quot;nPhils=&amp;quot; + nPhils;&lt;br /&gt;
 leftyPhil = (System.getProperty(&amp;quot;leftyPhil&amp;quot;,&amp;quot;false&amp;quot;).equals(&amp;quot;true&amp;quot;));&lt;br /&gt;
 parmString += &amp;quot;, leftyPhil=&amp;quot; + leftyPhil;&lt;br /&gt;
 System.out.println(parmString);&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Run Configuration Examples:&lt;br /&gt;
&lt;br /&gt;
   -DrunMode=MCSafety&lt;br /&gt;
   -Drecursive=true&lt;br /&gt;
   -Dshallow=true&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   -DrunMode=MCSafety&lt;br /&gt;
   -Dsearch=DFS&lt;br /&gt;
   -Xms300M&lt;br /&gt;
   -Xmx1000M&lt;br /&gt;
   -DestimatedStates=10000&lt;br /&gt;
   -DlogBacktracking=false&lt;br /&gt;
   -ea&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Model_Checking_API</id>
		<title>BPJ Model Checking API</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Model_Checking_API"/>
				<updated>2014-03-19T09:45:15Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* BPJ Model Checking API: Enabling your application for model-checking and controlling its verification */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Enabling your application for model-checking and controlling its verification =&lt;br /&gt;
&lt;br /&gt;
Before verifying an application, the application must be enabled for model checking.&lt;br /&gt;
This includes at least:&lt;br /&gt;
* Creating b-threads which simulate the environment, when applicable.&lt;br /&gt;
* Assigning names to states&lt;br /&gt;
* Determining alternative execution paths - by identifying equal priority b-threads and equal priority event requests.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
B-threads can call the following API methods of the BProgram where the b-thread is added/registered&lt;br /&gt;
to control the model checking.&lt;br /&gt;
&lt;br /&gt;
Throughout, the term Next Verification State refers to the applictation's (composite) state at next synchronization point, when all b-threads are synchronized.&lt;br /&gt;
&lt;br /&gt;
== bSync(none,none,none)==&lt;br /&gt;
While in regular runs a b-thread can terminate, in a model-checking run a b-thread should not terminate. You should precede or replace the return from runBthread method with a call to bSync(none,none,none). In a regular run this call will cause normal terminatation of the b-thread but in a model checking run it will suspend the b-thread in a state prior to terminating and allow backtracking from this state.&lt;br /&gt;
&lt;br /&gt;
== labelNextVerificationState(&amp;lt;label&amp;gt;)==&lt;br /&gt;
This API calls provides a label for the next b-thread state and indirectly to the next composite system state.&lt;br /&gt;
&lt;br /&gt;
* It is the programmer's responsibility to disambiguate all relevant b-thread states of each relevant b-thread.&lt;br /&gt;
* The (composite) BP-state name is the concatenation all constituent bt-states.&lt;br /&gt;
* When BPJ model checking reaches a BP-state that was already fully checked – it backtracks.&lt;br /&gt;
* If a b-thread does not label its states – it is considered to have one state – and it does not increase the size of the Cartesian product. E.g. a b-thread that only counts events theoretically has infinitely many states. However, if this b-thread is known to never request or block events, it cannot affect the application flow, and if the counts do not matter in the counterexamples, there is no need to keep track of its exact state during back tracking.&lt;br /&gt;
* A b-thread that incorrectly gives the same label to different states, may cause incorrect model-checking results.&lt;br /&gt;
* Meaningful state names can help in debugging, but since since most b-threads are simple this is not critical. E.g., the states of a &amp;quot;linear&amp;quot; b-thread can be just numbered as 1/2/3 etc. The states of a b-thread can be labeled also based on the values of the variables that determine the state change.&lt;br /&gt;
* State names are local to the b-thread and must be unique only within a b-thread. The BPJ model checking infrastructure properly distinguishes state 1 of b-thread BT1, from state 1 of b-thread BT2.&lt;br /&gt;
&lt;br /&gt;
== markNextVerificationStateAsBad()==&lt;br /&gt;
Indicates detection by the b-thread of a violation of a safety property. Model checking stops and prints the sequence of events (the path) to this point as a counter example.&lt;br /&gt;
== markNextVerificationStateAsHot()==&lt;br /&gt;
This call is used for checking of liveness properties. States that are not marked as hot are considered cold. If  the model checking detects a cycle in the state graph that does not contain a cold state, it stops and prints the path to this cycle and the cycle as a counter example.&lt;br /&gt;
== pruneSearchNow()==&lt;br /&gt;
This forces backtracking immediately, possibly stopping other b-threads and possibly before the badness of the next state is determined. This call can be used by a b-thread to accelerate the model checking by eliminating states that weren't explored, but are known to lead to results that are known or are symmetric to other states, or are otherwise not relevant in the present run.&lt;br /&gt;
== pruneAtNextVerificationState()==&lt;br /&gt;
This call forces backtracking after all b-threads reach the next state and after its badness is determined.&lt;br /&gt;
&lt;br /&gt;
== setBThreadEpsilon(&amp;lt;double epsilon&amp;gt;) ==&lt;br /&gt;
This call defines nondeterminism between b-threads. By default all b-threads are strictly ordered according to distinct priorities. If this call is used to set the &amp;quot;epsilon&amp;quot; to a value greater than zero, any two b-threads whose priorities differ by less than this value, are considered to be of the same priority, for the purpose of nondeterministic execution, backtracking and exploration of alternative execution paths.&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Model_Checking</id>
		<title>BPJ Model Checking</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Model_Checking"/>
				<updated>2014-03-19T09:43:13Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* Additional Information */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Verifying programs with BP model checking =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
* You can find bugs and under-specification in behavioral programs using model checking.&lt;br /&gt;
* The model checking capability of BP (abbr. BPmc) is part of the overall BPJ execution infrastructure. Thus, the program can be verified directly by executing it (with appropriate setup) subject to all relevant alternatives. There is no need to create a separate model or abstraction to be verified by an external tool.&lt;br /&gt;
* During model checking execution, the BP infrastructure executes all possible paths of a behavioral program looking for states with desired and undesired properties per your specification.&lt;br /&gt;
* The model checking capabilities support checking for safety  properties (including deadlocks) and for liveness  properties (with  fairness assumptions)&lt;br /&gt;
* An application must be first enabled for model checking.&lt;br /&gt;
&lt;br /&gt;
== Additional Information ==&lt;br /&gt;
* [[BPJ Model Checking API| BPJ Model Checking API: Enabling your application for model-checking and controlling its verification]]&lt;br /&gt;
* [[RunMode | Run modes and execution parameters for model-checking]]&lt;br /&gt;
* [[Nondetermism | Nondeterministic execution in behavioral programming]]&lt;br /&gt;
* [[JavaFlow | More information about enabling your application for model-checking]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BPmcAPI</id>
		<title>BPmcAPI</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BPmcAPI"/>
				<updated>2014-03-19T09:42:32Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: BPmcAPI moved to BPJ Model Checking API&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[BPJ Model Checking API]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Model_Checking_API</id>
		<title>BPJ Model Checking API</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Model_Checking_API"/>
				<updated>2014-03-19T09:42:32Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: BPmcAPI moved to BPJ Model Checking API&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= BPmc API: Enabling your application for model-checking and controlling its verification =&lt;br /&gt;
&lt;br /&gt;
Before verifying an application, the application must be enabled for model checking.&lt;br /&gt;
This includes at least:&lt;br /&gt;
* Creating b-threads which simulate the environment, when applicable.&lt;br /&gt;
* Assigning names to states&lt;br /&gt;
* Determining alternative execution paths - by identifying equal priority b-threads and equal priority event requests.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
B-threads can call the following API methods of the BProgram where the b-thread is added/registered&lt;br /&gt;
to control the model checking.&lt;br /&gt;
&lt;br /&gt;
Throughout, the term Next Verification State refers to the applictation's (composite) state at next synchronization point, when all b-threads are synchronized.&lt;br /&gt;
&lt;br /&gt;
== bSync(none,none,none)==&lt;br /&gt;
While in regular runs a b-thread can terminate, in a model-checking run a b-thread should not terminate. You should precede or replace the return from runBthread method with a call to bSync(none,none,none). In a regular run this call will cause normal terminatation of the b-thread but in a model checking run it will suspend the b-thread in a state prior to terminating and allow backtracking from this state.&lt;br /&gt;
&lt;br /&gt;
== labelNextVerificationState(&amp;lt;label&amp;gt;)==&lt;br /&gt;
This API calls provides a label for the next b-thread state and indirectly to the next composite system state.&lt;br /&gt;
&lt;br /&gt;
* It is the programmer's responsibility to disambiguate all relevant b-thread states of each relevant b-thread.&lt;br /&gt;
* The (composite) BP-state name is the concatenation all constituent bt-states.&lt;br /&gt;
* When BPmc reaches a BP-state that was already fully checked – it backtracks.&lt;br /&gt;
* If a b-thread does not label its states – it is considered to have one state – and it does not increase the size of the Cartesian product. E.g. a b-thread that only counts events theoretically has infinitely many states. However, if this b-thread is known to never request or block events, it cannot affect the application flow, and if the counts do not matter in the counterexamples, there is no need to keep track of its exact state during back tracking.&lt;br /&gt;
* A b-thread that incorrectly gives the same label to different states, may cause incorrect model-checking results.&lt;br /&gt;
* Meaningful state names can help in debugging, but since since most b-threads are simple this is not critical. E.g., the states of a &amp;quot;linear&amp;quot; b-thread can be just numbered as 1/2/3 etc. The states of a b-thread can be labeled also based on the values of the variables that determine the state change.&lt;br /&gt;
* State names are local to the b-thread and must be unique only within a b-thread. The BPmc infrastructure properly distinguishes state 1 of b-thread BT1, from state 1 of b-thread BT2.&lt;br /&gt;
&lt;br /&gt;
== markNextVerificationStateAsBad()==&lt;br /&gt;
Indicates detection by the b-thread of a violation of a safety property. BPmc stops and prints the sequence of events (the path) to this point as a counter example.&lt;br /&gt;
== markNextVerificationStateAsHot()==&lt;br /&gt;
This call is used for checking of liveness properties. States that are not marked as hot are considered cold. If BPmc detects a cycle in the state graph that does not contain a cold state, it stops and prints the path to this cycle and the cycle as a counter example.&lt;br /&gt;
== pruneSearchNow()==&lt;br /&gt;
This forces backtracking immediately, possibly stopping other b-threads and possibly before the badness of the next state is determined. This call can be used by a b-thread to accelerate the model checking by eliminating states that weren't explored, but are known to lead to results that are known or are symmetric to other states, or are otherwise not relevant in the present run.&lt;br /&gt;
== pruneAtNextVerificationState()==&lt;br /&gt;
This call forces backtracking after all b-threads reach the next state and after its badness is determined.&lt;br /&gt;
&lt;br /&gt;
== setBThreadEpsilon(&amp;lt;double epsilon&amp;gt;) ==&lt;br /&gt;
This call defines nondeterminism between b-threads. By default all b-threads are strictly ordered according to distinct priorities. If this call is used to set the &amp;quot;epsilon&amp;quot; to a value greater than zero, any two b-threads whose priorities differ by less than this value, are considered to be of the same priority, for the purpose of nondeterministic execution, backtracking and exploration of alternative execution paths.&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Nondetermism</id>
		<title>Nondetermism</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Nondetermism"/>
				<updated>2014-03-19T09:40:16Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* Nondeterministic execution in BPmc */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Nondeterministic execution in BPJ model checking =&lt;br /&gt;
In common processing event selection in BP is deterministic.&lt;br /&gt;
However, in some cases it is desired to specify nondetermistic choices - e.g., when simulating environment behavior using b-threads as part of model checking. The BPJ model checking capability explores all possible execution paths defined by this nondeterminism.&lt;br /&gt;
In fact, often, the only non-determinism in execution is in b-threads that simulate the environment.&lt;br /&gt;
&lt;br /&gt;
== Specifiying nondeterminism ==&lt;br /&gt;
* In BP, event selection is deteremined by the unique priority of each b-thread, and by the order of events in the requested event set.&lt;br /&gt;
* When the difference in priority of two b-threads is less than a given &amp;quot;epsilon&amp;quot; (a real number provided by the user), the two b-threads  are considered of same priority.  For example, to create 48 bthreads of the same priority, choose epsilon of 1.00 and  create the set of these b-threads so that their priorities have the same whole part and differ only by fractional part.  (e.g. priority values of 7.001 – 7.048). The value of &amp;quot;epsilon&amp;quot; is determined by the method call setBthreadEpsilon().&lt;br /&gt;
* Additionally, during model checking if an event in a requested event set of any b-thread is selected (requested and not blocked, and non-deterministic execution actually selected it), then if the event was in a nested second-level set, then all other events in the same nested second-level set are considered to be of the same priority. For example, if the requested even set is R={{e1,e2},e3,{e4,e5,e6,e7},e8} - then if e5 was selected (say, all preceding events were blocked), then e6 and e7, and only them are considered of the same priority and will be explored in non-deterministic execution. This priority processing is relevant only to the first event selection in b-thread. Once the selected second-level set is exhausted, (or if the event was a first level in the first place), non-deterministic execution continues with the next b-thread of the &amp;quot;same&amp;quot; priority as the previous b-thread.&lt;br /&gt;
See execution below for more details.&lt;br /&gt;
&lt;br /&gt;
== Nondeterministic execution ==&lt;br /&gt;
&lt;br /&gt;
When executing in model-checking mode, nondeterministic event selection is performed according to the following algorithm :&lt;br /&gt;
&lt;br /&gt;
* Scan b-threads in order of priority&lt;br /&gt;
* Scan the requested event set of each b-thread in event order (the set is enumerable).&lt;br /&gt;
* When the first event that is requested and not blocked is found  it is remembered as one alternative.&lt;br /&gt;
* If the selected event was in a  second level event set (a set within a set),  all its siblings in the same second level set that are not blocked are considered having the same priority, and are added as alternatives.&lt;br /&gt;
* If the event is in a first level of the requested event set, this event is the only one from this b-thread.&lt;br /&gt;
* After exploring all execution subtrees anchored at the alternatives from one b-thread go to the next b-thread of “same” priority as defined with epsilon, and repeat the above . At most one second-level set will be selected from the requested events of that b-thread, but not necessarily the first one.&lt;br /&gt;
* When all alternatives in a given execution path are explored the execution returns to the next higher level in the nondeterministic execution path to select the next alternative at that level.&lt;br /&gt;
* BPJ model checking uses the Java package javaflow to restore the stack of all b-threads in order to resume execution of another subtree at a previously visited synchronization point.&lt;br /&gt;
&lt;br /&gt;
== Programming Constraints ==&lt;br /&gt;
* While in regular runs a b-thread can terminate,  in a MC run A b-thread should not terminate, to allow BPJ model checking to backtrack. Precede/replace the return with bSync(none,none,none); In a regular run this will just terminate. In MC run it will allow the b-thread to backtrack from the end.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=User_Guide</id>
		<title>User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=User_Guide"/>
				<updated>2014-03-19T09:37:22Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''BPJ User Guide &amp;amp;nbsp;&amp;lt;br&amp;gt;''' Contents:&amp;amp;nbsp;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
*[[Download | Downloading, installing and configuring the BPJ library, related tools and examples]]&lt;br /&gt;
*[http://www.wisdom.weizmann.ac.il/~bprogram/pres/BPJ%20Introduction.pdf A slide presentation: general introduction to behavioral programming]&lt;br /&gt;
*[[The_BPJ_Library | The BPJ library: about b-threads, events, b-programs, etc.]]&lt;br /&gt;
*Designing, developing and running your application (TBA. Meanwhile use general introduction prersentation and examples).&lt;br /&gt;
*[[Dynamic b-threads | Symbolic and dynamic and b-threads]]&lt;br /&gt;
*[[ TraceVis | Tracing and visualizing behavioral Java programs with TraceVis]]&lt;br /&gt;
*[[BPJ Model Checking | Verifying your application with the BPJ model checking ]]&lt;br /&gt;
*Using BPJ for hybrid fuzzy control with BFUZ (To be added).&lt;br /&gt;
*[[Z3BP | Working with Z3 Theorem Prover / SMT Solver ]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Model_Checking</id>
		<title>BPJ Model Checking</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Model_Checking"/>
				<updated>2014-03-19T09:34:55Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Verifying programs with BP model checking =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
* You can find bugs and under-specification in behavioral programs using model checking.&lt;br /&gt;
* The model checking capability of BP (abbr. BPmc) is part of the overall BPJ execution infrastructure. Thus, the program can be verified directly by executing it (with appropriate setup) subject to all relevant alternatives. There is no need to create a separate model or abstraction to be verified by an external tool.&lt;br /&gt;
* During model checking execution, the BP infrastructure executes all possible paths of a behavioral program looking for states with desired and undesired properties per your specification.&lt;br /&gt;
* The model checking capabilities support checking for safety  properties (including deadlocks) and for liveness  properties (with  fairness assumptions)&lt;br /&gt;
* An application must be first enabled for model checking.&lt;br /&gt;
&lt;br /&gt;
== Additional Information ==&lt;br /&gt;
* [[BPmcAPI | BPmc API: Enabling your application for model-checking and controlling its verification]]&lt;br /&gt;
* [[RunMode | Run modes and execution parameters for model-checking]]&lt;br /&gt;
* [[Nondetermism | Nondeterministic execution in behavioral programming]]&lt;br /&gt;
* [[JavaFlow | More information about enabling your application for model-checking]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=User_Guide</id>
		<title>User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=User_Guide"/>
				<updated>2014-03-19T09:34:19Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''BPJ User Guide &amp;amp;nbsp;&amp;lt;br&amp;gt;''' Contents:&amp;amp;nbsp;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
*[[Download | Downloading, installing and configuring the BPJ library, related tools and examples]]&lt;br /&gt;
*[http://www.wisdom.weizmann.ac.il/~bprogram/pres/BPJ%20Introduction.pdf A slide presentation: general introduction to behavioral programming]&lt;br /&gt;
*[[The_BPJ_Library | The BPJ library: about b-threads, events, b-programs, etc.]]&lt;br /&gt;
*Designing, developing and running your application (TBA. Meanwhile use general introduction prersentation and examples).&lt;br /&gt;
*[[Dynamic b-threads | Symbolic and dynamic and b-threads]]&lt;br /&gt;
*[[ TraceVis | Tracing and visualizing behavioral Java programs with TraceVis]]&lt;br /&gt;
*[[BPMC | Verifying your application with the BPJ model checking ]]&lt;br /&gt;
*Using BPJ for hybrid fuzzy control with BFUZ (To be added).&lt;br /&gt;
*[[Z3BP | Working with Z3 Theorem Prover / SMT Solver ]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Model_Checking</id>
		<title>BPJ Model Checking</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Model_Checking"/>
				<updated>2014-03-19T09:33:30Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: BPMC moved to BPJ Model Checking&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Verifying programs with BP model checking =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
* You can find bugs and under-specification in behavioral programs using model checking.&lt;br /&gt;
* The model checking capability of BP (abbr. BPmc) is part of the overall BP execution infrastructure. Thus, the program can be verified directly by executing it (with appropriate setup) subject to all relevant alternatives. There is no need to create a separate model or abstraction to be verified by an external tool.&lt;br /&gt;
* During model checking execution, the BP infrastructure executes all possible paths of a behavioral program looking for states with desired and undesired properties per your specification.&lt;br /&gt;
* The model checking capabilities support checking for safety  properties (including deadlocks) and for liveness  properties (with  fairness assumptions)&lt;br /&gt;
* An application must be first enabled for model checking.&lt;br /&gt;
&lt;br /&gt;
== Additional Information ==&lt;br /&gt;
* [[BPmcAPI | BPmc API: Enabling your application for model-checking and controlling its verification]]&lt;br /&gt;
* [[RunMode | Run modes and execution parameters for model-checking]]&lt;br /&gt;
* [[Nondetermism | Nondeterministic execution in behavioral programming]]&lt;br /&gt;
* [[JavaFlow | More information about enabling your application for model-checking]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BPMC</id>
		<title>BPMC</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BPMC"/>
				<updated>2014-03-19T09:33:30Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: BPMC moved to BPJ Model Checking&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;#REDIRECT [[BPJ Model Checking]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Model_Checking</id>
		<title>BPJ Model Checking</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Model_Checking"/>
				<updated>2014-02-12T09:23:10Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Verifying programs with BP model checking =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
* You can find bugs and under-specification in behavioral programs using model checking.&lt;br /&gt;
* The model checking capability of BP (abbr. BPmc) is part of the overall BP execution infrastructure. Thus, the program can be verified directly by executing it (with appropriate setup) subject to all relevant alternatives. There is no need to create a separate model or abstraction to be verified by an external tool.&lt;br /&gt;
* During model checking execution, the BP infrastructure executes all possible paths of a behavioral program looking for states with desired and undesired properties per your specification.&lt;br /&gt;
* The model checking capabilities support checking for safety  properties (including deadlocks) and for liveness  properties (with  fairness assumptions)&lt;br /&gt;
* An application must be first enabled for model checking.&lt;br /&gt;
&lt;br /&gt;
== Additional Information ==&lt;br /&gt;
* [[BPmcAPI | BPmc API: Enabling your application for model-checking and controlling its verification]]&lt;br /&gt;
* [[RunMode | Run modes and execution parameters for model-checking]]&lt;br /&gt;
* [[Nondetermism | Nondeterministic execution in behavioral programming]]&lt;br /&gt;
* [[JavaFlow | More information about enabling your application for model-checking]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Model_Checking</id>
		<title>BPJ Model Checking</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Model_Checking"/>
				<updated>2014-02-12T09:22:47Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* Introduction */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Verifying programs with BP model checking =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
* You can find bugs and under-specification in behavioral programs using model checking.&lt;br /&gt;
* The model checking capability of BP (abbr. BPmc) is part of the overall BP execution infrastructure. Thus, the program can be verified directly by executing it (with appropriate setup) subject to all relevant alternatives. There is no need to create a separate model or abstraction to be verified by an external tool.&lt;br /&gt;
* During model checking execution, the BP infrastructure executes all possible paths of a behavioral program looking for states with desired and undesired properties per your specification.&lt;br /&gt;
* The model checking capabilities support checking for safety  properties (including deadlocks) and for liveness  properties (with  fairness assumptions)&lt;br /&gt;
* [[BPmcAPI#pruneSearchNow.28.29 | An application must be first enabled for model checking]].&lt;br /&gt;
&lt;br /&gt;
== Additional Information ==&lt;br /&gt;
* [[BPmcAPI | BPmc API: Enabling your application for model-checking and controlling its verification]]&lt;br /&gt;
* [[RunMode | Run modes and execution parameters for model-checking]]&lt;br /&gt;
* [[Nondetermism | Nondeterministic execution in behavioral programming]]&lt;br /&gt;
* [[JavaFlow | More information about enabling your application for model-checking]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Model_Checking</id>
		<title>BPJ Model Checking</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=BPJ_Model_Checking"/>
				<updated>2014-02-12T09:20:27Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Verifying programs with BP model checking =&lt;br /&gt;
&lt;br /&gt;
== Introduction ==&lt;br /&gt;
* You can find bugs and under-specification in behavioral programs using model checking.&lt;br /&gt;
* The model checking capability of BP (abbr. BPmc) is part of the overall BP execution infrastructure. Thus, the program can be verified directly by executing it (with appropriate setup) subject to all relevant alternatives. There is no need to create a separate model or abstraction to be verified by an external tool.&lt;br /&gt;
* During model checking execution, the BP infrastructure executes all possible paths of a behavioral program looking for states with desired and undesired properties per your specification.&lt;br /&gt;
* The model checking capabilities support checking for safety  properties (including deadlocks) and for liveness  properties (with  fairness assumptions)&lt;br /&gt;
* An application must be first enabled for model checking.&lt;br /&gt;
&lt;br /&gt;
== Additional Information ==&lt;br /&gt;
* [[BPmcAPI | BPmc API: Enabling your application for model-checking and controlling its verification]]&lt;br /&gt;
* [[RunMode | Run modes and execution parameters for model-checking]]&lt;br /&gt;
* [[Nondetermism | Nondeterministic execution in behavioral programming]]&lt;br /&gt;
* [[JavaFlow | More information about enabling your application for model-checking]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=The_BPJ_Library</id>
		<title>The BPJ Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=The_BPJ_Library"/>
				<updated>2013-08-05T10:48:23Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See examples, e.g., BPJ/BPJCore110 -&amp;amp;gt; bp.src.unittest.helloworld BPJ/Examples -&amp;amp;gt; &amp;lt;span style=&amp;quot;font-family: 'Courier New';&amp;quot;&amp;gt;TicTacToe&lt;br /&gt;
&amp;lt;/span&amp;gt;Events B-threads B-Program(s) A main method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Events  ==&lt;br /&gt;
&lt;br /&gt;
*Reflect the elements of behavior of your application (and its environment) – what you want to see in a trace.&lt;br /&gt;
*Instantiate or extend Event class&lt;br /&gt;
*Optional string name in constructor or in setName();&lt;br /&gt;
*Optional data fields&lt;br /&gt;
*See later on Event Sets&lt;br /&gt;
&lt;br /&gt;
== B-Threads  ==&lt;br /&gt;
&lt;br /&gt;
*Contain the logic of your application&lt;br /&gt;
*Instantiate or extend the BThread class.&lt;br /&gt;
*You code runBThread() method&lt;br /&gt;
*Use events to affect system behavior&lt;br /&gt;
*Call bSync() method to request, wait for or block events&lt;br /&gt;
*You code import static bp.BProgram.bp&lt;br /&gt;
*Use Java freely – but don’t wait for slow things (GUI interaction should be done separately).&lt;br /&gt;
*Avoid or minimize side effects and external dependencies that are not event-driven&lt;br /&gt;
*Events should be natural system behavior - minimize usage of events for pure inter-b-thread communication.&lt;br /&gt;
*You may instantiate multiple instances of same b-thread class – possibly with constructor parameters&lt;br /&gt;
*Parameters may be manually specified during instantiation or generated by the application - see Tic-Tac-Toe example.&lt;br /&gt;
&lt;br /&gt;
== The B-Program  ==&lt;br /&gt;
&lt;br /&gt;
*The execution environment and event-selection mechanism and for the application b-threads.&lt;br /&gt;
*An object of the class BProgram&lt;br /&gt;
*One instance of BProgram, called bp, is instantiated and made public and static for ready use by the application programmer.&lt;br /&gt;
*BProgram externalizes the public variable lastEvent that can be seen by b-threads.&lt;br /&gt;
*Usually – there is just one BProgram per application, running all your b-threads, but you may have several b-programs in parallel.&lt;br /&gt;
*You may change run-time parameters of the b-program by calling methods to set them.&lt;br /&gt;
&lt;br /&gt;
== The B-Application  ==&lt;br /&gt;
&lt;br /&gt;
*A container and entry point for the application program. &lt;br /&gt;
*Class BApplication &lt;br /&gt;
*The programmer provides an instance of this class by implementing the main method and runBApplication method. &lt;br /&gt;
*The method main() should starts the b-application providing the class name of the application program and the package where it can be found. Be sure to specify these correctly as problems in loading the main class may not be reported correctly.&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
&lt;br /&gt;
 static public void main(String arg[]) {&lt;br /&gt;
 try {&lt;br /&gt;
 BProgram.startBApplication(AlternatingTaps.class, &amp;quot;bp.unittest&amp;quot;);&lt;br /&gt;
 } catch (Exception e) {&lt;br /&gt;
 e.printStackTrace();&lt;br /&gt;
 }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
*In the method runBApplication the programmer starts the b-threads.&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
&lt;br /&gt;
&amp;amp;nbsp;public void runBApplication() { System.out.println(&amp;quot;runBApplication () at &amp;quot; + this); bp.add(new AddHotThreeTimes(), 1.0); bp.add(new AddColdThreeTimes(), 3.0); bp.add(new Interleave(), 4.0); &lt;br /&gt;
&lt;br /&gt;
bp.startAll(); }&lt;br /&gt;
&lt;br /&gt;
== The bSync() Method  ==&lt;br /&gt;
&lt;br /&gt;
*bSync(RequestableEventInterface,EventSetInterface,EventSetInterface)&lt;br /&gt;
*Three parameters:&lt;br /&gt;
**Requested Events:&lt;br /&gt;
**Waited-for events (a.k.a “watched events”)&lt;br /&gt;
**Blocked events&lt;br /&gt;
*Drives the collective execution mechanism:&lt;br /&gt;
**Synchronizes the b-thread with the others – waits until all b-threads call bSync().&lt;br /&gt;
**When all b-threads are waiting in bSync – the first event that is requested and is not blocked is selected. The search order is by b-thread priority, and within it – order of events in requestable event set.&lt;br /&gt;
**All b-threads that have the selected event in their requested events set or in their waited-for event set are resumed.&lt;br /&gt;
**B-threads can examine the event triggered by the last bSync in bp.lastEvent. Don’t modify this field; don’t rely on it past another bSync() call.&lt;br /&gt;
**This synchronization assumes that all b-threads will be good citizens and will not wait long (e.g., will not be involved in GUI input)&lt;br /&gt;
&lt;br /&gt;
== Event Sets and Interfaces  ==&lt;br /&gt;
&lt;br /&gt;
*The parameters to bSync are three sets of events, or sets of sets.&lt;br /&gt;
*Nesting of set containment is allowed, and not limited.&lt;br /&gt;
*RequestableEventInterface:&lt;br /&gt;
**Required for requested event parameter of bSync();&lt;br /&gt;
**Can be used also for waited-for and blocked.&lt;br /&gt;
**Must contain an ordered set of concrete events, or ordered sets of requestableEventInterface (nesting of sets).&lt;br /&gt;
**Implemented by RequestedEventsSet&lt;br /&gt;
*EventSetInterface:&lt;br /&gt;
**Can be used for waited-for and blocked events.&lt;br /&gt;
**The method contains() determines membership in the EventSetInterface object.&lt;br /&gt;
**This set can describe very large or infinite sets of events, or be used to filter events.&lt;br /&gt;
**The set can contain another EventSetInterface (neesting of sets).&lt;br /&gt;
**Cannot be used as the requested events parameter of bSync(), because it does not provide an interator over the concrete events.&lt;br /&gt;
**Implemented by EventSet&lt;br /&gt;
*RequestableEventSet: Implements both interfaces above&lt;br /&gt;
*EventSet: implements only EventSetInterface&lt;br /&gt;
*Event: The Event class implements the above interfaces. An individual event can be used instead of any of these sets. An event is also a set that contains the event.&lt;br /&gt;
&lt;br /&gt;
== Special Event Sets  ==&lt;br /&gt;
&lt;br /&gt;
*None: the empty set - contains no event. Used in calls to bSync() when one of the three parameters should be empty.&lt;br /&gt;
*All: contains all events. Most commonly used in bSync() when a b-thread such as a logger waits for all events.&lt;br /&gt;
*EventsOfClass: all events of a given class.&lt;br /&gt;
*Composable event sets&lt;br /&gt;
**Available in BPJContrib (***ToDo: add BPJContrib to the package)&lt;br /&gt;
**Allows specification of, e.g., theEventSet(A).and( not( theEventSet(B).or(C) ).xor( theEventSet(A).nand(c) ) )&lt;br /&gt;
&lt;br /&gt;
anyOf( A, B, theEventSet(C).and(not(d)) )&lt;br /&gt;
&lt;br /&gt;
== The Application and the Main Method  ==&lt;br /&gt;
&lt;br /&gt;
*In the main method insert the line BProgram.startBApplication(my-app-class, my-package);&lt;br /&gt;
*You need to provide the method runBApplicatio. In it:&lt;br /&gt;
** Instantiate and add b-threads to the b-program&lt;br /&gt;
** Start the b-threads&lt;br /&gt;
** You must assign unique real number priority to each b-thread. The smaller the value, the higher the priority.&lt;br /&gt;
** Start any other parts (non-BP) of your application.&lt;br /&gt;
** runBApplication may exit, or may wait for all b-threads to end.&lt;br /&gt;
*Example (see BPJ package for more detail):&lt;br /&gt;
&lt;br /&gt;
 import static bp.BProgram.bp;&lt;br /&gt;
 public class my-app-class implements BApplication {&lt;br /&gt;
    public void runBApplication() {&lt;br /&gt;
      bp.add(new my-Bthread-1(), mypriority1);&lt;br /&gt;
      bp.add(new my-Bthread-2(), mypriority2);&lt;br /&gt;
      . . .&lt;br /&gt;
      bp.startAll();&lt;br /&gt;
     }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
== Dynamic B-Threads  ==&lt;br /&gt;
&lt;br /&gt;
* New b-threads may be added by external (non behavioral) applications modules, or by b-threads&lt;br /&gt;
*A running Java thread may be registered as a b-thread and subsequently deregistered as follows:...&lt;br /&gt;
&lt;br /&gt;
See examples in...&lt;br /&gt;
&lt;br /&gt;
== Injecting External Events  ==&lt;br /&gt;
&lt;br /&gt;
ToDo: add text here&lt;br /&gt;
&lt;br /&gt;
[[Download | Prev]]  [[BPMC|Model Checking with BPmc]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=The_BPJ_Library</id>
		<title>The BPJ Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=The_BPJ_Library"/>
				<updated>2013-08-05T10:45:38Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: /* The B-Application */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See examples, e.g., BPJ/BPJCore110 -&amp;amp;gt; bp.src.unittest.helloworld BPJ/Examples -&amp;amp;gt; &amp;lt;span style=&amp;quot;font-family: 'Courier New';&amp;quot;&amp;gt;TicTacToe&lt;br /&gt;
&amp;lt;/span&amp;gt;Events B-threads B-Program(s) A main method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Events  ==&lt;br /&gt;
&lt;br /&gt;
*Reflect the elements of behavior of your application (and its environment) – what you want to see in a trace.&lt;br /&gt;
*Instantiate or extend Event class&lt;br /&gt;
*Optional string name in constructor or in setName();&lt;br /&gt;
*Optional data fields&lt;br /&gt;
*See later on Event Sets&lt;br /&gt;
&lt;br /&gt;
== B-Threads  ==&lt;br /&gt;
&lt;br /&gt;
*Contain the logic of your application&lt;br /&gt;
*Instantiate or extend the BThread class.&lt;br /&gt;
*You code runBThread() method&lt;br /&gt;
*Use events to affect system behavior&lt;br /&gt;
*Call bSync() method to request, wait for or block events&lt;br /&gt;
*You code import static bp.BProgram.bp&lt;br /&gt;
*Use Java freely – but don’t wait for slow things (GUI interaction should be done separately).&lt;br /&gt;
*Avoid or minimize side effects and external dependencies that are not event-driven&lt;br /&gt;
*Events should be natural system behavior - minimize usage of events for pure inter-b-thread communication.&lt;br /&gt;
*You may instantiate multiple instances of same b-thread class – possibly with constructor parameters&lt;br /&gt;
*Parameters may be manually specified during instantiation or generated by the application - see Tic-Tac-Toe example.&lt;br /&gt;
&lt;br /&gt;
== The B-Program  ==&lt;br /&gt;
&lt;br /&gt;
*The execution environment and event-selection mechanism and for the application b-threads.&lt;br /&gt;
*An object of the class BProgram&lt;br /&gt;
*One instance of BProgram, called bp, is instantiated and made public and static for ready use by the application programmer.&lt;br /&gt;
*BProgram externalizes the public variable lastEvent that can be seen by b-threads.&lt;br /&gt;
*Usually – there is just one BProgram per application, running all your b-threads, but you may have several b-programs in parallel.&lt;br /&gt;
*You may change run-time parameters of the b-program by calling methods to set them.&lt;br /&gt;
&lt;br /&gt;
== The B-Application  ==&lt;br /&gt;
&lt;br /&gt;
*A container and entry point for the application program. &lt;br /&gt;
*Class BApplication &lt;br /&gt;
*The programmer provides an instance of this class by implementing the main method and runBApplication method. &lt;br /&gt;
*The method main() should starts the b-application providing the class name of the application program and the package where it can be found. Be sure to specify these correctly as problems in loading the main class may not be reported correctly.&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
&lt;br /&gt;
 static public void main(String arg[]) {&lt;br /&gt;
 try {&lt;br /&gt;
  BProgram.startBApplication(AlternatingTaps.class, &amp;quot;bp.unittest&amp;quot;);&lt;br /&gt;
 } catch (Exception e) {&lt;br /&gt;
  e.printStackTrace();&lt;br /&gt;
  }&lt;br /&gt;
 }&lt;br /&gt;
&lt;br /&gt;
*In the method runBApplication the programmer starts the b-threads.&lt;br /&gt;
&lt;br /&gt;
Example: &lt;br /&gt;
&lt;br /&gt;
public void runBApplication() { System.out.println(&amp;quot;runBApplication () at &amp;quot; + this); bp.add(new AddHotThreeTimes(), 1.0); bp.add(new AddColdThreeTimes(), 3.0); bp.add(new Interleave(), 4.0); &lt;br /&gt;
&lt;br /&gt;
bp.startAll(); }&lt;br /&gt;
&lt;br /&gt;
== The bSync() Method  ==&lt;br /&gt;
&lt;br /&gt;
*bSync(RequestableEventInterface,EventSetInterface,EventSetInterface)&lt;br /&gt;
*Three parameters:&lt;br /&gt;
**Requested Events:&lt;br /&gt;
**Waited-for events (a.k.a “watched events”)&lt;br /&gt;
**Blocked events&lt;br /&gt;
*Drives the collective execution mechanism:&lt;br /&gt;
**Synchronizes the b-thread with the others – waits until all b-threads call bSync().&lt;br /&gt;
**When all b-threads are waiting in bSync – the first event that is requested and is not blocked is selected. The search order is by b-thread priority, and within it – order of events in requestable event set.&lt;br /&gt;
**All b-threads that have the selected event in their requested events set or in their waited-for event set are resumed.&lt;br /&gt;
**B-threads can examine the event triggered by the last bSync in bp.lastEvent. Don’t modify this field; don’t rely on it past another bSync() call.&lt;br /&gt;
**This synchronization assumes that all b-threads will be good citizens and will not wait long (e.g., will not be involved in GUI input)&lt;br /&gt;
&lt;br /&gt;
== Event Sets and Interfaces  ==&lt;br /&gt;
&lt;br /&gt;
*The parameters to bSync are three sets of events, or sets of sets.&lt;br /&gt;
*Nesting of set containment is allowed, and not limited.&lt;br /&gt;
*RequestableEventInterface:&lt;br /&gt;
**Required for requested event parameter of bSync();&lt;br /&gt;
**Can be used also for waited-for and blocked.&lt;br /&gt;
**Must contain an ordered set of concrete events, or ordered sets of requestableEventInterface (nesting of sets).&lt;br /&gt;
**Implemented by RequestedEventsSet&lt;br /&gt;
*EventSetInterface:&lt;br /&gt;
**Can be used for waited-for and blocked events.&lt;br /&gt;
**The method contains() determines membership in the EventSetInterface object.&lt;br /&gt;
**This set can describe very large or infinite sets of events, or be used to filter events.&lt;br /&gt;
**The set can contain another EventSetInterface (neesting of sets).&lt;br /&gt;
**Cannot be used as the requested events parameter of bSync(), because it does not provide an interator over the concrete events.&lt;br /&gt;
**Implemented by EventSet&lt;br /&gt;
*RequestableEventSet: Implements both interfaces above&lt;br /&gt;
*EventSet: implements only EventSetInterface&lt;br /&gt;
*Event: The Event class implements the above interfaces. An individual event can be used instead of any of these sets. An event is also a set that contains the event.&lt;br /&gt;
&lt;br /&gt;
== Special Event Sets  ==&lt;br /&gt;
&lt;br /&gt;
*None: the empty set - contains no event. Used in calls to bSync() when one of the three parameters should be empty.&lt;br /&gt;
*All: contains all events. Most commonly used in bSync() when a b-thread such as a logger waits for all events.&lt;br /&gt;
*EventsOfClass: all events of a given class.&lt;br /&gt;
*Composable event sets&lt;br /&gt;
**Available in BPJContrib (***ToDo: add BPJContrib to the package)&lt;br /&gt;
**Allows specification of, e.g., theEventSet(A).and( not( theEventSet(B).or(C) ).xor( theEventSet(A).nand(c) ) )&lt;br /&gt;
&lt;br /&gt;
anyOf( A, B, theEventSet(C).and(not(d)) )&lt;br /&gt;
&lt;br /&gt;
== The Application and the Main Method  ==&lt;br /&gt;
&lt;br /&gt;
*In the main method insert the line BProgram.startBApplication(my-app-class, my-package);&lt;br /&gt;
*You need to provide the method runBApplicatio. In it:&lt;br /&gt;
** Instantiate and add b-threads to the b-program&lt;br /&gt;
** Start the b-threads&lt;br /&gt;
** You must assign unique real number priority to each b-thread. The smaller the value, the higher the priority.&lt;br /&gt;
** Start any other parts (non-BP) of your application.&lt;br /&gt;
** runBApplication may exit, or may wait for all b-threads to end.&lt;br /&gt;
*Example (see BPJ package for more detail):&lt;br /&gt;
&lt;br /&gt;
 import static bp.BProgram.bp;&lt;br /&gt;
 public class my-app-class implements BApplication {&lt;br /&gt;
    public void runBApplication() {&lt;br /&gt;
      bp.add(new my-Bthread-1(), mypriority1);&lt;br /&gt;
      bp.add(new my-Bthread-2(), mypriority2);&lt;br /&gt;
      . . .&lt;br /&gt;
      bp.startAll();&lt;br /&gt;
     }&lt;br /&gt;
    }&lt;br /&gt;
&lt;br /&gt;
== Dynamic B-Threads  ==&lt;br /&gt;
&lt;br /&gt;
* New b-threads may be added by external (non behavioral) applications modules, or by b-threads&lt;br /&gt;
*A running Java thread may be registered as a b-thread and subsequently deregistered as follows:...&lt;br /&gt;
&lt;br /&gt;
See examples in...&lt;br /&gt;
&lt;br /&gt;
== Injecting External Events  ==&lt;br /&gt;
&lt;br /&gt;
ToDo: add text here&lt;br /&gt;
&lt;br /&gt;
[[Download | Prev]]  [[BPMC|Model Checking with BPmc]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=User_Guide</id>
		<title>User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=User_Guide"/>
				<updated>2013-08-05T10:44:05Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''BPJ User Guide &amp;amp;nbsp;&amp;lt;br&amp;gt;''' Contents:&amp;amp;nbsp;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
*[[Download | Download, install and configure the BPJ library and examples]]&lt;br /&gt;
*[http://www.wisdom.weizmann.ac.il/~bprogram/pres/BPJ%20Introduction.pdf A general introduction to behavioral programming presentation]&lt;br /&gt;
*[[The_BPJ_Library | The BPJ library: b-threads, events, b-programs, etc.]]&lt;br /&gt;
*Designing and developing your application&lt;br /&gt;
*Running your application&lt;br /&gt;
*[[Dynamic b-threads | Dynamic b-threads]]&lt;br /&gt;
*[[ TraceVis | Tracing and visualizing behavioral Java programs with TraceVis]]&lt;br /&gt;
*[[BPMC | Verifying your application with BPmc]]&lt;br /&gt;
*Using BPJ for hybrid fuzzy control with BFUZ&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Main Page|Prev]]&amp;lt;span style=&amp;quot;line-height: 1.5em;&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;[[UserGuidePage1|Next]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=User_Guide</id>
		<title>User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=User_Guide"/>
				<updated>2013-08-04T08:01:16Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''BPJ User Guide &amp;amp;nbsp;&amp;lt;br&amp;gt;''' Contents:&amp;amp;nbsp;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
*[[Download | Downloading, Installation and configuration ]]&lt;br /&gt;
*[[The_BPJ_Library | The BPJ library]]&lt;br /&gt;
*Designing and developing your application&lt;br /&gt;
*Running your application&lt;br /&gt;
*Debugging with TraceVis&lt;br /&gt;
*Verifying your application with BPmc&lt;br /&gt;
*Using BPJ for hybrid fuzzy control with BFUZ&lt;br /&gt;
*See introduction to behavioral programming in the BP Overview presentation&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Main Page|Prev]]&amp;lt;span style=&amp;quot;line-height: 1.5em;&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;[[UserGuidePage1|Next]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=User_Guide</id>
		<title>User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=User_Guide"/>
				<updated>2013-08-04T08:00:18Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''BPJ User Guide &amp;amp;nbsp;&amp;lt;br&amp;gt;''' Contents:&amp;amp;nbsp;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
*[[Download | Downloading, Installation and configuration ]]&lt;br /&gt;
*[[The BPJ library]]&lt;br /&gt;
*Designing and developing your application&lt;br /&gt;
*Running your application&lt;br /&gt;
*Debugging with TraceVis&lt;br /&gt;
*Verifying your application with BPmc&lt;br /&gt;
*Using BPJ for hybrid fuzzy control with BFUZ&lt;br /&gt;
*See introduction to behavioral programming in the BP Overview presentation&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Main Page|Prev]]&amp;lt;span style=&amp;quot;line-height: 1.5em;&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;[[UserGuidePage1|Next]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Download</id>
		<title>Download</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Download"/>
				<updated>2013-06-26T12:04:20Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: Protected &amp;quot;Download&amp;quot; [edit=autoconfirmed:move=autoconfirmed:read=autoconfirmed]&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Download and Installation =&lt;br /&gt;
&lt;br /&gt;
*Operating System:&lt;br /&gt;
** So far BPJ was tested mainly on Windows. It should run on Linux as well.&lt;br /&gt;
*IDE Requirements:&lt;br /&gt;
** BPJ does not depend on any specific environment. The library and examples can be used with the latest version of Eclipse, or in any other Java programming environment.&lt;br /&gt;
* Downloading Eclipse:&lt;br /&gt;
** Download Eclipse classic for Java from http://www.eclipse.org/.&lt;br /&gt;
** Extract the downloaded files – no installation is needed.&lt;br /&gt;
*Downloading and Configuring BPJ:&lt;br /&gt;
** Download [http://www.wisdom.weizmann.ac.il/~bprogram/code/BPJZip.zip  BPJzip.zip]&lt;br /&gt;
** In Eclipse, import the project BPJCore110 as follows:&lt;br /&gt;
*** File -&amp;gt; Import -&amp;gt; General -&amp;gt; Existing Project into Work Space -&amp;gt; BPJCore110&lt;br /&gt;
** Rebuild the project.&lt;br /&gt;
** Import run configurations (optional -- Required mainly for running model-checking examples):&lt;br /&gt;
*** File -&amp;gt; Import -&amp;gt; Run/Debug. Then select all available configurations&lt;br /&gt;
&lt;br /&gt;
[[User Guide| Prev]] | [[The BPJ Library | Next ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[http://www.b-prog.org BP Web Site]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=The_BPJ_Library</id>
		<title>The BPJ Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=The_BPJ_Library"/>
				<updated>2013-06-26T12:01:12Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: Protected &amp;quot;The BPJ Library&amp;quot; [edit=autoconfirmed:move=autoconfirmed:read=autoconfirmed]&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See examples, e.g., BPJ/BPJCore110 -&amp;amp;gt; bp.src.unittest.helloworld BPJ/Examples -&amp;amp;gt; &amp;lt;span style=&amp;quot;font-family: 'Courier New';&amp;quot;&amp;gt;TicTacToe&lt;br /&gt;
&amp;lt;/span&amp;gt;Events B-threads B-Program(s) A main method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Events  ==&lt;br /&gt;
&lt;br /&gt;
*Reflect the elements of behavior of your application (and its environment) – what you want to see in a trace.&lt;br /&gt;
*Instantiate or extend Event class&lt;br /&gt;
*Optional string name in constructor or in setName();&lt;br /&gt;
*Optional data fields&lt;br /&gt;
*See later on Event Sets&lt;br /&gt;
&lt;br /&gt;
== B-Threads  ==&lt;br /&gt;
&lt;br /&gt;
*Contain the logic of your application&lt;br /&gt;
*You code runBThread() method&lt;br /&gt;
*Use events to affect system behavior&lt;br /&gt;
*Call bSync() method to request, wait for or block events&lt;br /&gt;
*You code import static bp.BProgram.bp&lt;br /&gt;
*Use Java freely – but don’t wait for slow things (GUI interaction should be done separately).&lt;br /&gt;
*Avoid or minimize side effects and external dependencies that are not event-driven&lt;br /&gt;
*Events should be natural system behavior - minimize usage of events for pure inter-b-thread communication.&lt;br /&gt;
*You may instantiate multiple instances of same b-thread class – possibly with constructor parameters&lt;br /&gt;
*Parameters may be manually specified during instantiation or generated by the application - see Tic-Tac-Toe example.&lt;br /&gt;
&lt;br /&gt;
== The B-Program  ==&lt;br /&gt;
&lt;br /&gt;
*A container and execution environment for b-threads.&lt;br /&gt;
*You only need to instantiate it.&lt;br /&gt;
*BProgram externalizes the public variable lastEvent that can be seen by b-threads.&lt;br /&gt;
*Usually – there is just one BProgram per application, running all your b-threads, but you may have several b-programs in parallel.&lt;br /&gt;
*You may change run-time parameters of the b-program by calling methods to set them.&lt;br /&gt;
&lt;br /&gt;
== The bSync() Method  ==&lt;br /&gt;
&lt;br /&gt;
*bSync(RequestableEventInterface,EventSetInterface,EventSetInterface)&lt;br /&gt;
*Three parameters:&lt;br /&gt;
**Requested Events:&lt;br /&gt;
**Waited-for events (a.k.a “watched events”)&lt;br /&gt;
**Blocked events&lt;br /&gt;
*Drives the collective execution mechanism:&lt;br /&gt;
**Synchronizes the b-thread with the others – waits until all b-threads call bSync().&lt;br /&gt;
**When all b-threads are waiting in bSync – the first event that is requested and is not blocked is selected. The search order is by b-thread priority, and within it – order of events in requestable event set.&lt;br /&gt;
**All b-threads that have the selected event in their requested events set or in their waited-for event set are resumed.&lt;br /&gt;
**B-threads can examine the event triggered by the last bSync in bp.lastEvent. Don’t modify this field; don’t rely on it past another bSync() call.&lt;br /&gt;
**This synchronization assumes that all b-threads will be good citizens and will not wait long (e.g., will not be involved in GUI input)&lt;br /&gt;
&lt;br /&gt;
== Event Sets and Interfaces  ==&lt;br /&gt;
&lt;br /&gt;
*The parameters to bSync are three sets of events, or sets of sets.&lt;br /&gt;
*Nesting of set containment is allowed, and not limited.&lt;br /&gt;
*RequestableEventInterface:&lt;br /&gt;
**Required for requested event parameter of bSync();&lt;br /&gt;
**Can be used also for watched and blocked.&lt;br /&gt;
**Must contain an ordered set of concrete events, or ordered sets of requestableEventInterface (nesting of sets).&lt;br /&gt;
**Implemented by RequestedEventsSet&lt;br /&gt;
*EventSetInterface:&lt;br /&gt;
**Can be used for watched and blocked events.&lt;br /&gt;
**Contains() method determines membership&lt;br /&gt;
**Can contain very large or infinite sets of events, or be used to filter events.&lt;br /&gt;
**Can contain eventSetInterface&lt;br /&gt;
**Is not sufficient as the requested events parameter of bSync()&lt;br /&gt;
**Implemented by EventSet&lt;br /&gt;
*RequestableEventSet: Implements both interfaces above&lt;br /&gt;
*EventSet: implements only EventSetInterface&lt;br /&gt;
*Event: The Event class implements the above interfaces. An individual event can be used instead of any of these sets. An event is also a set that contains the event.&lt;br /&gt;
&lt;br /&gt;
== Special Event Sets  ==&lt;br /&gt;
&lt;br /&gt;
*None: the empty set&lt;br /&gt;
*All: contains all events&lt;br /&gt;
*EventsOfClass: all events of a given class&lt;br /&gt;
*Composable event sets&lt;br /&gt;
**Available in BPJContrib (***?? What to do???)&lt;br /&gt;
**Allows specification of, e.g., theEventSet(A).and( not( theEventSet(B).or(C) ).xor( theEventSet(A).nand(c) ) )&lt;br /&gt;
&lt;br /&gt;
anyOf( A, B, theEventSet(C).and(not(d)) )&lt;br /&gt;
&lt;br /&gt;
== The Application and the Main Method  ==&lt;br /&gt;
&lt;br /&gt;
*In the main method insert the line BProgram.startBApplication(my-app-class, my-package);&lt;br /&gt;
*In the method runBApplication you start the execution of your application&lt;br /&gt;
*Instantiate and add b-threads to the b-program&lt;br /&gt;
*Start the b-threads&lt;br /&gt;
*You must assign unique real number priority to each b-thread. The smaller the value, the higher the priority.&lt;br /&gt;
*runBApplication may exit, or may wait for all b-threads to end.&lt;br /&gt;
*Example (see BPJ package for more detail):&lt;br /&gt;
&lt;br /&gt;
import static bp.BProgram.bp; public class my-app-class implements BApplication { public void runBApplication() bp.add(new my-Bthread-1(), mypriority1); bp.add(new my-Bthread-2(), mypriority2); … bp.startAll();&lt;br /&gt;
&lt;br /&gt;
== Dynamic B-Threads  ==&lt;br /&gt;
&lt;br /&gt;
*New b-threads may be added by external (non behavioral) applications modules, or by b-threads&lt;br /&gt;
*A running Java thread may be registered as a b-thread and subsequently deregistered as follows:...&lt;br /&gt;
&lt;br /&gt;
See examples in...&lt;br /&gt;
&lt;br /&gt;
== Injecting External Events  ==&lt;br /&gt;
&lt;br /&gt;
add text&lt;br /&gt;
&lt;br /&gt;
[[Download | Prev] | [[BPMC|Model Checking with BPmc]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=The_BPJ_Library</id>
		<title>The BPJ Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=The_BPJ_Library"/>
				<updated>2013-06-26T12:00:05Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See examples, e.g., BPJ/BPJCore110 -&amp;amp;gt; bp.src.unittest.helloworld BPJ/Examples -&amp;amp;gt; &amp;lt;span style=&amp;quot;font-family: 'Courier New';&amp;quot;&amp;gt;TicTacToe&lt;br /&gt;
&amp;lt;/span&amp;gt;Events B-threads B-Program(s) A main method:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Events  ==&lt;br /&gt;
&lt;br /&gt;
*Reflect the elements of behavior of your application (and its environment) – what you want to see in a trace.&lt;br /&gt;
*Instantiate or extend Event class&lt;br /&gt;
*Optional string name in constructor or in setName();&lt;br /&gt;
*Optional data fields&lt;br /&gt;
*See later on Event Sets&lt;br /&gt;
&lt;br /&gt;
== B-Threads  ==&lt;br /&gt;
&lt;br /&gt;
*Contain the logic of your application&lt;br /&gt;
*You code runBThread() method&lt;br /&gt;
*Use events to affect system behavior&lt;br /&gt;
*Call bSync() method to request, wait for or block events&lt;br /&gt;
*You code import static bp.BProgram.bp&lt;br /&gt;
*Use Java freely – but don’t wait for slow things (GUI interaction should be done separately).&lt;br /&gt;
*Avoid or minimize side effects and external dependencies that are not event-driven&lt;br /&gt;
*Events should be natural system behavior - minimize usage of events for pure inter-b-thread communication.&lt;br /&gt;
*You may instantiate multiple instances of same b-thread class – possibly with constructor parameters&lt;br /&gt;
*Parameters may be manually specified during instantiation or generated by the application - see Tic-Tac-Toe example.&lt;br /&gt;
&lt;br /&gt;
== The B-Program  ==&lt;br /&gt;
&lt;br /&gt;
*A container and execution environment for b-threads.&lt;br /&gt;
*You only need to instantiate it.&lt;br /&gt;
*BProgram externalizes the public variable lastEvent that can be seen by b-threads.&lt;br /&gt;
*Usually – there is just one BProgram per application, running all your b-threads, but you may have several b-programs in parallel.&lt;br /&gt;
*You may change run-time parameters of the b-program by calling methods to set them.&lt;br /&gt;
&lt;br /&gt;
== The bSync() Method  ==&lt;br /&gt;
&lt;br /&gt;
*bSync(RequestableEventInterface,EventSetInterface,EventSetInterface)&lt;br /&gt;
*Three parameters:&lt;br /&gt;
**Requested Events:&lt;br /&gt;
**Waited-for events (a.k.a “watched events”)&lt;br /&gt;
**Blocked events&lt;br /&gt;
*Drives the collective execution mechanism:&lt;br /&gt;
**Synchronizes the b-thread with the others – waits until all b-threads call bSync().&lt;br /&gt;
**When all b-threads are waiting in bSync – the first event that is requested and is not blocked is selected. The search order is by b-thread priority, and within it – order of events in requestable event set.&lt;br /&gt;
**All b-threads that have the selected event in their requested events set or in their waited-for event set are resumed.&lt;br /&gt;
**B-threads can examine the event triggered by the last bSync in bp.lastEvent. Don’t modify this field; don’t rely on it past another bSync() call.&lt;br /&gt;
**This synchronization assumes that all b-threads will be good citizens and will not wait long (e.g., will not be involved in GUI input)&lt;br /&gt;
&lt;br /&gt;
== Event Sets and Interfaces  ==&lt;br /&gt;
&lt;br /&gt;
*The parameters to bSync are three sets of events, or sets of sets.&lt;br /&gt;
*Nesting of set containment is allowed, and not limited.&lt;br /&gt;
*RequestableEventInterface:&lt;br /&gt;
**Required for requested event parameter of bSync();&lt;br /&gt;
**Can be used also for watched and blocked.&lt;br /&gt;
**Must contain an ordered set of concrete events, or ordered sets of requestableEventInterface (nesting of sets).&lt;br /&gt;
**Implemented by RequestedEventsSet&lt;br /&gt;
*EventSetInterface:&lt;br /&gt;
**Can be used for watched and blocked events.&lt;br /&gt;
**Contains() method determines membership&lt;br /&gt;
**Can contain very large or infinite sets of events, or be used to filter events.&lt;br /&gt;
**Can contain eventSetInterface&lt;br /&gt;
**Is not sufficient as the requested events parameter of bSync()&lt;br /&gt;
**Implemented by EventSet&lt;br /&gt;
*RequestableEventSet: Implements both interfaces above&lt;br /&gt;
*EventSet: implements only EventSetInterface&lt;br /&gt;
*Event: The Event class implements the above interfaces. An individual event can be used instead of any of these sets. An event is also a set that contains the event.&lt;br /&gt;
&lt;br /&gt;
== Special Event Sets  ==&lt;br /&gt;
&lt;br /&gt;
*None: the empty set&lt;br /&gt;
*All: contains all events&lt;br /&gt;
*EventsOfClass: all events of a given class&lt;br /&gt;
*Composable event sets&lt;br /&gt;
**Available in BPJContrib (***?? What to do???)&lt;br /&gt;
**Allows specification of, e.g., theEventSet(A).and( not( theEventSet(B).or(C) ).xor( theEventSet(A).nand(c) ) )&lt;br /&gt;
&lt;br /&gt;
anyOf( A, B, theEventSet(C).and(not(d)) )&lt;br /&gt;
&lt;br /&gt;
== The Application and the Main Method  ==&lt;br /&gt;
&lt;br /&gt;
*In the main method insert the line BProgram.startBApplication(my-app-class, my-package);&lt;br /&gt;
*In the method runBApplication you start the execution of your application&lt;br /&gt;
*Instantiate and add b-threads to the b-program&lt;br /&gt;
*Start the b-threads&lt;br /&gt;
*You must assign unique real number priority to each b-thread. The smaller the value, the higher the priority.&lt;br /&gt;
*runBApplication may exit, or may wait for all b-threads to end.&lt;br /&gt;
*Example (see BPJ package for more detail):&lt;br /&gt;
&lt;br /&gt;
import static bp.BProgram.bp; public class my-app-class implements BApplication { public void runBApplication() bp.add(new my-Bthread-1(), mypriority1); bp.add(new my-Bthread-2(), mypriority2); … bp.startAll();&lt;br /&gt;
&lt;br /&gt;
== Dynamic B-Threads  ==&lt;br /&gt;
&lt;br /&gt;
*New b-threads may be added by external (non behavioral) applications modules, or by b-threads&lt;br /&gt;
*A running Java thread may be registered as a b-thread and subsequently deregistered as follows:...&lt;br /&gt;
&lt;br /&gt;
See examples in...&lt;br /&gt;
&lt;br /&gt;
== Injecting External Events  ==&lt;br /&gt;
&lt;br /&gt;
add text&lt;br /&gt;
&lt;br /&gt;
[[Download | Prev] | [[BPMC|Model Checking with BPmc]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=The_BPJ_Library</id>
		<title>The BPJ Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=The_BPJ_Library"/>
				<updated>2013-06-26T11:57:39Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See examples, e.g.,&lt;br /&gt;
BPJ/BPJCore110 -&amp;gt;  bp.src.unittest.helloworld&lt;br /&gt;
BPJ/Examples -&amp;gt;  TicTacToe&lt;br /&gt;
Events&lt;br /&gt;
B-threads&lt;br /&gt;
B-Program(s)&lt;br /&gt;
A main method:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
*Reflect the elements of behavior of your application (and its environment) – what you want to see in a trace.&lt;br /&gt;
*Instantiate or extend Event class&lt;br /&gt;
*Optional string name in constructor or in setName();&lt;br /&gt;
*Optional data fields&lt;br /&gt;
*See later on Event Sets&lt;br /&gt;
&lt;br /&gt;
== B-Threads ==&lt;br /&gt;
*Contain the logic of your application&lt;br /&gt;
*You code runBThread() method&lt;br /&gt;
*Use events to affect system behavior&lt;br /&gt;
*Call bSync() method  to request, wait for or block events&lt;br /&gt;
*You code import static bp.BProgram.bp&lt;br /&gt;
*Use Java freely – but don’t wait for slow things (GUI interaction should be done separately).&lt;br /&gt;
*Avoid or minimize side effects and external dependencies  that are not event-driven&lt;br /&gt;
*Events should be natural system behavior - minimize usage of events for pure inter-b-thread communication.&lt;br /&gt;
*You may instantiate  multiple instances of same b-thread class – possibly with constructor parameters&lt;br /&gt;
*Parameters may be manually specified during instantiation or  generated by the application -  see Tic-Tac-Toe example.&lt;br /&gt;
&lt;br /&gt;
== The B-Program ==&lt;br /&gt;
*A container and execution environment for b-threads.&lt;br /&gt;
*You only need  to instantiate it.&lt;br /&gt;
*BProgram externalizes the public variable lastEvent that can be seen by b-threads.&lt;br /&gt;
*Usually – there is just one BProgram per application, running all your b-threads, but you may have several b-programs in parallel.&lt;br /&gt;
*You may change run-time parameters of the b-program by calling methods to set them.&lt;br /&gt;
&lt;br /&gt;
== The bSync() Method ==&lt;br /&gt;
&lt;br /&gt;
*bSync(RequestableEventInterface,EventSetInterface,EventSetInterface)&lt;br /&gt;
*Three parameters:&lt;br /&gt;
**Requested Events:&lt;br /&gt;
**Waited-for events (a.k.a “watched events”)&lt;br /&gt;
**Blocked events&lt;br /&gt;
*Drives the collective execution mechanism:&lt;br /&gt;
**Synchronizes the b-thread with the others – waits until all b-threads call bSync().&lt;br /&gt;
**When all b-threads are waiting in bSync – the first event that is requested and is not blocked is selected. The search order is by b-thread priority, and within it – order of events in requestable event set.&lt;br /&gt;
**All b-threads that have the selected event in their requested events set or in their waited-for event set are resumed.&lt;br /&gt;
**B-threads can  examine the event triggered by the last bSync in bp.lastEvent.  Don’t modify this field; don’t rely on it past another bSync() call.&lt;br /&gt;
**This synchronization assumes that all b-threads will be good citizens and will not wait long (e.g., will not be involved in GUI input)&lt;br /&gt;
&lt;br /&gt;
== Event Sets and Interfaces ==&lt;br /&gt;
&lt;br /&gt;
*The parameters to bSync are three sets of events, or sets of sets.&lt;br /&gt;
*Nesting of set containment is allowed, and not limited.&lt;br /&gt;
*RequestableEventInterface:&lt;br /&gt;
**Required for requested event parameter of bSync();&lt;br /&gt;
**Can be used also for watched and blocked.&lt;br /&gt;
**Must contain an ordered set of concrete events, or ordered sets of requestableEventInterface (nesting of sets).&lt;br /&gt;
**Implemented by RequestedEventsSet&lt;br /&gt;
*EventSetInterface:&lt;br /&gt;
**Can be used for watched and blocked events.&lt;br /&gt;
**Contains() method determines membership&lt;br /&gt;
**Can contain very large or infinite sets of events, or be used to filter events.&lt;br /&gt;
**Can contain eventSetInterface&lt;br /&gt;
**Is not sufficient as the requested events parameter of bSync()&lt;br /&gt;
**Implemented by EventSet&lt;br /&gt;
*RequestableEventSet: Implements both interfaces above&lt;br /&gt;
*EventSet: implements only EventSetInterface&lt;br /&gt;
*Event:  The Event class implements the above interfaces. An individual event can be used instead of any of these sets. An event is also a set that contains the event.&lt;br /&gt;
&lt;br /&gt;
== Special Event Sets ==&lt;br /&gt;
&lt;br /&gt;
*None:  the empty set&lt;br /&gt;
*All: contains all events&lt;br /&gt;
*EventsOfClass: all events of a given class&lt;br /&gt;
*Composable event sets&lt;br /&gt;
**Available in BPJContrib (***?? What to do???)&lt;br /&gt;
**Allows specification of, e.g., theEventSet(A).and( not( theEventSet(B).or(C) ).xor( theEventSet(A).nand(c) ) )&lt;br /&gt;
anyOf( A, B, theEventSet(C).and(not(d)) )&lt;br /&gt;
&lt;br /&gt;
==The Application and the Main Method ==&lt;br /&gt;
&lt;br /&gt;
*In the main method insert the line BProgram.startBApplication(my-app-class, my-package);&lt;br /&gt;
*In the  method runBApplication you start the execution of your application&lt;br /&gt;
*Instantiate and add b-threads to the b-program&lt;br /&gt;
*Start the b-threads&lt;br /&gt;
*You must assign unique real number priority to each b-thread. The smaller the value, the higher the priority.&lt;br /&gt;
*runBApplication may exit, or may wait for all b-threads to end.&lt;br /&gt;
*Example (see BPJ package for more detail):&lt;br /&gt;
import static bp.BProgram.bp;&lt;br /&gt;
public class my-app-class implements BApplication {   public void runBApplication()   bp.add(new my-Bthread-1(), mypriority1);   bp.add(new my-Bthread-2(), mypriority2);   …    bp.startAll();&lt;br /&gt;
&lt;br /&gt;
== Dynamic B-Threads ==&lt;br /&gt;
*New b-threads may be added by external (non behavioral) applications modules, or by b-threads&lt;br /&gt;
*A running Java thread may be registered as a b-thread and subsequently deregistered as follows:...&lt;br /&gt;
See examples in...&lt;br /&gt;
&lt;br /&gt;
== Injecting External Events ==&lt;br /&gt;
&lt;br /&gt;
add text&lt;br /&gt;
&lt;br /&gt;
[[Download | Prev] | [[BPMC | Model Checking with BPmc]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=The_BPJ_Library</id>
		<title>The BPJ Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=The_BPJ_Library"/>
				<updated>2013-06-26T11:56:32Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See examples, e.g.,&lt;br /&gt;
BPJ/BPJCore110 -&amp;gt;  bp.src.unittest.helloworld&lt;br /&gt;
BPJ/Examples -&amp;gt;  TicTacToe&lt;br /&gt;
Events&lt;br /&gt;
B-threads&lt;br /&gt;
B-Program(s)&lt;br /&gt;
A main method:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
Reflect the elements of behavior of your application (and its environment) – what you want to see in a trace.&lt;br /&gt;
Instantiate or extend Event class&lt;br /&gt;
Optional string name in constructor or in setName();&lt;br /&gt;
Optional data fields&lt;br /&gt;
See later on Event Sets&lt;br /&gt;
&lt;br /&gt;
== B-Threads ==&lt;br /&gt;
Contain the logic of your application&lt;br /&gt;
You code runBThread() method&lt;br /&gt;
Use events to affect system behavior&lt;br /&gt;
Call bSync() method  to request, wait for or block events&lt;br /&gt;
You code import static bp.BProgram.bp&lt;br /&gt;
Use Java freely – but don’t wait for slow things (GUI interaction should be done separately).&lt;br /&gt;
Avoid or minimize side effects and external dependencies  that are not event-driven&lt;br /&gt;
Events should be natural system behavior - minimize usage of events for pure inter-b-thread communication.&lt;br /&gt;
You may instantiate  multiple instances of same b-thread class – possibly with constructor parameters&lt;br /&gt;
Parameters may be manually specified during instantiation or  generated by the application -  see Tic-Tac-Toe example.&lt;br /&gt;
&lt;br /&gt;
== The B-Program ==&lt;br /&gt;
*A container and execution environment for b-threads.&lt;br /&gt;
*You only need  to instantiate it.&lt;br /&gt;
*BProgram externalizes the public variable lastEvent that can be seen by b-threads.&lt;br /&gt;
*Usually – there is just one BProgram per application, running all your b-threads, but you may have several b-programs in parallel.&lt;br /&gt;
*You may change run-time parameters of the b-program by calling methods to set them.&lt;br /&gt;
&lt;br /&gt;
== The bSync() Method ==&lt;br /&gt;
&lt;br /&gt;
*bSync(RequestableEventInterface,EventSetInterface,EventSetInterface)&lt;br /&gt;
*Three parameters:&lt;br /&gt;
**Requested Events:&lt;br /&gt;
**Waited-for events (a.k.a “watched events”)&lt;br /&gt;
**Blocked events&lt;br /&gt;
*Drives the collective execution mechanism:&lt;br /&gt;
**Synchronizes the b-thread with the others – waits until all b-threads call bSync().&lt;br /&gt;
**When all b-threads are waiting in bSync – the first event that is requested and is not blocked is selected. The search order is by b-thread priority, and within it – order of events in requestable event set.&lt;br /&gt;
**All b-threads that have the selected event in their requested events set or in their waited-for event set are resumed.&lt;br /&gt;
**B-threads can  examine the event triggered by the last bSync in bp.lastEvent.  Don’t modify this field; don’t rely on it past another bSync() call.&lt;br /&gt;
**This synchronization assumes that all b-threads will be good citizens and will not wait long (e.g., will not be involved in GUI input)&lt;br /&gt;
&lt;br /&gt;
== Event Sets and Interfaces ==&lt;br /&gt;
&lt;br /&gt;
*The parameters to bSync are three sets of events, or sets of sets.&lt;br /&gt;
*Nesting of set containment is allowed, and not limited.&lt;br /&gt;
*RequestableEventInterface:&lt;br /&gt;
**Required for requested event parameter of bSync();&lt;br /&gt;
**Can be used also for watched and blocked.&lt;br /&gt;
**Must contain an ordered set of concrete events, or ordered sets of requestableEventInterface (nesting of sets).&lt;br /&gt;
**Implemented by RequestedEventsSet&lt;br /&gt;
*EventSetInterface:&lt;br /&gt;
**Can be used for watched and blocked events.&lt;br /&gt;
**Contains() method determines membership&lt;br /&gt;
**Can contain very large or infinite sets of events, or be used to filter events.&lt;br /&gt;
**Can contain eventSetInterface&lt;br /&gt;
**Is not sufficient as the requested events parameter of bSync()&lt;br /&gt;
**Implemented by EventSet&lt;br /&gt;
*RequestableEventSet: Implements both interfaces above&lt;br /&gt;
*EventSet: implements only EventSetInterface&lt;br /&gt;
*Event:  The Event class implements the above interfaces. An individual event can be used instead of any of these sets. An event is also a set that contains the event.&lt;br /&gt;
&lt;br /&gt;
== Special Event Sets ==&lt;br /&gt;
&lt;br /&gt;
*None:  the empty set&lt;br /&gt;
*All: contains all events&lt;br /&gt;
*EventsOfClass: all events of a given class&lt;br /&gt;
*Composable event sets&lt;br /&gt;
**Available in BPJContrib (***?? What to do???)&lt;br /&gt;
**Allows specification of, e.g., theEventSet(A).and( not( theEventSet(B).or(C) ).xor( theEventSet(A).nand(c) ) )&lt;br /&gt;
anyOf( A, B, theEventSet(C).and(not(d)) )&lt;br /&gt;
&lt;br /&gt;
==The Application and the Main Method ==&lt;br /&gt;
&lt;br /&gt;
*In the main method insert the line BProgram.startBApplication(my-app-class, my-package);&lt;br /&gt;
*In the  method runBApplication you start the execution of your application&lt;br /&gt;
*Instantiate and add b-threads to the b-program&lt;br /&gt;
*Start the b-threads&lt;br /&gt;
*You must assign unique real number priority to each b-thread. The smaller the value, the higher the priority.&lt;br /&gt;
*runBApplication may exit, or may wait for all b-threads to end.&lt;br /&gt;
*Example (see BPJ package for more detail):&lt;br /&gt;
import static bp.BProgram.bp;&lt;br /&gt;
public class my-app-class implements BApplication {   public void runBApplication()   bp.add(new my-Bthread-1(), mypriority1);   bp.add(new my-Bthread-2(), mypriority2);   …    bp.startAll();&lt;br /&gt;
&lt;br /&gt;
== Dynamic B-Threads ==&lt;br /&gt;
*New b-threads may be added by external (non behavioral) applications modules, or by b-threads&lt;br /&gt;
*A running Java thread may be registered as a b-thread and subsequently deregistered as follows:...&lt;br /&gt;
See examples in...&lt;br /&gt;
&lt;br /&gt;
== Injecting External Events ==&lt;br /&gt;
&lt;br /&gt;
add text&lt;br /&gt;
&lt;br /&gt;
[[Download | Prev] | [[BPMC | Model Checking with BPmc]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=The_BPJ_Library</id>
		<title>The BPJ Library</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=The_BPJ_Library"/>
				<updated>2013-06-26T11:46:10Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: New page: See examples, e.g., BPJ/BPJCore110 -&amp;gt;  bp.src.unittest.helloworld BPJ/Examples -&amp;gt;  TicTacToe Events B-threads B-Program(s) A main method:   == Events == Reflect the elements of behavior of...&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;See examples, e.g.,&lt;br /&gt;
BPJ/BPJCore110 -&amp;gt;  bp.src.unittest.helloworld&lt;br /&gt;
BPJ/Examples -&amp;gt;  TicTacToe&lt;br /&gt;
Events&lt;br /&gt;
B-threads&lt;br /&gt;
B-Program(s)&lt;br /&gt;
A main method:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Events ==&lt;br /&gt;
Reflect the elements of behavior of your application (and its environment) – what you want to see in a trace.&lt;br /&gt;
Instantiate or extend Event class&lt;br /&gt;
Optional string name in constructor or in setName();&lt;br /&gt;
Optional data fields&lt;br /&gt;
See later on Event Sets&lt;br /&gt;
&lt;br /&gt;
== B-Threads ==&lt;br /&gt;
Contain the logic of your application&lt;br /&gt;
You code runBThread() method&lt;br /&gt;
Use events to affect system behavior&lt;br /&gt;
Call bSync() method  to request, wait for or block events&lt;br /&gt;
You code import static bp.BProgram.bp&lt;br /&gt;
Use Java freely – but don’t wait for slow things (GUI interaction should be done separately).&lt;br /&gt;
Avoid or minimize side effects and external dependencies  that are not event-driven&lt;br /&gt;
Events should be natural system behavior - minimize usage of events for pure inter-b-thread communication.&lt;br /&gt;
You may instantiate  multiple instances of same b-thread class – possibly with constructor parameters&lt;br /&gt;
Parameters may be manually specified during instantiation or  generated by the application -  see Tic-Tac-Toe example.&lt;br /&gt;
&lt;br /&gt;
== The B-Program ==&lt;br /&gt;
A container and execution environment for b-threads.&lt;br /&gt;
You only need  to instantiate it.&lt;br /&gt;
BProgram externalizes the public variable lastEvent that can be seen by b-threads.&lt;br /&gt;
Usually – there is just one BProgram per application, running all your b-threads, but you may have several BPrograms in parallel.&lt;br /&gt;
You may change run-time parameters by calling methods to set them.&lt;br /&gt;
&lt;br /&gt;
== The bSync() Method&lt;br /&gt;
&lt;br /&gt;
bSync(RequestableEventInterface,EventSetInterface,EventSetInterface)&lt;br /&gt;
Three parameters:&lt;br /&gt;
Requested Events:&lt;br /&gt;
Waited-for events (a.k.a “watched events”)&lt;br /&gt;
Blocked events&lt;br /&gt;
Drives the collective execution mechanism:&lt;br /&gt;
Synchronizes the b-thread with the others – waits until all b-threads call bSync().&lt;br /&gt;
When all b-threads are waiting in bSync – the first event that is requested and is not blocked is selected. The search order is by b-thread priority, and within it – order of events in requestable event set&lt;br /&gt;
All b-threads that have the selected event in their requested events set or in their waited-for event set are resumed.&lt;br /&gt;
B-threads can  examine the event triggered by the last bSync in bp.lastEvent.  Don’t modify it this field; don’t rely on it past another bSync() call.&lt;br /&gt;
This synchronization assumes that all b-threads will be good citizens and will not wait long (e.g., will not be involved in GUI input)&lt;br /&gt;
&lt;br /&gt;
== Event Sets and Interfaces&lt;br /&gt;
&lt;br /&gt;
The parameters to bSync are three sets of events, or sets of sets with unlimited nesting of set containment is allowed&lt;br /&gt;
RequestableEventInterface&lt;br /&gt;
Required for requested event parameter of bsynC();&lt;br /&gt;
Can be used also for watched and blocked.&lt;br /&gt;
 Must contain an ordered set of concrete events, or ordered sets of requestableEventInterface (nesting of sets).&lt;br /&gt;
Implemented by RequestedEventsSet&lt;br /&gt;
EventSetInterface&lt;br /&gt;
Can be used for watched and blocked events.&lt;br /&gt;
Contains() method determines membership&lt;br /&gt;
Can contain very large or infinite sets of events, or be used to filter events.&lt;br /&gt;
Can contain eventSetInterface&lt;br /&gt;
Is not sufficient as the requested events parameter o bSync()&lt;br /&gt;
Implemented by EventSet&lt;br /&gt;
RequestableEventSet: Implements both interfaces above&lt;br /&gt;
EventSet: implements only EventSetInterfacs&lt;br /&gt;
Event:  The Event class implements the above interfaces. An individual event can be used instead of any of these sets. An event is also a set that contains the event.&lt;br /&gt;
&lt;br /&gt;
== Special Event Sets&lt;br /&gt;
&lt;br /&gt;
None:  the empty set&lt;br /&gt;
All: contains all events&lt;br /&gt;
EventsOfClass: all events of a given class&lt;br /&gt;
Composable event sets&lt;br /&gt;
Available in BPJContrib (***?? What to do???)&lt;br /&gt;
Allows specification of, e.g.,&lt;br /&gt;
theEventSet(A).and( not( theEventSet(B).or(C) ).xor( theEventSet(A).nand(c) ) )&lt;br /&gt;
anyOf( A, B, theEventSet(C).and(not(d)) )&lt;br /&gt;
&lt;br /&gt;
==The Application and the Main Method ==&lt;br /&gt;
&lt;br /&gt;
In the main method insert the line ��BProgram.startBApplication(my-app-class, my-package);&lt;br /&gt;
&lt;br /&gt;
In the  method runBApplication you start the execution of your application&lt;br /&gt;
Instantiate and add b-threads to the b-program&lt;br /&gt;
Start the b-threads&lt;br /&gt;
You must assign unique real number priority to each b-thread. The smaller the value, the higher the priority.&lt;br /&gt;
runBApplication may exit, or may wait for all b-threads to end.&lt;br /&gt;
Example (see BPJ package for more detail): ��import static bp.BProgram.bp; �public class my-app-class implements BApplication {�   public void runBApplication()�   bp.add(new my-Bthread-1(), mypriority1);�   bp.add(new my-Bthread-2(), mypriority2);�   … �   bp.startAll(); ��&lt;br /&gt;
&lt;br /&gt;
== Dynamic B-Threads ==&lt;br /&gt;
New b-threads may be added by external (non behavioral) applications modules, or by b-threads&lt;br /&gt;
A running Java thread may be registered as a b-thread and subsequently deregistered&lt;br /&gt;
See examples in...&lt;br /&gt;
&lt;br /&gt;
== Injecting External Events ==&lt;br /&gt;
&lt;br /&gt;
add text&lt;br /&gt;
&lt;br /&gt;
[[Download | Prev] | [[BPMC | Model Checking with BPmc]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Download</id>
		<title>Download</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Download"/>
				<updated>2013-06-26T11:40:03Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Download and Installation =&lt;br /&gt;
&lt;br /&gt;
*Operating System:&lt;br /&gt;
** So far BPJ was tested mainly on Windows. It should run on Linux as well.&lt;br /&gt;
*IDE Requirements:&lt;br /&gt;
** BPJ does not depend on any specific environment. The library and examples can be used with the latest version of Eclipse, or in any other Java programming environment.&lt;br /&gt;
* Downloading Eclipse:&lt;br /&gt;
** Download Eclipse classic for Java from http://www.eclipse.org/.&lt;br /&gt;
** Extract the downloaded files – no installation is needed.&lt;br /&gt;
*Downloading and Configuring BPJ:&lt;br /&gt;
** Download [http://www.wisdom.weizmann.ac.il/~bprogram/code/BPJZip.zip  BPJzip.zip]&lt;br /&gt;
** In Eclipse, import the project BPJCore110 as follows:&lt;br /&gt;
*** File -&amp;gt; Import -&amp;gt; General -&amp;gt; Existing Project into Work Space -&amp;gt; BPJCore110&lt;br /&gt;
** Rebuild the project.&lt;br /&gt;
** Import run configurations (optional -- Required mainly for running model-checking examples):&lt;br /&gt;
*** File -&amp;gt; Import -&amp;gt; Run/Debug. Then select all available configurations&lt;br /&gt;
&lt;br /&gt;
[[User Guide| Prev]] | [[The BPJ Library | Next ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[http://www.b-prog.org BP Web Site]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Download</id>
		<title>Download</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Download"/>
				<updated>2013-06-26T11:30:22Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Download and Installation =&lt;br /&gt;
&lt;br /&gt;
*Operating System:&lt;br /&gt;
** So far BPJ was tested mainly on Windows. It should run on Linux as well.&lt;br /&gt;
*IDE Requirements:&lt;br /&gt;
** BPJ does not depend on any specific environment. The library and examples can be used with the latest version of Eclipse, or in any other Java programming environment.&lt;br /&gt;
* Downloading Eclipse:&lt;br /&gt;
** Download Eclipse classic for Java from http://www.eclipse.org/.&lt;br /&gt;
** Extract the downloaded files – no installation is needed.&lt;br /&gt;
*Downloading and Configuring BPJ:&lt;br /&gt;
** Download [http://www.wisdom.weizmann.ac.il/~bprogram/code/BPJZip.zip  BPJzip.zip]&lt;br /&gt;
** In Eclipse, import the project BPJCore110 as follows:&lt;br /&gt;
*** File -&amp;gt; Import -&amp;gt; General -&amp;gt; Existing Project into Work Space -&amp;gt; BPJCore110&lt;br /&gt;
** Rebuild the project.&lt;br /&gt;
** Import run configurations (optional -- Required mainly for running model-checking examples):&lt;br /&gt;
*** File -&amp;gt; Import -&amp;gt; Run/Debug. Then select all available configurations&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[http://www.b-prog.org BP Web Site]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Download</id>
		<title>Download</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Download"/>
				<updated>2013-06-26T11:29:57Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Download and Installation =&lt;br /&gt;
&lt;br /&gt;
*Operating System:&lt;br /&gt;
** So far BPJ was tested only on Windows. But it should run on Linux as well.&lt;br /&gt;
*IDE Requirements:&lt;br /&gt;
** BPJ does not depend on any specific environment. The library and examples can be used with the latest version of Eclipse, or in any other Java programming environment.&lt;br /&gt;
* Downloading Eclipse:&lt;br /&gt;
** Download Eclipse classic for Java from http://www.eclipse.org/.&lt;br /&gt;
** Extract the downloaded files – no installation is needed.&lt;br /&gt;
*Downloading and Configuring BPJ:&lt;br /&gt;
** Download [http://www.wisdom.weizmann.ac.il/~bprogram/code/BPJZip.zip  BPJzip.zip]&lt;br /&gt;
** In Eclipse, import the project BPJCore110 as follows:&lt;br /&gt;
*** File -&amp;gt; Import -&amp;gt; General -&amp;gt; Existing Project into Work Space -&amp;gt; BPJCore110&lt;br /&gt;
** Rebuild the project.&lt;br /&gt;
** Import run configurations (optional -- Required mainly for running model-checking examples):&lt;br /&gt;
*** File -&amp;gt; Import -&amp;gt; Run/Debug. Then select all available configurations&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
[http://www.b-prog.org BP Web Site]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=Main_Page</id>
		<title>Main Page</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=Main_Page"/>
				<updated>2013-06-26T11:10:40Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Behavioral Programming in Imperative Languages =&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
== BP in Java ==&lt;br /&gt;
[[BPJ User Guide]]&lt;br /&gt;
&lt;br /&gt;
== BP in Erlang ==&lt;br /&gt;
&lt;br /&gt;
== BP in Blockly and JavaScript ==&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	<entry>
		<id>https://wiki.weizmann.ac.il/bp/index.php?title=User_Guide</id>
		<title>User Guide</title>
		<link rel="alternate" type="text/html" href="https://wiki.weizmann.ac.il/bp/index.php?title=User_Guide"/>
				<updated>2013-06-25T09:09:23Z</updated>
		
		<summary type="html">&lt;p&gt;BpAdmin: Protected &amp;quot;User Guide&amp;quot; [edit=autoconfirmed:move=autoconfirmed:read=autoconfirmed]&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;'''BPJ User Guide &amp;amp;nbsp;&amp;lt;br&amp;gt;''' Contents:&amp;amp;nbsp;&amp;amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
*[[Download | Downloading, Installation and configuration ]]&lt;br /&gt;
*The BPJ library&lt;br /&gt;
*Designing and developing your application&lt;br /&gt;
*Running your application&lt;br /&gt;
*Debugging with TraceVis&lt;br /&gt;
*Verifying your application with BPmc&lt;br /&gt;
*Using BPJ for hybrid fuzzy control with BFUZ&lt;br /&gt;
*See introduction to behavioral programming in the BP Overview presentation&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Main Page|Prev]]&amp;lt;span style=&amp;quot;line-height: 1.5em;&amp;quot;&amp;gt; &amp;lt;/span&amp;gt;[[UserGuidePage1|Next]]&lt;/div&gt;</summary>
		<author><name>BpAdmin</name></author>	</entry>

	</feed>