Skip to content

Commit

Permalink
A dirtier fix that solves the problem
Browse files Browse the repository at this point in the history
  • Loading branch information
axmmisaka committed Sep 7, 2023
1 parent f6f3e39 commit 89bfc66
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions src/benchmark/FacilityLocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ export class Accumulator extends Reactor {

toNextAccumulator = new OutPort<ConfirmExitMsg>(this);

constructor(parent: Reactor) {
constructor(parent: Quadrant) {
super(parent);

this.addReaction(
Expand All @@ -308,15 +308,17 @@ 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,
fromFirstQuadrant,
fromSecondQuadrant,
fromThirdQuadrant,
fromFourthQuadrant,
toNextAccumulator
toNextAccumulator,
parentToAccumulator,
) {
// Reaction.
if (
Expand Down Expand Up @@ -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."
Expand Down Expand Up @@ -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<Msg>
).getPort();
// Connect Accumulator's output to Quadrant's output.
this.connect(accumulator.toNextAccumulator, toAccumulatorOfQuadrant);
// this.connect(accumulator.toNextAccumulator, toAccumulatorOfQuadrant);

const firstChild = new Quadrant(
thisReactor,
Expand Down

0 comments on commit 89bfc66

Please sign in to comment.