Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ services:

jobs:
include:
- stage: Build Sources
if: branch = master
language: scala
scala:
- 2.12.5
script:
- sbt ++$TRAVIS_SCALA_VERSION compile tut

- stage: GitHub Release
if: tag IS present
before_install:
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Community tutorial for CIlib

[![Build Status](https://travis-ci.org/cirg-up/cilib-tutorial.svg?branch=master)](https://travis-ci.org/cirg-up/cilib-tutorial)

Welcome to the community tutorial source repository!

## About the tutorial
Expand Down
64 changes: 51 additions & 13 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,54 @@ git.useGitDescribe := true

scalacOptions ++= Seq(
"-deprecation",
"-encoding", "UTF-8",
"-unchecked",
"-feature",
"-Xlint",
// "-Xfatal-warnings",
"-Ywarn-dead-code",
"-Ypartial-unification"
// "-Ydelambdafy:inline" // workaround for future deadlock on the 2.12.1 REPL
"-encoding", "utf-8", // Specify character encoding used by source files.
"-explaintypes", // Explain type errors in more detail.
"-feature", // Emit warning and location for usages of features that should be imported explicitly.
"-language:existentials", // Existential types (besides wildcard types) can be written and inferred
"-language:experimental.macros", // Allow macro definition (besides implementation and application)
"-language:higherKinds", // Allow higher-kinded types
"-language:implicitConversions", // Allow definition of implicit functions called views
"-unchecked", // Enable additional warnings where generated code depends on assumptions.
"-Xcheckinit", // Wrap field accessors to throw an exception on uninitialized access.
"-Xfatal-warnings", // Fail the compilation if there are any warnings.
"-Xfuture", // Turn on future language features.
"-Xlint:adapted-args", // Warn if an argument list is modified to match the receiver.
"-Xlint:by-name-right-associative", // By-name parameter of right associative operator.
"-Xlint:constant", // Evaluation of a constant arithmetic expression results in an error.
"-Xlint:delayedinit-select", // Selecting member of DelayedInit.
"-Xlint:doc-detached", // A Scaladoc comment appears to be detached from its element.
"-Xlint:inaccessible", // Warn about inaccessible types in method signatures.
"-Xlint:infer-any", // Warn when a type argument is inferred to be `Any`.
"-Xlint:missing-interpolator", // A string literal appears to be missing an interpolator id.
"-Xlint:nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
"-Xlint:nullary-unit", // Warn when nullary methods return Unit.
"-Xlint:option-implicit", // Option.apply used implicit view.
"-Xlint:package-object-classes", // Class or object defined in package object.
"-Xlint:poly-implicit-overload", // Parameterized overloaded implicit methods are not visible as view bounds.
"-Xlint:private-shadow", // A private field (or class parameter) shadows a superclass field.
"-Xlint:stars-align", // Pattern sequence wildcard must align with sequence component.
"-Xlint:type-parameter-shadow", // A local type parameter shadows a type already in scope.
"-Xlint:unsound-match", // Pattern match may not be typesafe.
"-Yno-adapted-args", // Do not adapt an argument list (either by inserting () or creating a tuple) to match the receiver.
"-Ypartial-unification", // Enable partial unification in type constructor inference
"-Ywarn-dead-code", // Warn when dead code is identified.
"-Ywarn-extra-implicit", // Warn when more than one implicit parameter section is defined.
"-Ywarn-inaccessible", // Warn about inaccessible types in method signatures.
"-Ywarn-infer-any", // Warn when a type argument is inferred to be `Any`.
"-Ywarn-nullary-override", // Warn when non-nullary `def f()' overrides nullary `def f'.
"-Ywarn-nullary-unit", // Warn when nullary methods return Unit.
"-Ywarn-numeric-widen", // Warn when numerics are widened.
"-Ywarn-unused:implicits", // Warn if an implicit parameter is unused.
"-Ywarn-unused:imports", // Warn if an import selector is not referenced.
"-Ywarn-unused:locals", // Warn if a local definition is unused.
"-Ywarn-unused:params", // Warn if a value parameter is unused.
"-Ywarn-unused:patvars", // Warn if a variable bound in a pattern is unused.
"-Ywarn-unused:privates", // Warn if a private member is unused.
"-Ywarn-value-discard" // Warn when non-Unit expression results are unused.
)


scalacOptions in Tut := (scalacOptions in Tut).value.filterNot(Set("-Ywarn-unused-import"))
scalacOptions in Tut := (scalacOptions in Tut).value.filterNot(Set("-Ywarn-unused-import", "-Ywarn-unused:imports"))

libraryDependencies ++= Seq(
"net.cilib" %% "cilib-core" % cilibVersion,
Expand All @@ -42,8 +78,10 @@ lazy val epub = taskKey[Unit]("Build the ePub version of the book")
lazy val json = taskKey[Unit]("Build the Pandoc JSON AST of the book")
lazy val all = taskKey[Unit]("Build all versions of the book")

pdf := { tutQuick.value ; "grunt pdf" ! }
html := { tutQuick.value ; "grunt html" ! }
epub := { tutQuick.value ; "grunt epub" ! }
json := { tutQuick.value ; "grunt json" ! }
import scala.sys.process._

pdf := { tutQuick.value ; Seq("grunt", "pdf").! }
html := { tutQuick.value ; Seq("grunt", "html").! }
epub := { tutQuick.value ; Seq("grunt", "epub").! }
json := { tutQuick.value ; Seq("grunt", "json").! }
all := { pdf.value ; html.value ; epub.value ; json.value }
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.15
sbt.version=1.1.2
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "0.9.3")
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.5.2")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.0-RC8")
addSbtPlugin("org.tpolecat" % "tut-plugin" % "0.6.4")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "1.0.1")
22 changes: 13 additions & 9 deletions src/pages/benchmarks/index.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
# Benchmarks

Often in computational intelligence we will need to test algorithms on standard problems.
It should be noted that CIRG contains a library of benchmarks that we can use with CILib.
The benchmarks can be found [here][benchmarks] as well as a list of available benchmarks.
To import benchmarks into your build you need the following dependency added to your sbt.build.
Often in computational intelligence we will need to test algorithms on
standard problems. It should be noted that CIRG contains a library of
benchmarks that we can use with CILib. The benchmarks can be found
[here][benchmarks] as well as a list of available benchmarks. To
import benchmarks into your build you need the following dependency
added to your sbt.build.

` "net.cilib" %% "benchmarks" % "0.1.1"`

The following snippets of code will demonstrate how to include benchmarks in your program as an example use.
The following snippets of code will demonstrate how to include
benchmarks in your program as an example use.

```tut:book:silent
import cilib._
Expand All @@ -17,12 +20,13 @@ import spire.implicits._
import spire.math.Interval

// Example use
val bounds = Interval(-5.12,5.12)^30
val env =
Environment(
cmp = Comparison.dominance(Min),
eval = Eval.unconstrained(Benchmarks.spherical[NonEmptyList, Double]).eval,
bounds = Interval(-5.12,5.12)^30)
eval = Eval.unconstrained(Benchmarks.spherical[NonEmptyList, Double]).eval)
```

That's all there is to it!
Be sure to check out the list of benchmarks that are included and can be accessed by the `Benchmark` object.
That's all there is to it! Be sure to check out the list of
benchmarks that are included and can be accessed by the `Benchmark`
object.
5 changes: 3 additions & 2 deletions src/pages/constraint/object.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ import spire.implicits._
import spire.algebra.Eq

val sumLessThanCons = LessThan(sumCF, 12.0)
val firstNumberCons = cilib.Equal(ConstraintFunction((l: NonEmptyList[Double]) => l.head), 4.0)
// A constraint that ensures the first element of a list is 4
val firstNumberCons = cilib.Equal(ConstraintFunction((l: NonEmptyList[Double]) => l.head), 4.0)
```

```tut:book
Constraint.violationCount(List(sumLessThanCons, firstNumberCons), NonEmptyList(19.0, 37.23, 12.0))
Constraint.violationCount(List(sumLessThanCons, firstNumberCons), NonEmptyList(4.0, 3.0, 2.0))
Expand All @@ -60,4 +61,4 @@ Determines the magnitude of the number of violated constraints.

```tut:book
Constraint.violationMagnitude(0.1, 0.9, List(sumLessThanCons, firstNumberCons), NonEmptyList(19.0, 37.23, 12.0))
```
```
6 changes: 3 additions & 3 deletions src/pages/position/maths.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,17 @@ import spire.math._
import scalaz._
import Scalaz._
```

```tut:book:silent
val rng = RNG.init(1234L)
val e = Eval.unconstrained[NonEmptyList,Double](_.map(x => x*x).suml).eval
val a = Position.createPosition(Interval(-5.12,5.12)^3).eval(rng)
val b = Position.createPosition(Interval(-5.12,5.12)^3).flatMap(p => Position.eval(e, p)).eval(rng)
```

```tut:book
a + b // Add Point and Solution
a + a // Add Point and Point
b + b // Add Solution and Solution
a - b // Subtract Solution from Point

// And so forth
```
```
Loading