[Twinsen] Circuit Network, Anything Vs Everything

Bugs that are actually features.
Post Reply
roy7
Filter Inserter
Filter Inserter
Posts: 334
Joined: Fri Dec 12, 2014 4:24 pm
Contact:

[Twinsen] Circuit Network, Anything Vs Everything

Post by roy7 »

In a MP game recently someone set up a smart train loading system but used the signal for "Anything" instead of "Everything". It turned out when all the chests were empty, instead of outputting 0 there was no output at all, so the system would deadlock (the inserters never run.)

I wasn't sure if the signal for "Anything" was supposed to be null instead of 0 when there is no input? The signal for "Everything" is 0 in that case, which is needed in the smart traing loading/unloading setups.

If this difference in behavior is not working as intended, then the bug report I'm making is that the Anything signal should output 0 if there are no inputs coming in.

Thanks.

Loewchen
Global Moderator
Global Moderator
Posts: 5702
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: Circuit Network, Anything Vs Everything

Post by Loewchen »

Please explain the condition, best with screenshots and upload the save file.

roy7
Filter Inserter
Filter Inserter
Posts: 334
Joined: Fri Dec 12, 2014 4:24 pm
Contact:

Re: Circuit Network, Anything Vs Everything

Post by roy7 »

Sure. We have a train loading setup with 24 chests. Using the "each" condition in the Combinator divided by -24:

Image

The inserters are wired to the combinator and the chest, with "Everything < 0", so they only fill if their chest is below the average:

Image

This works fine in all cases, but if the chests are all empty and the test is "Anything < 0" instead of "Everything < 0", then the inserters won't run. I ran into this since the person who set the station up used "Anything < 0" and when I was playing the map solo I noticed the inserters wouldn't run any more. Eventually I figured out it is because when I do smart loading myself, I use "Everything < 0" instead.

So to be more clear, is it working as intended or is it a bug that "Everything < 0" returns true with no input (as I hope is correct and lets this all run properly) but "Anything < 0" returns false.

Save game is attached if you want it. Train stop "Iron Ore 1" is where I'm at.
Attachments
sama.zip
(9.9 MiB) Downloaded 35 times

Tami
Fast Inserter
Fast Inserter
Posts: 141
Joined: Tue Nov 19, 2013 11:29 am
Contact:

Re: Circuit Network, Anything Vs Everything

Post by Tami »

You did a mistake with your circuit.

if you count all numbers, for example 24 chests with 0 content each, you get a sum of 0 for the content of all chests. Now you devide the 0 with -24, the result is, it keep 0.
Now you set the condition for start to a number below 0 (x < 0).

Its a logical mistake made by you.
If you want to get the circuit working, you should use a number above 0 like 0.1 or 1.

0 < 0.1 = true, circuit is running.
0 < 0 = false, circuit is not running

Btw actually circuits only the conditions <, >, =. But not >=, <=, <>.
In your case 0 <= 0 = true would best condition, but its not supported from game yet.

roy7
Filter Inserter
Filter Inserter
Posts: 334
Joined: Fri Dec 12, 2014 4:24 pm
Contact:

Re: Circuit Network, Anything Vs Everything

Post by roy7 »

I guess no signal counts as less than 0, because the design as demonstrated works fine as-is, but only with the "everything < 0" test. So perhaps "everything < 0" being true when there's no input is in fact a bug? Or maybe a hidden feature.

Ultimately it felt odd to me "everything < 0" and "anything < 0" have different behavior which is why I made this report.

Since this is now categorized as "not a bug" can someone confirm the different behaviors are in fact intended?

The specifics of the train stop working or not working isn't what I was reporting, it's just an example of a situation where the two tests provide different results. In contrast to what sounds like an obvious logical error, the design as shown works perfectly and the inserters will run when all chests are empty.

roy7
Filter Inserter
Filter Inserter
Posts: 334
Joined: Fri Dec 12, 2014 4:24 pm
Contact:

Re: Circuit Network, Anything Vs Everything

Post by roy7 »

I refined and simplified my test case to avoid confusion.

Wire a chest to two lights.

Set one light to "Everything > 10" and the other light to "Anything > 10".
Image
Image

(I just learned "Everything" means "Each individual item tested separately", not the combined count of all items.)

If you put 100 blocks into the chest, both lights are on.
Image

If you put a single block into the chest, both lights are off.
Image

However if the chest is empty, the "Everything > 10" is on while the "Anything > 10" is off.

Image

Why is "Everything > 10" True when the chest is empty? Granted this helps make smart train loading easier... but it feels like a bug to me.

Loewchen
Global Moderator
Global Moderator
Posts: 5702
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: Circuit Network, Anything Vs Everything

Post by Loewchen »

I reopen this, be it only for clarification.

Vin
Fast Inserter
Fast Inserter
Posts: 106
Joined: Sat Jun 21, 2014 2:46 pm
Contact:

Re: Circuit Network, Anything Vs Everything

Post by Vin »

roy7 wrote:Why is "Everything > 10" True when the chest is empty? Granted this helps make smart train loading easier... but it feels like a bug to me.
In my experience, Everything > 10 evaluates more like Nothing < 11.

roy7
Filter Inserter
Filter Inserter
Posts: 334
Joined: Fri Dec 12, 2014 4:24 pm
Contact:

Re: Circuit Network, Anything Vs Everything

Post by roy7 »

Vin wrote:
roy7 wrote:Why is "Everything > 10" True when the chest is empty? Granted this helps make smart train loading easier... but it feels like a bug to me.
In my experience, Everything > 10 evaluates more like Nothing < 11.
What a fantastic explanation. :)

Tami
Fast Inserter
Fast Inserter
Posts: 141
Joined: Tue Nov 19, 2013 11:29 am
Contact:

Re: [Twinsen] Circuit Network, Anything Vs Everything

Post by Tami »

If you connect a lamp with the red star without the source any other stuff, the result seems allways true, regardless of * < 0; * = 0; * > 0.

if you compare *nothing* with *anything*, that should be a null or a false, but not a true as it is.

ill do some test and show the result ...


Have finished my test:

The *everything* compared to *anything* is allways true, if the network has zero signals. If you have atleast 1 Signal, for example 5x wood, the comparation works as intended.

If it is a bug, that a no signal containing network sends allways true i dont know it, but i use it to keep my lights burning at daylight. If atleast 1 signal is inside the network, all is fine.


It seems NULL is TRUE instead of FALSE

Twinsen
Factorio Staff
Factorio Staff
Posts: 1095
Joined: Tue Sep 23, 2014 7:10 am
Contact:

Re: [Twinsen] Circuit Network, Anything Vs Everything

Post by Twinsen »

It's just the way the edge cases are handled.

If Everything > 10 means: if ALL the signals evaluated individually are > 10. If there are no signals, the condition is true by default, since IMO if you have no signals, all of them are > 10.
If Anything > 10 means: if ANY of the signals evaluated individually are > 10. If there are no signals, the condition is false by default, since IMO if you have no signals, there is no signal > 10.

If you think this makes no sense let me know. Out of all the solutions, I believe the way it works now makes most sense. Moving to not a bug, but I will continue reading the topic.

Pe334
Inserter
Inserter
Posts: 44
Joined: Thu Jun 16, 2016 4:00 pm
Contact:

Re: [Twinsen] Circuit Network, Anything Vs Everything

Post by Pe334 »

For us germans anything means ALLES and everything also means ALLES, try it on the google translator ;)
So mybe there is an understanding problem because we "think" in our language.

But for logic:
If everyone has 10$ then they can come into the disco, so if no one has money they can also come in ?!?

Vin
Fast Inserter
Fast Inserter
Posts: 106
Joined: Sat Jun 21, 2014 2:46 pm
Contact:

Re: [Twinsen] Circuit Network, Anything Vs Everything

Post by Vin »

Twinsen wrote:It's just the way the edge cases are handled.

If Everything > 10 means: if ALL the signals evaluated individually are > 10. If there are no signals, the condition is true by default, since IMO if you have no signals, all of them are > 10.
If Anything > 10 means: if ANY of the signals evaluated individually are > 10. If there are no signals, the condition is false by default, since IMO if you have no signals, there is no signal > 10.

If you think this makes no sense let me know. Out of all the solutions, I believe the way it works now makes most sense. Moving to not a bug, but I will continue reading the topic.
Thank you for the clarification. In my opinion evaluating true on a conditional that is not given input is counter-intuitive because the combinator is saying "yes, this thing is happening" with no information at all. However, it took me 1-2 minutes and a test setup to determine where my mistake was and I moved on with my circuits so I wasn't bothered much by the misunderstanding.

Twinsen
Factorio Staff
Factorio Staff
Posts: 1095
Joined: Tue Sep 23, 2014 7:10 am
Contact:

Re: [Twinsen] Circuit Network, Anything Vs Everything

Post by Twinsen »

Pe334 wrote:But for logic:
If everyone has 10$ then they can come into the disco, so if no one has money they can also come in ?!?
If 5 people out of 5 have 10$, EVERYONE can enter the disco.
If 4 people have 10$ one person has 1$, out of a total of 5 people, NOT EVERYONE can enter the disco.
If 0 people out of 0 people have 10$, EVERYONE(all the 0 people) the can enter the disco.

Vin
Fast Inserter
Fast Inserter
Posts: 106
Joined: Sat Jun 21, 2014 2:46 pm
Contact:

Re: [Twinsen] Circuit Network, Anything Vs Everything

Post by Vin »

Twinsen wrote:
Pe334 wrote:But for logic:
If everyone has 10$ then they can come into the disco, so if no one has money they can also come in ?!?
If 5 people out of 5 have 10$, EVERYONE can enter the disco.
If 4 people have 10$ one person has 1$, out of a total of 5 people, NOT EVERYONE can enter the disco.
If 0 people out of 0 people have 10$, EVERYONE(all the 0 people) the can enter the disco.
For clarity's sake shouldn't the signal be "nothing"?

As in, no one has less than $10, rather than everyone has greater than or equal to $10? It would eliminate the confusion of the "invisible" empty set while still retaining the exact same functionality.

I would prefer having both in all honesty, but not sure if that's on the table.

Loewchen
Global Moderator
Global Moderator
Posts: 5702
Joined: Wed Jan 07, 2015 5:53 pm
Contact:

Re: [Twinsen] Circuit Network, Anything Vs Everything

Post by Loewchen »

While the behavior might not be very intuitive, it certainly is the best for building a logic with it imo.

BenSeidel
Filter Inserter
Filter Inserter
Posts: 550
Joined: Tue Jun 28, 2016 1:44 am
Contact:

Re: [Twinsen] Circuit Network, Anything Vs Everything

Post by BenSeidel »

The issue here is the application of logic. In this case "Anything" is the existential quantifier "∃", said as "There exists at least one", and "Everything" is the universal quantifier "∀", said as "for all".

Now, ∀x∈{Signals}(P(x)) -> ∃x∈{Signals}(P(X)), except where the set of signals is empty.
in english:
If for all values in the set of Signals, the condition is true, then it's true implies that there exists at least one value in the set of signals that the condition is true, except where the set of signals is empty.

with the symbols defined:
If (∀)for all (x)values (∈)in ({Signals}) the set of Signals, (P(x)) the condition is true, then it's true (->) implies that (∃) there exists at least one (x) value (∈) in ({Signals}) the set of signals (P(X)) that the condition is true, except where the set of signals is empty.

This means that the factorio logic is correct. If you don't have any signals, the universal quantifier will produce true, because none of the items don't conform (double negative), while the existential quantifier fails, because it requires at least one signal to test before it could possibly return true.

Post Reply

Return to “Not a bug”

Who is online

Users browsing this forum: No registered users