############################################ #### SMN v4.0 Dynamic Draw (beta) #### ############################################ #### John Ringland 2006/01/22 #### #### www.Anandavala.info #### ############################################ --modified 2006-01-31 added zoom function, step function, removed reliance on mouse_handlers being stored in theModel, optimised the save bitmap function so that it uses generic model files, and also restructured some of the code to make it more comprehensible. -- modified 2006-02-01 restructuring of the code -- modified 2006-02-06 restructuring of the code This program should run on all DOS or Windows based systems (linux versions will be released when I am able). The latest version can be found via: www.anandavala.info/TASTMOTNOR/code/v4.0/SMNDD4_0.html SMN is a new system modeling methodology that allows for the realistic simulation of general systems. See: www.anandavala.info/TASTMOTNOR/SMN%20Comments.html This program is a simple illustration of the core functionality of SMN. This example creates a drawing canvas where every pixel is implemented as an SMN 'system' thus each pixel may communicate with and influence any other pixels according to any designated interaction scheme. Thus each pixel is the outer appearance of what is in fact a dynamical system that is capable of complex interactions with other systems thereby exhibiting complex behaviours. In the default scenario each pixel's new colour value is calculated as the average of its nearest neighbour's colours, thus any mark on the canvas spreads and merges with the surrounding colours. I will soon implement the possibility for people to design their own pixel interaction schemes which produce different types of dynamic canvases, such as "The Game of Life" from the field of cellular automata. These types of dynamic canvases could be implemented using traditional methods, which would be more efficient in these particular scenarios but it would have far less flexibility. In this SMN scenario each pixel is a unique individual which could, if one wished, be programmed with its own unique behaviour and it would then perceive, experience and respond to its environment in its own unique way. This program is presented purely as a proof-of-concept for the underlying mathematical methodology. The "Particle Simulator" example illustrated SMN's functionality for small numbers of maximally interacting systems (every particle interacts with every other particle). But this example illustrates the case of large numbers of sparsely interacting systems. Note: a 100x100 canvas contains 10,000 individual systems and each system interacts only with its nearest neighbours within a 2D metric space. For more information on this program and modeling paradigm see: www.Anandavala.info/TASTMOTNOR/code/v3.2b/SMNDD4_0.html Please send any bug reports to john.ringland[AT]anandavala.info with the words "bug report v4.0" somewhere in the subject. This would be much appreciated and will help me improve the program over time. Any other comments or suggestions are also welcomed. --------- Contents: --------- The Program: The Simulated System: Interacting with the Simulation: Model Parameters: Trouble Shooting: ------------ The Program: ------------ Unzip the folder then run "draw.bat". In Windows: If you wish to place an icon on your desktop right click and drag the file "draw.bat" onto your desktop and then from the menu choose to create a shortcut. In some windows environments you may need to execute the program from a full screen dos prompt in order for the dos graphics routines to work. This is only a very simple example of some of the core functionality of SMN, but SMN allows for many advanced features which are unique to SMN. Many of these features are not implemented yet, but later versions will be out soon with more features and fututre versions will become gradually more general, flexible and will exhibit advanced system analysis and simulation features. --------------------- The Simulated System: --------------------- The system consists of a series of pixels organised into a 2D space. One can interact with these and thereby draw images that dynamically evolve. The simulation is not meant to be a full featured drawing program, it is just a simple illustration of the core simulation capacities of the SMN modeling paradigm. The system model is defined in the file "smModels.ex" which is itself written in the programming language "Euphoria" (www.rapideuphoria.com). -------------------------------- Interacting with the Simulation: -------------------------------- When the simulation runs there is a dynamic canvas displayed on the screen. * \'p\' = toggle Pause on and off, whilst paused one can still edit the model * \'s\' = Step forward one frame at a time, press 'p' to resume * \'c\' = change drawing Colour * \'b\' = change Brush size * \'z\' = Zoom (change magnification) * \'r\' = Reload current model (Restore model) * \'m\' = load or save Model * \'i\' = load or save Image * \'h\' or \'?\' = quick Help screen * any other key = show main menu * use the left mouse button to draw with the chosen drawing colour * use the right mouse button to draw with the background colour (erase) * click the left or right mouse button \"off canvas\" to refresh the screen The rest of the interface should be self explanatory. ----------------- Model Parameters: ----------------- The system model (canvas) is stored as a model file (*.D40) in the "Models" directory. One can also save images as bitmaps in the "Images" directory. You can also create a new canvas from an option in the edit model menu. When creating a new canvas from the edit model menu (for a large canvas this can take some time), it is advisable to then save it as a model file ready to be loaded again. It is recomended to name the model file in the following manner "b###x###.D40", e.g. "b100x060.D40" for a 100x60 canvas. Using the "load image" option one can load up arbitrary images and see how they evolve but they must be accompanied by an appropriate model. The model file must define a canvas of exactly the right dimensions and have the appropriate file name specifying these dimensions. The bitmap image must also be a 4 bit (16 colour) image. It is generally advisable that the model uses sparseSM and full processing when used with an arbitrary image. There are a couple of example images in the "Images" directory to play with. Changing Computational Method: ------------------------------ see: www.anandavala.info/TASTMOTNOR/Finite%20Discrete%20Information%20Systems.html#software_implementation Sparse Matrices: ---------------- From the edit model menu one can change the underlying matrix type from full representation to sparse represntation. A full matrix represents all elements whereas a sparse matrix represents only the NON-ZERO elements. In this particular scenario each pixel interacts only with neighbouring pixels so there IS efficiency gained by using sparse matrices. A large drawing canvas may cause your computer to run out of memory otherwise. Most engineering scenarios have this sparse connectivity so sparse matrices can lead to significant efficiency gains in those cases. Energy Flow Processing: ----------------------- With full processing every causal interaction pathway is computed in every moment whereas with energy flow processing only those pathways that are communicating new information are computed, so if nothing is happening (no energy flow) then nothing need be computed. This particular scenario can exhibit some of the benefits and drawbacks of energy flow processing. When there is only a very small region of activity (fluctuating colours) then energy flow processing will lead to faster processing but it will slow down greatly when the canvas becomes full of activity. In many engineering scenarios there is a large space of potential activity (e.g. blank canvas) but only a small region of actual activity so energy flow processing can lead to significant efficiency gains in those cases. With full processing the computational load is constant and depends only on the size of the canvas, not on what is happening on the canvas. One can dynamically switch between these methods as the activity level changes. ----------------- Trouble Shooting: ----------------- If you have a problem, let me know and I will attempt to resolve it. Here I'll build a list of known problems and ways around them. ---------------- There are many enhancements in progress and these will be released as they are ready. The next major release will probably utilise the general principles illustrated in this example but develop them for arbitrary systems, not just systems of particles. Then I will construct a simple piece of software using SMN and people may explore it as a system model.