any way to 'load balance' items properly between 2 or more machines?

Discussion in 'Mod Discussion' started by steve g, Oct 29, 2013.

  1. steve g

    steve g New Member

    been scratching my head on this one for a bit and not sure how to go about it.

    i need a setup where wood from a tree farm is *evenly* distributed between a couple of cyclic assemblers. the catch: the wood comes in stacks (up to 64) and i need those split up evenly.

    dont say bc pipes, they pick destinations at random and they dont split stacks
    dont say factorization routers, same thing..they dont split stacks

    and it has to be fast...fast enough it wont vomit wood blocks all over the map. theres gotta be something that can do this...
     
  2. Vicerious

    Vicerious New Member

    Too bad, BC pipes are still the answer :p

    Use wooden transport pipes powered by either redstone engines or autarchic gates it extract items from an inventory one at a time. If you need more speed, use multiple wooden pipes attached to the different faces of the source inventory and join their outputs to a single iron pipe. You can increase output speed further by either using multiple source inventories or transvector interfaces to attach more woodent pipes.

    For example, if your source inventory is an ME interface set to export logs, you could attach up to 11 wooden transport pipes to it - 5 on the ME interface itself and 6 more on a transvector interface bound to it. You could then combine the outputs of those with 3 iron pipes into a single main line. You may want to use a diamond pipe to distribute to your machines as a sort of "reverse" iron pipe.

    With a large number of items passing quickly through the system, random distribution is exactly the same as even distribution. If the probability to use any given output is the same between all outputs, it is even distribution for all practical purposes.
     
  3. draeath

    draeath New Member

    Random does not work that way. It will not be evenly distributed, because you can't have randomness and even distribution at the same time!

    I'm interested in a proper answer to this one as well...
     
  4. Loufmier

    Loufmier New Member

    i can't remember any round robin solutions but closest would be LP with supplier pipes.
    you can also try installing additional buildcraft objects, which add distribution pipe, which splits passing through items in set proportions to set sides.
     
  5. Vicerious

    Vicerious New Member

    Of course random works that way. If you have 1000 items moving through a system with a 50% chance of ending up in one of two chests, each chest is going to end up containing very close to 500 items each, The more items that pass through, the closer the numbers get to perfect. The margin of error will get vanishingly small after processing only a few dozen stacks of materials.

    This is math. For any practical purpose, for a large number of items, random distribution (where all chances are equal, as in the outputs of a diamond pipe) is the same as even distribution.
     
  6. draeath

    draeath New Member

    Such an even distribution does not happen unless you are approaching an infinite sample size.
     
    Loufmier likes this.
  7. Loufmier

    Loufmier New Member

    random blows. period. even if it`s 50/50.
     
  8. Vicerious

    Vicerious New Member

    Which is why I made a point of talking about practical purposes and margins of error. With the high volume output of a sizeable tree farm, for example. you'll get to "close enough" even distribution fairly quickly.

    But if the distribution of items must be absolutely even at all times, then another solution is necessary.
     
    TaintedHorizon likes this.
  9. draeath

    draeath New Member

    Something to consider VIcerious... you know for a fact Minecraft is not using a true RNG. Most people don't have the thousands of dollars those cost just laying around.

    Minecraft is using a pRNG, which will not produce random numbers.

    Thus, even distribution is not guaranteed or even that likely. In fact over time the distribution may get worse!
     
  10. MigukNamja

    MigukNamja New Member

    Brute-force would be a turtle.

    Code:
    -- above
    function place_1()
      turtle.dropUp()
    end
     
    -- below
    function place_2()
      turtle.dropDown()
    end
     
    -- left
    function place_3()
      turtle.turnLeft()
      turtle.drop()
      turtle.turnRight()
    end
     
    -- right
    function place_4()
      turtle.turnRight()
      turtle.drop()
      turtle.turnLeft()
    end
     
    -- behind
    function place_5()
      turtle.turnRight()
      turtle.turnRight()
      turtle.drop()
      turtle.turnLeft()
      turtle.turnLeft()
    end
     
    args = {...}
    while 1 do
      for i=1,args[1] do
     
        while not turtle.suck() do
          sleep(1)
        end
    
        if i == 1 then
          place_1()
        elseif i == 2 then
          place_2()
        elseif i == 3 then
          place_3()
        elseif i == 4 then
          place_4()
        elseif i == 5 then
          place_5()
        end
      end
    end
    The above Lua code is not tested. But, it gives a very good idea of how you could use a turtle with 1 input container and up to 5 output containers in a round-robin fashion.
     
  11. Shirkit

    Shirkit New Member

    This has no impact or whatsoever, since pseudo random numbers, in practical terms, will be output random results. Once you guarantee that different seeds feeds this algorithm, you'll be ok.

    The result from the pRNG and a real random algorithm will tend to closeness, which is enough for every day applications.

    If you need to guarantee even distribution, just use a round robin pipe, no need for randomness.

    But as said, if you have a really large input of items, and you are just smelting stuff, you can go by with regular pipes. Sometimes items may spit out, just put a 2 or 3 layer depth of distribution and your problems should be solved.
     
  12. Wekmor

    Wekmor New Member

    One of the easiest ways would be Translocators I think :b
     
    angelnc likes this.
  13. Shirkit

    Shirkit New Member

    Would give the same result as the BC pipes. It goes randomly, so for an infinite amount of items it will be even, but besides that, it won't. The maximum discrepancy I've noticed using pipes was a surplus of 10 items in the other side.
     
  14. Skullywag

    Skullywag New Member

    Wait for Thermal Expansion 3:



    ;)

    Edit - also doesnt Additional Buildcraft Objects have a round robin pipe.
     
  15. Wekmor

    Wekmor New Member

    Yeah I just realised it, I always thought they would distribute evenly tho :O
     
  16. zilvarwolf

    zilvarwolf New Member

    I haven't messed with the cyclic assemblers much, and, of course, am not sure of how your project is working or how fast they operate, but maybe you could use translocators in the mode that keeps a certain number of items in the receiving side? Say...10, or whatever. That way those resources will be kept at a static level and then replenished as used. Even distribution might be more maintainable that way?
     
  17. SynfulChaot

    SynfulChaot New Member

    IIRC, there are round-robin pipes from Additional Buildcraft Objects if you're running DW20's FTB pack. That should do exactly what you want.
     
  18. zilvarwolf

    zilvarwolf New Member

    I tested the translocator idea last night. Again...not sure of your setup or if it's applicable, but the diamond nugget modifier (it was mentioned in DW's mod spotlight, but I didn't see it on the translocators website) allows you to put them into supplier mode. Without knowing more particulars or testing it, that might handle your even distribution problem.
     
  19. angelnc

    angelnc New Member

    I think Translocators always distribute evenly if there are multiple outputs. The Diamond Nugget is only there to put it in supply mode.
     
  20. Golrith

    Golrith Over-Achiever Trusted User

    I'd say Translocators. Use one for each machine, and tell it to always keep a certain amount of stock in the machine. Then it's all down to the speed of the machine if it splits evenly.
    Seriously though, I can think of no need to ensure an unlimited supply of a material is always split to an exact level.
     

Share This Page