Giter Club home page Giter Club logo

factorio-sat's People

Contributors

ignaloidas avatar r-o-c-k-e-t avatar raynquist avatar zatricky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

factorio-sat's Issues

Questions/Suggestions

Hi,

I read a little through the code and it seems like you're translating everything into CNF, which means you're potentially not using some of the more cutting edge solving techniques.

There are alternative approaches where, instead of writing a script in e.g., Python to generate clauses, you write your "constraints" into a language that is specifically designed to express those constraints. These languages are generally based on 1st order predicate logic. An example of such a system can be found here: https://potassco.org/doc/start/. There's other systems available, but not all of them are well-documented, since systems like these generally find no use outside of academia (yet :p).

The long and short of it is: there are constraint solving systems that allow you to write your clauses using not only boolean variables, but also constructs of other kinds, like numerical variables. The hope is that for the majority of the problems that deal with problems that feature numerical concepts (like grid coordinates), this extra expressive power allows a reasoner to more efficiently go through the search space.

If my assumptions above are correct, I'd take some time and prototype an encoding that could serve as an alternative. My time to spend on this is limited, so if you feel like me pointing you towards resources where you can learn this yourselves is more efficient, I could do that as well.

Question on how to use

Hi ! I have a very specific problem, I am trying to design a 8 to 12 balancer with an L shape and specifically placed outputs.
I decided to give a try to your project because I love the idea of it but I have trouble understanding how to use it,
I want to define exactly where my inputs and outputs are and let the algorithm find a solution from that,
Is it even possible ?

Thanks !

[Windows 10][Powershell][Python 3.9] UTF-8 BOM

Hi, im a using Windows 10 with Powershell and python3.9 and I have trouble with file encoding.
When saving/printing the app uses the 'utf-8-sig' encoding thus includes 2 bytes to specify the format (UTF-8 BOM).
But when reading utf-8 is assumed thus the parser fails.
Example with the README example :

python3.9.exe belt_balancer.py --fast --all networks/4x4 10 4 | python3.9.exe render.py

output :

pygame 2.1.2 (SDL 2.0.18, Python 3.9.13)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
  File "D:\GitHub\Factorio-SAT\render.py", line 547, in <module>
    solution = np.array(json.loads(input()), ndmin=2)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\json\__init__.py", line 335, in loads
    raise JSONDecodeError("Unexpected UTF-8 BOM (decode using utf-8-sig)",
json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)

I can make it work by replacing line 547

solution = np.array(json.loads(input()), ndmin=2)

with

solution = np.array(json.loads(input().encode().decode('utf-8-sig')), ndmin=2)

(fix found here : https://www.howtosolutions.net/2019/04/python-fixing-unexpected-utf-8-bom-error-when-loading-json-data/)

But this is more like a workaround and dont fix the root issue.

The problem appear every time the app tries to read a file it itself wrote, for example when using the --partial argument, I did not find a workaround for this one.

I tried to launch the app with WSL Debian for comparison but the pip installation fails for reasons I am still investigating.

Extending support to Space Exploration's Deep Space underground belts

Space Exploration adds "Deep Space Transport Belts," splitters, and underground belts, which are expensive end-game belts that operate at twice the speed of vanilla blue belts. There are 8 different colors of belts but the actual belt / splitter items are functionally equivalent / interchangeable. The underground belts however only link to their own color, so you can have multiple underground segments in the same linear space where they would otherwise conflict. Additionally the underground belt range is 17 tiles where blue belts are only 9.

As a proof of concept I manually shrunk an 8-8 balancer using the alternative colors.
Left: Traditional 8-8 balancer, not TU, color-coded for structure
Middle: Shortened version with matching colors
Right: re-colored with 2 colors.

image

I've forked the repo to explore the possibility of improving other balancer designs with new constraints for the additional colors. I'd love some guidance on where I might start, or if you foresee any large hurdles I might run into.

Finally, as a separate issue, I got an error when running an example from the readme. I ran calculate_optimal compute --threads 1 8 length and got ValueError: Wrong bound: 17 which I suspect is related to the DS belts. Thanks for any advice on this too!

Balancer solution longer than existing best

Hi, first off this project is amazing! During my testing I've found an output for the 8x3 balancer that is longer than what is in Raynquist's book. See the attached picture.

I can only guess why this might be, so I have some questions. Is Factorio-SAT exhaustive in its search of shorter balancers if it finds no solution? Or would this be a something to do with the constraints? Will Factorio-SAT allow a loop next to the exit belts like the current 8x3 best?

Thanks!

8x3_comparison

Allow perpendicular underground entrance/exit in front of empty splitter output

For balancers that contain empty splitter outputs (downsizing balancers), being able to place perpendicular underground entrance/exit next to such outputs is an important layout trick. The splitters are prevented from side-loading onto the undergrounds by setting output filters, thus preserving the desired 2-1 splitter behavior.

Here is an example 6-2 balancer that beats Factorio-SAT's solution:
image

The associated splitter output filters need not be in the program output; I can add them by hand.

Should this negatively impact performance, the functionality can be selectively enabled only for networks containing 2-1 splitters. Conversely, similar configurations involving empty splitter inputs can also be selectively disabled for networks that do not contain 1-2 splitters if doing so improves performance.

I have created 3000+ unique balancer network files (5.92 MB) ready for use by Factorio-SAT. Where should I publish them?

networks.zip
Most balancers of the type m-n where 1 <= m, n <= 64 are included in my files. I would have used Factorio-SAT to create blueprints for a blueprint book and exported that book to a string, but I couldn't even generate a blueprint for a single network because it was taking too long. So, I wish to share the network files so that if anyone wants to use them, they're available.

My balancer networks are not optimized to use the fewest number of splitters, but they are at least proven to have no throughput issues when not all of their inputs and outputs are used. For example, a 2-4 balancer that has exactly three splitters has throughput issues when feeding two input belts but using only two output belts that both come from the same splitter. My network file for the 2-4 balancer enables full throughput in that scenario. I think that's called UTU, but I may be mistaken.

Where should I publish the files so that others can make use of them? Separate repository? Would people be able to find that? I'd want them to be easy to find for anyone who's looking for them. Thanks!

I've attached a 2.77 MB compressed file to this issue so that they're at least sitting somewhere for now until it can be published to a better location.

3-2's solution not as good as 2-3's

FSAT generated a beautiful solution for 2-3. But for 3-2, which should simply be the reverse of 2-3 if nothing else, it generated a worse solution. I'm guessing undergrounds are not allowed in front of unused splitter outputs? There are a couple of underground orientations where such a layout should be allowed as no sideloading is actually occurring.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.