//:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** @author Hao Peng * @version 1.6 * @date Sat Nov 4 12:18:00 EDT 2017 * @see LICENSE (MIT style license file). */ package scalation import java.io.{File, PrintWriter} import java.util.Scanner import scala.io.Source //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** The `GenReadmeHtml` object is used to create the html tables for the api and * src directories for convenient Web browsing. * > runMain scalation.GenReadmeHtml */ object GenReadmeHtml extends App { val SKIP = "old" // do not process files in this directory val moduleList = Array ("scalation_mathstat", "scalation_database", "scalation_modeling", "scalation_models") val moduleNames = Array ("MATH AND STAT", "DATABASE", "MODELING", "APPLICATIONS") val scalationVer = BASE.substring (BASE.lastIndexOf ('_') + 1) // ScalaTion version (i.e., 1.4) val scalaVerFull = scala.util.Properties.versionNumberString // full scala version (i.e., 2.12.4) val scalaVer = scalaVerFull.substring (0, scalaVerFull.lastIndexOf ('.')) // main scala version (i.e., 2.12) val javaVer = System.getProperty("java.version").split('.')(1) // current java version (i.e., 8) val fApi = new File (BASE + ⁄ + "api.html") val fSrc = new File (BASE + ⁄ + "src.html") val outApi = new PrintWriter (fApi) // api table writer val outSrc = new PrintWriter (fSrc) // src table writer // write table headers outApi.println (s"""\n\n


\n

Source Packages (doc)

\n

\n\n

\n\n\n""") outSrc.println (s"""\n\n

\n

Source Packages (src)

\n

\n\n

\n
Package\n Description\n
\n\n""") // filling in table rows for api and src for (i <- 0 until moduleList.length) { val topPath = if (i < moduleList.length-1) "scalation" else "apps" // apps (models) should be the last module outApi.println (s"""\n""") outSrc.println (s"""\n""") recWrite (new File(BASE + ⁄ + moduleList(i) + s"${⁄}src${⁄}main${⁄}scala${⁄}$topPath"), moduleList(i), topPath, topPath, 0) } // for // filling in table rows for testing packages (src only) val topPath = "testing" for (i <- 0 until moduleList.length) { // for each module val testDir = new File (BASE + ⁄ + moduleList(i) + s"${⁄}src${⁄}test${⁄}scala${⁄}$topPath") if (testDir.exists()) { outSrc.println(s"""\n""") recWrite (testDir, moduleList(i), topPath, topPath, 0, true) } // if } // for outApi.println ("
Package\n Description\n
${moduleNames(i)}\n
${moduleNames(i)}\n
${moduleNames(i)} UNIT TESTS\n
\n
") outSrc.println ("\n") outApi.close outSrc.close val moduleListS = new StringBuilder for (i <- 0 until moduleList.length) { moduleListS.append (moduleList(i)) if (i < moduleList.length - 2) moduleListS.append (", ") else if (i == moduleList.length - 2) moduleListS.append (" and ") } // for val prefix = raw""" ScalaTion

SCALAble SimulaTION - ScalaTion

Papers | Scaladoc | Source Code

Welcome to ScalaTion, the Scala-based system for Simulation, Optimization and Analytics.

This system, coded in Scala, supports multi-paradigm simulation modeling including 'tableau', 'event', 'process', 'dynamics', 'dynamics_pde', 'activity' and 'state' oriented models.

Scala is a modern object-oriented, functional programming language that is well-suited for developing simulation engines. It is in the Java family of languages and can call Java code. The inclusion of advanced and functional programming capabilities, makes the code much more concise than Java. ScalaTion also supports optimization and analytics as they nowadays go hand-in-hand with simulation modeling. Some of the algorithms come in both sequential and parallel versions.

The ScalaTion $scalationVer version defines multiple .par subpackages that contain parallel versions of sequential algorithms. Future directions include completing the 'scala3d' and 'physics' packages.

As of version $scalationVer, ScalaTion consists of ${moduleList.length} subprojects: $moduleListS

Please read the LICENSE file (an MIT style license).


Installation Instructions

Requires: Scala $scalaVer.x and Java $javaVer
Recommended: sbt   (see Setup.html)

1. Download one of the following two files

scalation_$scalationVer.tar.gz
OR
scalation_${scalationVer}.zip

2. Untar or unzip the file


$$ tar xvfz scalation_$scalationVer.tar.gz 
OR
$$ unzip scalation_$scalationVer.zip

3. To compile code or run apps, enter sbt and type compile, runMain or exit


$$ cd scalation_$scalationVer 
$$ cd scalation_models
$$ sbt
> compile
> runMain apps.process.Bank
> runMain scalation.analytics.RegressionTest
> exit

ScalaTion $scalationVer is set up to use the Simple Build Tool sbt.

ScalaTion $scalationVer uses the following build specification files build.sbt, build.sbt and build.sbt. Source packages are in the src/main/scala directory, class files are in the target/scala-${scalaVer}/classes directory, and documentation files are in the target/scala-${scalaVer}/api directory. Data file input, output or analytics are stored in subdirectories of data, while database files are stored in store.


To develop using an IDE:

  1. Download Scala IDE for Eclipse
  2. Extract the downloaded .zip/.tar.gz file
  3. Start eclipse by running the eclipse command or clicking eclipse application from the file manager
  4. Create and run HelloWorld.scala, see tutorial

For more information about the source code, see src/README_src.hmtl.


Papers/Documentation

  1. John A. Miller, Jun Han and Maria Hybinette, "Using Domain Specific Languages for Modeling and Simulation: ScalaTion as a Case Study," Proceedings of the 2010 ACM/IEEE Winter Simulation Conference (WSC'10), Baltimore, Maryland (December 2010) pp. 741-752.

  2. Michael E. Cotterell, John A. Miller, Tom Horton, "Unicode in Domain-Specific Programming Languages for Modeling & Simulation: ScalaTion as a Case Study," Arxiv preprint arXiv:1112.175 (December 2011) pp. 1-10.

  3. Michael E. Cotterell, John A. Miller, Jun Han and Tom Horton, "Extending ScalaTion, a Domain-Specific Language for Modeling & Simulation, for Simulation Optimization," Proceedings of the AlaSim International Modeling and Simulation Conference & Exhibition (AlaSim'12), Huntsville, Alabama (May 2012) pp. 1-1.

  4. Yung Long Li, "Evaluation of Parallel Implementations of Dense and Sparse Matrices for the ScalaTion Library," Technical Report, University of Georgia (December 2012) pp. 1-60.

  5. John A. Miller, Michael E. Cotterell and Stephen J. Buckley, "Supporting a Modeling Continuum in ScalaTion: From Predictive Analytics to Simulation Modeling," Proceedings of the 2013 ACM/IEEE Winter Simulation Conference (WSC'13), Washington, DC (December 2013) pp. 1191-1202.

  6. Matthew Saltz, Ayushi Jain, Abhishek Kothari, Arash Fard, John A. Miller, and Lakshmish Ramaswamy, "DualIso: An Algorithm for Subgraph Pattern Matching on Very Large Labeled Graphs," Proceedings of the 3rd IEEE International Congress on Big Data (BigData'14), Anchorage, Alaska (June-July 2014) pp. 498-505.
    Online supplement
""" val postfix = raw"""

Code Release Process


$$ cd scalation_$scalationVer 
$$ cd scalation_mathstat
$$ sbt
> compile
> package
> test
> runMain scalation.util.RunSpellCheck 'package-directory'
> runMain scalation.GenIndexHtml
> clean
> doc
> exit
Similarly for scalation_modeling and scalation_models. Currently the .jar files need to be copied (copy_jars.sh) into the lib directory of dependent subprojects.

""" val readmeOut = new PrintWriter (BASE + ⁄ + "README.html") readmeOut.println (prefix) readmeOut.println (Source.fromFile (fApi).mkString) readmeOut.println (Source.fromFile (fSrc).mkString) readmeOut.println (postfix) readmeOut.close //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** Recursively write table rows for each package. * @param f the directory to examine * @param module the module name (i.e. scalation_mathstat) * @param parPath the path of the parent directories (i.e. scalation/util) * @param parName the name of the parent directories (i.e. scalation.util) * @param depth the depth of the project structure * @param isTestPac flag for whether dealing with unit testing packages or not */ def recWrite (f: File, module: String, parPath : String, parName: String, depth: Int, isTestPac: Boolean = false): Unit = { val dirs = f.listFiles // list files in the current directory val mainTest = if (isTestPac) "test" else "main" for (fi <- dirs if (fi.isDirectory && !fi.getName.contains (SKIP))) { // process each subpackage in the current package/directory val pacName = fi.getName val hyphens = getHyphens (depth) val descriptions = getDescriptions (new File (fi.getAbsolutePath + ⁄ + "package.scala")) if (!isTestPac) outApi.println (s"""\n ${hyphens} $parName.$pacName \n $descriptions""") outSrc.println (s"""\n ${hyphens} $parName.$pacName \n $descriptions""") recWrite (fi, module, s"$parPath/$pacName", s"$parName.$pacName", depth+1, isTestPac) } // for } // recWrite //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** Obtain the number of hyphens for the sub-packages. * @param depth the depth of the project structure */ def getHyphens (depth: Int): String = { val sb = new StringBuilder for (i <- 0 until depth) sb.append ("- ") sb.toString } // getHyphens //::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: /** Obtain the Descriptions of a package from its package.scala comments. * @param f the package.scala file */ def getDescriptions (f: File): String = { if (f.exists) { val scan = new Scanner (f) var foundStart = false // flag for fining the starting point of search, which is the package line var contSearch = true // flag for continuing with the search (has not encountered */) var sb = new StringBuilder while (contSearch && scan.hasNextLine) { var line = scan.nextLine if (foundStart) { if (line.startsWith ("/**")) { line = line.substring (3).trim sb.append (line) sb += ' ' } else if (line.startsWith (" */")) { contSearch = false } else if (line.startsWith (" *")) { line = line.substring (2).trim sb.append (line) sb += ' ' } // if } else if (line.contains ("package")) foundStart = true } // while sb.toString } else s"There is currently no `package.scala` for ${f.getParentFile.getName}" } // getDescriptions } // GenReadmeHtml object