-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port dependency/precedence logic when adding a mutation #223
Comments
Here's an example, a fix which makes Prof. Dr. @hokeun 's Online Facility Location benchmark working: (See diff for more info) The corresponding runtime graph are as follow: Not working graph
0["facilityLocation.0c4e7357[R0]"]
1["facilityLocation.0c4e7357[M0]"]
2["facilityLocation.0c4e7357[M1]"]
3["facilityLocation.0c4e7357.InPort"]
4["facilityLocation.0c4e7357.OutPort"]
5["facilityLocation.0c4e7357.OutPort"]
6["facilityLocation.0c4e7357.OutPort"]
7["facilityLocation.0c4e7357.OutPort"]
8["facilityLocation.0c4e7357.OutPort"]
9["facilityLocation.0c4e7357.OutPort"]
10["facilityLocation[M0]"]
11["facilityLocation.0c4e7357.866cd7ec.OutPort"]
1 --> 0
10 --> 1
0 --> 2
3 --> 2
2 --> 4
2 --> 5
2 --> 6
2 --> 7
2 --> 8
2 --> 9
11 -- "Problem here" --x 9
Error:
Working, but there's big error because we are only writing to it: graph
0["facilityLocation.78c27ce7[R0]"]
1["facilityLocation.78c27ce7[M0]"]
2["facilityLocation.78c27ce7[M1]"]
3["facilityLocation.78c27ce7.InPort"]
4["facilityLocation.78c27ce7.OutPort"]
5["facilityLocation.78c27ce7.OutPort"]
6["facilityLocation.78c27ce7.OutPort"]
7["facilityLocation.78c27ce7.OutPort"]
8["facilityLocation.78c27ce7.OutPort"]
9["facilityLocation.78c27ce7.OutPort"]
10["facilityLocation[M0]"]
11["facilityLocation.78c27ce7.bdba16f9.OutPort"]
1 --> 0
10 --> 1
0 --> 2
3 --> 2
9 --> 2
2 --> 4
2 --> 5
2 --> 6
2 --> 7
2 --> 8
11 --> 9
This appears to be a bad example, as the issue is that the programme should not be written this way (that is, both could affect the |
Thanks for bringing this up! Trying to understand the issue better, could you elaborate on what you meant by "the program should not be written this way" and what you meant by "both" that could affect the port? |
Sorry for my delayed reply. In the original code, in reactor-ts/src/benchmark/FacilityLocation.ts Lines 625 to 629 in b81e1ce
and the mutation ( reactor-ts/src/benchmark/FacilityLocation.ts Lines 757 to 763 in b81e1ce
I suppose, effectively, the first connection (which doesn't make much sense in the first place as it was connecting an My current ugly fix is simply replicate this logic without making any additional connection by accessing a parent port from children: in reactor-ts/src/benchmark/FacilityLocation.ts Lines 300 to 313 in 82d6e34
Then set both ports when one needs to be updated: reactor-ts/src/benchmark/FacilityLocation.ts Lines 359 to 374 in 82d6e34
I suppose this is not a good way to do it...... So I'm all ears |
Nevertheless, outside of |
This is a problem which troubled me for a while and I discovered it might potentially be a rather major issue.
When adding a mutation, it is necessary to declare ports. We declare a port as an argument, as things are set up currently, either as an
IOPort
or as aWritablePort
. They are, then, handled differently inrecordDeps
: either as dependency or precedence to the mutation.reactor-ts/src/core/reactor.ts
Lines 659 to 665 in f5c195f
reactor-ts/src/core/reactor.ts
Lines 689 to 695 in f5c195f
The issue is, they are able to be converted to one another inside of the mutation (by using
this.getReactor().writable(port)
, or(port as unknown as WritablePort<number>).getPort()
), and potentially create a causality loop. Unfortunately to do connection inside of a mutation, it appears thatIOPort
version is required, and if we want to connect AND write to a port then conversion is necessary (either pass in anWritablePort
and convert toIOPort
when connecting, or pass in anIOPort
and convert toWritablePort
).The text was updated successfully, but these errors were encountered: