From 89bfc665c2048d59569a4f2238bdd5af31d6ac6f Mon Sep 17 00:00:00 2001 From: Kagamihara Nadeshiko Date: Thu, 31 Aug 2023 00:00:54 -0700 Subject: [PATCH] A dirtier fix that solves the problem --- src/benchmark/FacilityLocation.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/benchmark/FacilityLocation.ts b/src/benchmark/FacilityLocation.ts index d8395e652..a82d7e558 100644 --- a/src/benchmark/FacilityLocation.ts +++ b/src/benchmark/FacilityLocation.ts @@ -293,7 +293,7 @@ export class Accumulator extends Reactor { toNextAccumulator = new OutPort(this); - constructor(parent: Reactor) { + constructor(parent: Quadrant) { super(parent); this.addReaction( @@ -308,7 +308,8 @@ export class Accumulator extends Reactor { this.fromSecondQuadrant, this.fromThirdQuadrant, this.fromFourthQuadrant, - this.writable(this.toNextAccumulator) + this.writable(this.toNextAccumulator), + parent.writable(parent.toAccumulator), ], function ( this, @@ -316,7 +317,8 @@ export class Accumulator extends Reactor { fromSecondQuadrant, fromThirdQuadrant, fromFourthQuadrant, - toNextAccumulator + toNextAccumulator, + parentToAccumulator, ) { // Reaction. if ( @@ -362,6 +364,14 @@ export class Accumulator extends Reactor { numQuadrantReactors + 1 // Add one for the quadrant reactor itself. ) ); + parentToAccumulator.set( + new ConfirmExitMsg( + numFacilities + 1, // Add one for the facility itself. + // (A quadrant with four children is considered as one facility in Akka-version implementation.) + numCustomers, + numQuadrantReactors + 1 // Add one for the quadrant reactor itself. + ) + ); } else { console.log( "Accumulator Error: some input ConfirmExitMsg's are undefined." @@ -621,12 +631,12 @@ export class Quadrant extends Reactor { ); // console.log(`Children boundaries: ${childrenBoundaries.get()[0]}, ${childrenBoundaries.get()[1]}, ${childrenBoundaries.get()[2]}, ${childrenBoundaries.get()[3]}`) - const accumulator = new Accumulator(thisReactor); + const accumulator = new Accumulator(thisReactor as Quadrant); const toAccumulatorOfQuadrant = ( toAccumulator as unknown as WritablePort ).getPort(); // Connect Accumulator's output to Quadrant's output. - this.connect(accumulator.toNextAccumulator, toAccumulatorOfQuadrant); + // this.connect(accumulator.toNextAccumulator, toAccumulatorOfQuadrant); const firstChild = new Quadrant( thisReactor,