Skip to content
Open
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
3 changes: 2 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -83,4 +83,5 @@ def modelProject(projectName: String)(mainClassName: String): Project = {
lazy val formin = modelProject("formin")("pl.edu.agh.formin.ForminMain")
lazy val fortwist = modelProject("fortwist")("pl.edu.agh.fortwist.FortwistMain")
lazy val torch = modelProject("torch")("pl.edu.agh.torch.TorchMain")
lazy val mock = modelProject("mock")("pl.edu.agh.mock.MockMain")
lazy val mock = modelProject("mock")("pl.edu.agh.mock.MockMain")
lazy val wind = modelProject("wind")("pl.edu.agh.wind.WindMain")
2 changes: 2 additions & 0 deletions formin/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@ formin {
iterationsNumber = 10000
isSupervisor = true
shardingMod = 144
crossBendFactor = 0
straightBendFactor = 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ final case class ForminConfig(
workersRoot: Int,
iterationsNumber: Long,
isSupervisor: Boolean,
shardingMod: Int
shardingMod: Int,
crossBendFactor: Double,
straightBendFactor: Double
) extends XinukConfig
18 changes: 10 additions & 8 deletions formin/src/test/scala/pl.edu.agh.formin/GridTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ class GridTest extends FlatSpecLike with Matchers with BeforeAndAfter {
workersRoot = 1,
iterationsNumber = 1000,
isSupervisor = true,
1
1,
crossBendFactor = 0,
straightBendFactor = 0
)

private var grid: Grid = _
Expand Down Expand Up @@ -59,8 +61,8 @@ class GridTest extends FlatSpecLike with Matchers with BeforeAndAfter {

it should "propagate signal correctly for one foraminifera cell" in {
grid.cells(2)(2) = ForaminiferaAccessible.unapply(EmptyCell.Instance).withForaminifera(config.foraminiferaStartEnergy, 0)
grid.cells(3)(2) = grid.propagatedSignal(DefaultSmellPropagation.calculateSmellAddendsStandard, 3, 2)
grid.cells(3)(1) = grid.propagatedSignal(DefaultSmellPropagation.calculateSmellAddendsStandard, 3, 1)
grid.cells(3)(2) = grid.propagatedSignal(DefaultSmellPropagation.calculateSmellAddendsStandard(config), 3, 2)
grid.cells(3)(1) = grid.propagatedSignal(DefaultSmellPropagation.calculateSmellAddendsStandard(config), 3, 1)

grid.cells(2)(2).smell(0)(0).value shouldBe -1
grid.cells(2)(2).smell(0)(1).value shouldBe -1
Expand All @@ -73,8 +75,8 @@ class GridTest extends FlatSpecLike with Matchers with BeforeAndAfter {

it should "propagate signal correctly for one algae cell" in {
grid.cells(2)(2) = AlgaeAccessible.unapply(EmptyCell.Instance).withAlgae(0)
grid.cells(3)(2) = grid.propagatedSignal(DefaultSmellPropagation.calculateSmellAddendsStandard, 3, 2)
grid.cells(3)(1) = grid.propagatedSignal(DefaultSmellPropagation.calculateSmellAddendsStandard, 3, 1)
grid.cells(3)(2) = grid.propagatedSignal(DefaultSmellPropagation.calculateSmellAddendsStandard(config), 3, 2)
grid.cells(3)(1) = grid.propagatedSignal(DefaultSmellPropagation.calculateSmellAddendsStandard(config), 3, 1)

grid.cells(2)(2).smell(0)(0).value shouldBe 1
grid.cells(2)(2).smell(0)(1).value shouldBe 1
Expand All @@ -88,8 +90,8 @@ class GridTest extends FlatSpecLike with Matchers with BeforeAndAfter {
it should "propagate signal correctly between algae and foraminifera cells" in {
grid.cells(2)(2) = AlgaeAccessible.unapply(EmptyCell.Instance).withAlgae(0)
grid.cells(3)(2) = ForaminiferaAccessible.unapply(EmptyCell.Instance).withForaminifera(config.foraminiferaStartEnergy, 0)
val gridCellWithAlgaeAfterSignalPropagation = grid.propagatedSignal(DefaultSmellPropagation.calculateSmellAddendsStandard, 2, 2)
val gridCellWithForaminiferaAfterSignalPropagation = grid.propagatedSignal(DefaultSmellPropagation.calculateSmellAddendsStandard, 3, 2)
val gridCellWithAlgaeAfterSignalPropagation = grid.propagatedSignal(DefaultSmellPropagation.calculateSmellAddendsStandard(config), 2, 2)
val gridCellWithForaminiferaAfterSignalPropagation = grid.propagatedSignal(DefaultSmellPropagation.calculateSmellAddendsStandard(config), 3, 2)
grid.cells(2)(2) = gridCellWithAlgaeAfterSignalPropagation
grid.cells(3)(2) = gridCellWithForaminiferaAfterSignalPropagation

Expand All @@ -110,7 +112,7 @@ class GridTest extends FlatSpecLike with Matchers with BeforeAndAfter {

it should "not propagate signal on obstacle cell" in {
grid.cells(3)(2) = ForaminiferaAccessible.unapply(EmptyCell.Instance).withForaminifera(config.foraminiferaStartEnergy, 0)
grid.cells(4)(2) = grid.propagatedSignal(DefaultSmellPropagation.calculateSmellAddendsStandard, 4, 2)
grid.cells(4)(2) = grid.propagatedSignal(DefaultSmellPropagation.calculateSmellAddendsStandard(config), 4, 2)
grid.cells(3)(2).smell(1)(1).value shouldBe -1
grid.cells(4)(2).smell(0)(1).value shouldBe 0
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ class MovesControllerTest extends FlatSpecLike with Matchers with BeforeAndAfter
workersRoot = 1,
iterationsNumber = 1000,
isSupervisor = true,
shardingMod = 1
shardingMod = 1,
crossBendFactor = 0,
straightBendFactor = 0
)

private var grid: Grid = _
Expand Down
26 changes: 14 additions & 12 deletions formin/src/test/scala/pl.edu.agh.formin/ParallelTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ class ParallelTest extends FlatSpec with Matchers with Eventually with ScalaFutu
workersRoot = 3,
iterationsNumber = 3,
isSupervisor = true,
shardingMod = 1
shardingMod = 1,
crossBendFactor = 0,
straightBendFactor = 0
)

trait Fixture {
Expand All @@ -47,7 +49,7 @@ class ParallelTest extends FlatSpec with Matchers with Eventually with ScalaFutu
val workerRegion = TestProbe("workerRegion")
val worker = TestActorRef(WorkerActor.props[ForminConfig](workerRegion.ref, (bufferZone, config) =>
new ForminMovesController(bufferZone)(config), ForminConflictResolver,
DefaultSmellPropagation.calculateSmellAddendsStandard
DefaultSmellPropagation.calculateSmellAddendsStandard(config)
))
worker ! WorkerActor.NeighboursInitialized(WorkerId(5),
Vector(Neighbour(NeighbourPosition.Bottom),
Expand All @@ -73,7 +75,7 @@ class ParallelTest extends FlatSpec with Matchers with Eventually with ScalaFutu
val workerRegion = TestProbe("workerRegion")
val worker = TestActorRef(WorkerActor.props[ForminConfig](workerRegion.ref, (bufferZone, config) =>
new ForminMovesController(bufferZone)(config), ForminConflictResolver,
DefaultSmellPropagation.calculateSmellAddendsStandard
DefaultSmellPropagation.calculateSmellAddendsStandard(config)
))
worker ! WorkerActor.NeighboursInitialized(WorkerId(5),
Vector(Neighbour(NeighbourPosition.Bottom),
Expand All @@ -95,7 +97,7 @@ class ParallelTest extends FlatSpec with Matchers with Eventually with ScalaFutu
val workerRegion = TestProbe("workerRegion")
val worker = TestActorRef(WorkerActor.props[ForminConfig](workerRegion.ref, (bufferZone, config) =>
new ForminMovesController(bufferZone)(config), ForminConflictResolver,
DefaultSmellPropagation.calculateSmellAddendsStandard
DefaultSmellPropagation.calculateSmellAddendsStandard(config)
))
worker ! WorkerActor.NeighboursInitialized(WorkerId(5),
Vector(Neighbour(NeighbourPosition.Top),
Expand All @@ -117,7 +119,7 @@ class ParallelTest extends FlatSpec with Matchers with Eventually with ScalaFutu
val workerRegion = TestProbe("workerRegion")
val worker = TestActorRef(WorkerActor.props[ForminConfig](workerRegion.ref, (bufferZone, config) =>
new ForminMovesController(bufferZone)(config), ForminConflictResolver,
DefaultSmellPropagation.calculateSmellAddendsStandard
DefaultSmellPropagation.calculateSmellAddendsStandard(config)
))
worker ! WorkerActor.NeighboursInitialized(WorkerId(5),
Vector(Neighbour(NeighbourPosition.Top),
Expand All @@ -139,7 +141,7 @@ class ParallelTest extends FlatSpec with Matchers with Eventually with ScalaFutu
val workerRegion = TestProbe("workerRegion")
val worker = TestActorRef(WorkerActor.props[ForminConfig](workerRegion.ref, (bufferZone, config) =>
new ForminMovesController(bufferZone)(config), ForminConflictResolver,
DefaultSmellPropagation.calculateSmellAddendsStandard
DefaultSmellPropagation.calculateSmellAddendsStandard(config)
))
worker ! WorkerActor.NeighboursInitialized(WorkerId(5),
Vector(Neighbour(NeighbourPosition.Bottom),
Expand All @@ -161,7 +163,7 @@ class ParallelTest extends FlatSpec with Matchers with Eventually with ScalaFutu
val workerRegion = TestProbe("workerRegion")
val worker = TestActorRef(WorkerActor.props[ForminConfig](workerRegion.ref, (bufferZone, config) =>
new ForminMovesController(bufferZone)(config), ForminConflictResolver,
DefaultSmellPropagation.calculateSmellAddendsStandard
DefaultSmellPropagation.calculateSmellAddendsStandard(config)
))
worker ! WorkerActor.NeighboursInitialized(WorkerId(5),
Vector(Neighbour(NeighbourPosition.Bottom),
Expand Down Expand Up @@ -193,7 +195,7 @@ class ParallelTest extends FlatSpec with Matchers with Eventually with ScalaFutu
val workerRegion = TestProbe("workerRegion")
val worker = TestActorRef(WorkerActor.props[ForminConfig](workerRegion.ref, (bufferZone, config) =>
new ForminMovesController(bufferZone)(config), ForminConflictResolver,
DefaultSmellPropagation.calculateSmellAddendsStandard
DefaultSmellPropagation.calculateSmellAddendsStandard(config)
))
worker ! WorkerActor.NeighboursInitialized(WorkerId(5),
Vector(Neighbour(NeighbourPosition.Bottom),
Expand Down Expand Up @@ -225,7 +227,7 @@ class ParallelTest extends FlatSpec with Matchers with Eventually with ScalaFutu
val workerRegion = TestProbe("workerRegion")
val worker = TestActorRef(WorkerActor.props[ForminConfig](workerRegion.ref, (bufferZone, config) =>
new ForminMovesController(bufferZone)(config), ForminConflictResolver,
DefaultSmellPropagation.calculateSmellAddendsStandard
DefaultSmellPropagation.calculateSmellAddendsStandard(config)
))
worker ! WorkerActor.NeighboursInitialized(WorkerId(5),
Vector(Neighbour(NeighbourPosition.Bottom),
Expand Down Expand Up @@ -257,7 +259,7 @@ class ParallelTest extends FlatSpec with Matchers with Eventually with ScalaFutu
val workerRegion = TestProbe("workerRegion")
val worker = TestActorRef(WorkerActor.props[ForminConfig](workerRegion.ref, (bufferZone, config) =>
new ForminMovesController(bufferZone)(config), ForminConflictResolver,
DefaultSmellPropagation.calculateSmellAddendsStandard
DefaultSmellPropagation.calculateSmellAddendsStandard(config)
))
worker ! WorkerActor.NeighboursInitialized(WorkerId(5),
Vector(Neighbour(NeighbourPosition.Left),
Expand Down Expand Up @@ -289,11 +291,11 @@ class ParallelTest extends FlatSpec with Matchers with Eventually with ScalaFutu
val workerRegion = TestProbe("workerRegion")
val worker1 = TestActorRef(WorkerActor.props[ForminConfig](workerRegion.ref, (bufferZone, config) =>
new ForminMovesController(bufferZone)(config), ForminConflictResolver,
DefaultSmellPropagation.calculateSmellAddendsStandard
DefaultSmellPropagation.calculateSmellAddendsStandard(config)
))
val worker2 = TestActorRef(WorkerActor.props[ForminConfig](workerRegion.ref, (bufferZone, config) =>
new ForminMovesController(bufferZone)(config), ForminConflictResolver,
DefaultSmellPropagation.calculateSmellAddendsStandard
DefaultSmellPropagation.calculateSmellAddendsStandard(config)
))

worker1 ! WorkerActor.NeighboursInitialized(WorkerId(5),
Expand Down
10 changes: 6 additions & 4 deletions formin/src/test/scala/pl.edu.agh.formin/WorkerActorTest.scala
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ class WorkerActorTest extends FlatSpecLike with Matchers with Eventually with Sc
workersRoot = 2,
iterationsNumber = 3,
isSupervisor = true,
shardingMod = 1
shardingMod = 1,
crossBendFactor = 0,
straightBendFactor = 0
)

trait Fixture {
Expand All @@ -44,7 +46,7 @@ class WorkerActorTest extends FlatSpecLike with Matchers with Eventually with Sc
val workerRegion = TestProbe("workerRegion")
val worker = system.actorOf(WorkerActor.props[ForminConfig](workerRegion.ref, (bufferZone, config) =>
new ForminMovesController(bufferZone)(config), ForminConflictResolver,
DefaultSmellPropagation.calculateSmellAddendsStandard
DefaultSmellPropagation.calculateSmellAddendsStandard(config)
))

worker ! WorkerActor.NeighboursInitialized(WorkerId(2), Vector(Neighbour(NeighbourPosition.Bottom)))
Expand All @@ -60,7 +62,7 @@ class WorkerActorTest extends FlatSpecLike with Matchers with Eventually with Sc
val workerRegion = TestProbe("workerRegion")
val worker = system.actorOf(WorkerActor.props[ForminConfig](workerRegion.ref, (bufferZone, config) =>
new ForminMovesController(bufferZone)(config), ForminConflictResolver,
DefaultSmellPropagation.calculateSmellAddendsStandard
DefaultSmellPropagation.calculateSmellAddendsStandard(config)
))

worker ! WorkerActor.NeighboursInitialized(WorkerId(2), Vector(Neighbour(NeighbourPosition.Bottom)))
Expand All @@ -87,7 +89,7 @@ class WorkerActorTest extends FlatSpecLike with Matchers with Eventually with Sc
val workerRegion = TestProbe("workerRegion")
val worker = system.actorOf(WorkerActor.props[ForminConfig](workerRegion.ref, (bufferZone, config) =>
new ForminMovesController(bufferZone)(config), ForminConflictResolver,
DefaultSmellPropagation.calculateSmellAddendsStandard
DefaultSmellPropagation.calculateSmellAddendsStandard(config)
))

worker ! WorkerActor.NeighboursInitialized(WorkerId(2), Vector())
Expand Down
2 changes: 2 additions & 0 deletions fortwist/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@ fortwist {
iterationsNumber = 10000
isSupervisor = true
shardingMod = 144
crossBendFactor = 0
straightBendFactor = 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,7 @@ final case class FortwistConfig(
workersRoot: Int,
iterationsNumber: Long,
isSupervisor: Boolean,
shardingMod: Int
shardingMod: Int,
crossBendFactor: Double,
straightBendFactor: Double
) extends XinukConfig
3 changes: 3 additions & 0 deletions mock/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@ mock {
iterationsNumber = 10000

mockInitialSignal = 1

crossBendFactor = 0
straightBendFactor = 0
}
}
5 changes: 4 additions & 1 deletion mock/src/main/scala/pl.edu.agh.mock/config/MockConfig.scala
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@ final case class MockConfig(
signalSpeedRatio: Int,
iterationsNumber: Long,

mockInitialSignal: Signal
mockInitialSignal: Signal,

crossBendFactor: Double,
straightBendFactor: Double
) extends XinukConfig
2 changes: 2 additions & 0 deletions torch/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,7 @@ torch {
iterationsNumber = 1000
isSupervisor = true
shardingMod = 144
crossBendFactor = 0
straightBendFactor = 0
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import pl.edu.agh.xinuk.config.{GuiType, XinukConfig}
import pl.edu.agh.xinuk.model.Signal

final case class TorchConfig(

humanMaxSpeed: Int,
fireSpeadingFrequency: Int,
signalSpeedRatio: Int,
Expand All @@ -23,5 +22,7 @@ final case class TorchConfig(
workersRoot: Int,
iterationsNumber: Long,
isSupervisor: Boolean,
shardingMod: Int
shardingMod: Int,
crossBendFactor: Double,
straightBendFactor: Double
) extends XinukConfig
41 changes: 41 additions & 0 deletions wind/src/main/resources/reference.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
application {
name = wind
}

clustering {
ip = "0.0.0.0"
port = 2551
supervisor {
ip = "0.0.0.0"
port = 2551
}
min-nr-of-members = 1
}

xinuk {
classes = [
"pl.edu.agh.wind.model.WindSourceCell",
"pl.edu.agh.wind.simulation.WindMetrics",
]
}

wind {
config {
gridSize = 62
guiCellSize = 4
signalSuppressionFactor = 0.5
signalAttenuationFactor = 1
workersRoot = 1
shardingMod = 144

guiType = basic
isSupervisor = true
signalSpeedRatio = 1
iterationsNumber = 10000

crossBendFactor = 0.5
straightBendFactor = 0.5

windSourceInitialSignal = 1
}
}
Loading