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 fb92fb1e801177f7da1714a944af5594cae21175..d6a308bec62b48af4158bd11a3e370034d1cbca9 100755 --- a/src/main/scala/org/scadcop/solver/decentralized/agent/VariableAgent.scala +++ b/src/main/scala/org/scadcop/solver/decentralized/agent/VariableAgent.scala @@ -23,7 +23,7 @@ abstract class VariableAgent(val variable: Variable, val constraints: Set[Constraint]) extends Actor { var trace: Boolean = false var debug: Boolean = false - var debugState: Boolean = false + var debugState: Boolean = true var supervisor: ActorRef = context.parent var directory: Directory = new Directory() 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 3e17241558017280a20b10f6d96e8df1be1c7ac2..d88b44c6c7e8c316af0bf3207d6a1fd05a201af4 100755 --- a/src/main/scala/org/scadcop/solver/decentralized/mgm2/AgentBehaviour.scala +++ b/src/main/scala/org/scadcop/solver/decentralized/mgm2/AgentBehaviour.scala @@ -180,6 +180,7 @@ class AgentBehaviour(variable: Variable, directory.addressOf(potentialPartner) ! MakeOffer(offer) if (trace) println(s"$variable -> $potentialPartner : MakeOffer(${Some(offer)}") multicast(neighbours - potentialPartner, MakeOffer(new Offer(variable, List()))) + unstashAll goto(OffererMakingOff) using updatedMind // When it receives an offer, the agent rejects it @@ -455,6 +456,7 @@ class AgentBehaviour(variable: Variable, if (debug) println(s"$variable in $stateName has received Act(true) but has no move") if (trace) println(s"$variable -> Supervisor : I kept my previous value = InformValue(${mind.context.getValue(variable).get})") supervisor ! InformValue(mind.context.getValue(variable).get) + unstashAll goto(Continue) using mind // When it should not act because it does not have the highest delta in the neighbourhood @@ -462,6 +464,7 @@ class AgentBehaviour(variable: Variable, if (debug) println(s"$variable in $stateName has received Act(false)") if (trace) println(s"$variable -> Supervisor : I didn't change = InformValue(${mind.context.getValue(variable).get})") supervisor ! InformValue(mind.context.getValue(variable).get) + unstashAll goto(Continue) using mind } @@ -475,6 +478,7 @@ class AgentBehaviour(variable: Variable, if (debug) println(s"$variable in $stateName has received Act(false)") if (trace) println(s"$variable -> Supervisor : I didn't change = InformValue(${mind.context.getValue(variable).get})") supervisor ! InformValue(mind.context.getValue(variable).get) + unstashAll goto(Continue) using mind // When it receives its own acting decision and should act @@ -487,6 +491,7 @@ class AgentBehaviour(variable: Variable, } if (trace) println(s"$variable -> ${partner} : GiveGo($move)") directory.addressOf(partner) ! GiveGo(move) + unstashAll goto(HandlingPartnersGoNogo) using mind // When its partner tells it to go @@ -509,7 +514,7 @@ class AgentBehaviour(variable: Variable, // When it receives a Go from its partner case Event(GiveGo(move), mind) => - if (debug) println(s"$variable in $stateName has received Trigger") + if (debug) println(s"$variable in $stateName has received GiveGo") val newVal: Value = mind.updateVal(variable, move) val updatedMind: MGM2Mind = new MGM2Mind(context = mind.context.fix(variable, newVal), mind.isCommitted, mind.partner, @@ -518,6 +523,7 @@ class AgentBehaviour(variable: Variable, mind.metric) if (trace) println(s"$variable -> Supervisor : I'm changing = InformValue(${updatedMind.context.getValue(variable).get})") supervisor ! InformValue(updatedMind.context.getValue(variable).get) + unstashAll goto(Continue) using updatedMind // When it receives a NoGo from its partner @@ -525,6 +531,7 @@ class AgentBehaviour(variable: Variable, if (debug) println(s"$variable in $stateName has received GiveNoGo") if (trace) println(s"$variable -> Supervisor : I'm not changing = InformValue(${mind.context.getValue(variable).get})") supervisor ! InformValue(mind.context.getValue(variable).get) + unstashAll goto(Continue) 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 c8181c6501a07ecd8e17015a0cd208d27da75720..c58beaf1dc1ae4b9f7ea164d3228136862710c78 100755 --- a/src/main/scala/org/scadcop/solver/decentralized/supervisor/Supervisor.scala +++ b/src/main/scala/org/scadcop/solver/decentralized/supervisor/Supervisor.scala @@ -16,7 +16,7 @@ class Supervisor(val pb : DCOP, val algorithm: Algorithm, val initialContext: Co with FSM[SupervisorState, SupervisorStatus] { var debug = false - var debugState = false + var debugState = true var trace = false var solver: ActorRef = context.parent // Reference to the distributed solver