Skip to content
Snippets Groups Projects
Commit 69e84207 authored by Alex's avatar Alex
Browse files

added debuging traces of messahes even stashed

parent 7816b8f9
Branches
No related tags found
No related merge requests found
......@@ -21,8 +21,8 @@ import scala.language.postfixOps
abstract class VariableAgent(val variable: Variable,
val neighbours : Set[Variable],
val constraints: Set[Constraint]) extends Actor {
var trace: Boolean = false
var debug: Boolean = false
var trace: Boolean = true
var debug: Boolean = true
var debugState: Boolean = true
var supervisor: ActorRef = context.parent
......
......@@ -56,7 +56,7 @@ class AgentBehaviour(variable: Variable,
// When the agent is informed
case Event(InformValue(_),mind) =>
if (debug) println(s"$variable in $stateName has received InformValue")
if (debug) println(s"$variable in $stateName has received InformValue and stashed it")
stash
stay using mind
}
......@@ -68,11 +68,13 @@ class AgentBehaviour(variable: Variable,
//
case Event(MakeOffer(_), mind) => {
if (debug) println(s"$variable in $stateName has received MakeOffer and stashed it")
stash
stay using mind
}
case Event(InformDelta(_), mind) => {
if (debug) println(s"$variable in $stateName has received InformDelta and stashed it")
stash
stay using mind
}
......@@ -96,17 +98,17 @@ class AgentBehaviour(variable: Variable,
// When the partner from previous round tells it to Go
case Event(GiveGo(_), mind) =>
if (debug) println(s"$variable in $stateName has received GiveGo")
if (debug) println(s"$variable in $stateName has received GiveGo and ignores it")
stay using mind
// When the partner from previous round tells it to not Go
case Event(GiveNoGo, mind) =>
if (debug) println(s"$variable in $stateName has received GiveNoGo")
if (debug) println(s"$variable in $stateName has received GiveNoGo and ignores it")
stay using mind
// When the partner gets an informValue
case Event(InformValue(_), mind) =>
if (debug) println(s"$variable in $stateName has received InformValue")
if (debug) println(s"$variable in $stateName has received InformValue and stahes it")
stash
stay using mind
}
......@@ -117,18 +119,20 @@ class AgentBehaviour(variable: Variable,
when(WaitingForRole){
case Event(InformDelta(_), mind) => {
if (debug) println(s"$variable in $stateName has received InformDelta and stashed it")
stash
stay using mind
}
case Event(MakeOffer(_), mind) => {
if (debug) println(s"$variable in $stateName has received MakeOffer and stashed it")
stash
stay using mind
}
// When it receives an InformValue
case Event(InformValue(_),mind) =>
if (debug) println(s"$variable in $stateName has received InformValue")
if (debug) println(s"$variable in $stateName has received InformValue and stashed it")
stash
stay using mind
......@@ -152,6 +156,7 @@ class AgentBehaviour(variable: Variable,
when(OffererWaitingValues){
case Event(InformDelta(_), mind) => {
if (debug) println(s"$variable in $stateName has received InformDelta and stashed it")
stash
stay using mind
}
......@@ -199,7 +204,7 @@ class AgentBehaviour(variable: Variable,
//when it receives a neighbour's delta
case Event(InformDelta(_), mind) =>
if (debug) println(s"$variable in $stateName has received InformDelta")
if (debug) println(s"$variable in $stateName has received InformDelta and stashed it")
stash
stay using mind
......@@ -239,6 +244,7 @@ class AgentBehaviour(variable: Variable,
// TODO When it receives a refusal from a peer which is not a potential partner
case Event(Reject(_), mind) if directory.variableOf(sender) != mind.partner.get =>
if (debug) println(s"$variable in $stateName has received Reject from a non-partner so it ignores it")
stay using mind
}
......@@ -249,7 +255,7 @@ class AgentBehaviour(variable: Variable,
// When it receives a reject it does NOTHING
case Event(Reject(_), mind) =>
if (debug) println(s"$variable in $stateName has received Reject")
if (debug) println(s"$variable in $stateName has received Reject and ignores it")
stay using mind
// When the context is partial
......@@ -272,7 +278,7 @@ class AgentBehaviour(variable: Variable,
// When it receives an offer it stashes it
case Event(MakeOffer(_), mind) =>
if (debug) println(s"$variable in $stateName has received MakeOffer")
if (debug) println(s"$variable in $stateName has received MakeOffer and stashes it")
stash
stay using mind
}
......@@ -283,6 +289,7 @@ class AgentBehaviour(variable: Variable,
when(ReceiverWaitingOffers) {
case Event(Reject(_), mind) => {
if (debug) println(s"$variable in $stateName has received Reject from a non-partner and ignores it")
stay using mind
}
......@@ -322,12 +329,12 @@ class AgentBehaviour(variable: Variable,
// When it receives a reject it does NOTHING
case Event(Reject(_), mind) =>
if (debug) println(s"$variable in $stateName has received Reject")
if (debug) println(s"$variable in $stateName has received Reject and ignores it")
stay using mind
// When it receives a neighbour's delta
case Event(InformDelta(_), mind) =>
if (debug) println(s"$variable in $stateName has received InformDelta")
if (debug) println(s"$variable in $stateName has received InformDelta and stashes it")
stash
stay using mind
......@@ -359,19 +366,21 @@ class AgentBehaviour(variable: Variable,
//when it receives its partner's giveGo
case Event(GiveGo, mind) => {
if (debug) println(s"$variable in $stateName has received GiveGo and stashes it")
stash
stay using mind
}
//when it receives its partner's giveGo
case Event(GiveNoGo, mind) => {
if (debug) println(s"$variable in $stateName has received GiveNoGo and stashes it")
stash
stay using mind
}
// When it receives a reject it does NOTHING
case Event(Reject(_), mind) =>
if (debug) println(s"$variable in $stateName has received Reject")
if (debug) println(s"$variable in $stateName has received Reject and ignores it")
stay using mind
// When it receives an offer it does NOTHING
......@@ -409,12 +418,12 @@ class AgentBehaviour(variable: Variable,
when(Uncommitted){
// When it receives a reject it does NOTHING
case Event(Reject(_), mind) =>
if (debug) println(s"$variable in $stateName has received Reject")
if (debug) println(s"$variable in $stateName has received Reject and ignores it")
stay using mind
// When it receives an offer it does NOTHING
case Event(MakeOffer(_), mind) =>
if (debug) println(s"$variable in $stateName has received MakeOffer")
if (debug) println(s"$variable in $stateName has received MakeOffer and ignores it")
stay using mind
// When it receives a neighbour's delta and the neighbourDeltas is partial
......@@ -496,13 +505,13 @@ class AgentBehaviour(variable: Variable,
// When its partner tells it to go
case Event(GiveGo(_), mind) =>
if (debug) println(s"$variable in $stateName has received GiveGo")
if (debug) println(s"$variable in $stateName has received GiveGo and stahes it")
stash
stay using mind
// When its partner tells it not to go
case Event(GiveNoGo, mind) =>
if (debug) println(s"$variable in $stateName has received GiveNoGo")
if (debug) println(s"$variable in $stateName has received GiveNoGo and stashes it")
stash
stay using mind
}
......
......@@ -15,9 +15,9 @@ import akka.actor.{Actor, ActorRef, FSM, Props, Stash, PoisonPill}
class Supervisor(val pb : DCOP, val algorithm: Algorithm, val initialContext: Context) extends Actor with Stash
with FSM[SupervisorState, SupervisorStatus] {
var debug = false
var debug = true
var debugState = true
var trace = false
var trace = true
var solver: ActorRef = context.parent // Reference to the distributed solver
var directory = new Directory() // White page for the peers
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment