doomeer / factorio

Factorio Planner
MIT License
136 stars 39 forks source link

Inline optimization helpers #21

Open ELLIOTTCABLE opened 7 years ago

ELLIOTTCABLE commented 7 years ago

Although it's something of a major feature, and I don't know if you'll have time to get to it,

One of the primary uses to which I put your planner, is figuring out the answer to a question like “how many of will most-fully-utilize ”, or associatedly, “how much of do I need to satisfy ”?

A couple examples:

  1. Let's say I'm producing science packs. I can look at that planner, and see that my naïve consumption-rate entries (0.33 red and green, 0.25 blue and military) have produced a need for 1.054 assembler's worth of electronic circuits.

    This is obviously not ideal: I could build 2.0 assemblers' worth of circuit-production, and then just allow the capacity to go unused, or stored, or something similar; but that's not why I open up the Planner, is it?

    In this situation, I'd manually scan through the list of non-shared consumers,¹ looking for the an ideal consumer to reduce ever-so-slightly, to reduce my planned consumption to a precise integer usage of circuit-assemblers (producing this, or similar).

  2. How about belts and inserters?

    In addition to precisely the issue described above with electronic circuits, here, I have the inverse issue as well: I'm utilising 2.9 blue assemblers to produce gears, shared amongst a whole host of consumers down-stream.

    In this case, basically all of the consumers are also not fully utilized — the Inserter assembler is only at 0.3, the Belt at 0.125, and Fast Underground Belt at 0.017 … you get the idea. Here, the ideal situation would simply be to place all three Assemblers for gears, and then feed them enough iron plates to run at full speed.


In both of the above cases, the Planner is basically lying to me, because it can't fully understand the situation. Making it smart enough to solve for the above situations is almost certainly out-of-scope for the project,² so here's what I'd suggest instead:

Add an inline optimization button to each line-item, that when clicked, will add additional information to the rest of the production-schedule, detailing the effects of maximizing/minimizing the selected line-item.

screen shot 2017-06-13 at 14 41 41

For instance: clicking next to the shared Electronic Circuits in that first situation, might produce something like this, on the production-schedule below:

screen shot 2017-06-13 at 14 54 34

And in the second situation, next to the shared Gears assembler would show corresponding additional “what-if” values (that I'm way too lazy to calculate by hand and smush into the HTML output for a screenshot 🤣), which would indicate to me how much more steel and copper and such I could feed the overall production-line to maximise its output, before I'd need an additional Gear assembler to satisfy all the downstream consumers.


Footnotes

ELLIOTTCABLE commented 7 years ago

Phew! I hope this monster of an Issue came across clearly. I'm a big GitHub user, so I'll definitely be active in this thread, if you wish to clarify my thoughts.

Your (unpaid, under-appreciated) work on this tool is greatly appreciated; keep up the good work! (Also, you should consider soliciting donations in the helptext. 😇)

doomeer commented 7 years ago

Thanks for such a well-presented post! I especially appreciate the screenshots, they really help to understand :)

I like the idea of presenting two scenarios next to each other, and I like the idea of clicking a button to quickly create a scenario by rounding up or down. Then it's just a matter of combining the two, if I understand correctly.

It might clutter the tool a little bit though, and it's not very easy to implement. If anybody reads this, please comment on whether you would find this helpful :)

I assume you are aware that you can query for, say, "b1" science packs so that the planner computes the production such that you use exactly one blue assembly machine? ("b" stands for "the second best machine") It may not be as friendly as clicking an arrow, though.

ELLIOTTCABLE commented 7 years ago

So, the problem with that, is that that's additive — if the recipe requires 1.09 level-2 assemblers producing gears, and I use b2 as input, then I've now got a production-schedule suggesting 3.09 level-2 assemblers for gears. 🤣

That does suggest another implementation for the second situation though (“ceiling” instead of “floor”) — something like a second checkbox next to each ‘shared’ resource, indicating whether the inputted value is intended to be additive, or total (i.e. whether b2 in the text-field for a shared resource means “add two more blue assemblers' worth” or “add enough to existing inputs to make the total exactly two blue assemblers”.)

That'd almost certainly be easier to implement, so I'm all for it — although it doesn't solve the opposite situation, when you want to floor / restrict the input; and it doesn't provide the other benefits of the dual-planning/realtime-feedback functionality described above, so if that's something you want to do, maybe it needs a new Issue?

(Oh, and voting-style feedback on GitHub is easiest if visitors use the +😀 button to leave a :+1: — that saves everyone an e-mail! Some projects use a “waiting on community feedback” or “needs voting” label on open issues that are out-of-scope or awaiting further input, too.)

doomeer commented 7 years ago

Oh I see! You're right, "b2" is not very useful for shared resources. Adding a checkbox would probably complexify the interface too much. Maybe if a shared resources contains "b2" the planner should just consider that the shared total value should be "b2". That would need modifying the algorithm because now we would probably need to solve some kind of equation system. So probably your original idea is better ;)

Thanks for the remark about GitHub, I'll let users click on this button!