diff --git a/src/main/scala/org/scadcop/solver/decentralized/agent/VariableAgent.scala b/src/main/scala/org/scadcop/solver/decentralized/agent/VariableAgent.scala index d6a308bec62b48af4158bd11a3e370034d1cbca9..fdb54478f53f440eef934e78fdcade7d47ace97f 100755 --- a/src/main/scala/org/scadcop/solver/decentralized/agent/VariableAgent.scala +++ b/src/main/scala/org/scadcop/solver/decentralized/agent/VariableAgent.scala @@ -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 diff --git a/src/main/scala/org/scadcop/solver/decentralized/mgm2/AgentBehaviour.scala b/src/main/scala/org/scadcop/solver/decentralized/mgm2/AgentBehaviour.scala index d88b44c6c7e8c316af0bf3207d6a1fd05a201af4..cc0ffcb4e1c3d2276eb2705047d638130412c535 100755 --- a/src/main/scala/org/scadcop/solver/decentralized/mgm2/AgentBehaviour.scala +++ b/src/main/scala/org/scadcop/solver/decentralized/mgm2/AgentBehaviour.scala @@ -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 } diff --git a/src/main/scala/org/scadcop/solver/decentralized/supervisor/Supervisor.scala b/src/main/scala/org/scadcop/solver/decentralized/supervisor/Supervisor.scala index c58beaf1dc1ae4b9f7ea164d3228136862710c78..1382b836478e60a81f1861268eddfd71ed929e51 100755 --- a/src/main/scala/org/scadcop/solver/decentralized/supervisor/Supervisor.scala +++ b/src/main/scala/org/scadcop/solver/decentralized/supervisor/Supervisor.scala @@ -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