Skip to content
Snippets Groups Projects
Commit bfcdc118 authored by Jean-Christophe Routier's avatar Jean-Christophe Routier
Browse files

update isTerminated with increasing objective

parent bb989286
Branches
No related tags found
No related merge requests found
......@@ -134,7 +134,9 @@ class Supervisor(val pb : DCOP, val algorithm: Algorithm, val initialContext: Co
previousObj = status.previousObj,
isFirstRound = false)
if (! updatedStatus.isTerminated){// If the solving must be restart for another round
val newObjectiveValue = pb.objective(updatedStatus.assignment)
if (! updatedStatus.isTerminated(newObjectiveValue)){// If the solving must be restart for another round
pb.variables.foreach { anyVariable: Variable =>
if (trace) println(s"Supervisor -> $anyVariable : ContinueAlgo")
directory.addressOf(anyVariable) ! ContinueAlgo
......@@ -149,7 +151,7 @@ class Supervisor(val pb : DCOP, val algorithm: Algorithm, val initialContext: Co
directory.addressOf(anyVariable) ! Query
}
if (trace) println(s"Supervisor -> self : StopAlgo")
updatedStatus = updatedStatus.updateObjectiveValue(pb.objective(status.assignment))
updatedStatus = updatedStatus.updateObjectiveValue(newObjectiveValue)
self ! StopAlgo
}
goto(Deciding) using updatedStatus
......
......@@ -41,7 +41,7 @@ class SupervisorStatus(val readyVariables: Set[Variable] = Set(),
* Returns true if the algorithm ends
* @todo modify it
*/
def isTerminated : Boolean = Supervisor.incrementCounter() > Supervisor.NB_ROUNDS
def isTerminated(newObjectiveValue : Double) : Boolean = newObjectiveValue > previousObj
/*Returns the updated supervisor's status when resetting the context*/
def resetContext(): SupervisorStatus = {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment