Coder Social home page Coder Social logo

project-sp22-skeleton's Introduction

Spring 2022 CS170 Project Skeleton

Requirements

A Python skeleton is available in the python subdirectory. The Python skeleton was developed using Python 3.9, but it should work with Python versions 3.6+.

Usage

Generating instances

To generate instances, read through python/instance.py, which contains a dataclass (struct) that holds the data for an instance, as well as other relevant methods. Then modify the python/generate.py file by filling in the make_{small,medium,large}_instance functions.

After you have filled in those functions, you can run make generate in the python directory to generate instances into the input directory.

To run unit tests, run make check.

Solving

We've created a solver skeleton at python/solve.py.

python3 solve.py case.in --solver=naive case.out

We've also created a skeleton that runs your solver on all cases and puts them in the output directory. To use it, modify python/solve_all.py to use your solver function(s). Then run

python3 python/solve_all.py inputs outputs

in the root directory.

Merging

To merge multiple output folders, taking the best solutions, see python/merge.py.

Visualizing Instances

To visualize problem instances, run python3 visualize.py, passing in the path to your .in file as the first argument (or - to read from standard input). To visualize a solution as well, pass in a .out file to the option --with-solution.

By default, the output visualization will be written as a SVG file to standard output. To redirect it to a file, use your shell's output redirection or pass in an output file as an additional argument.

For example, you could run

python3 visualize.py my_input.in out.svg

to create an out.svg file visualizing the my_input.in problem instance.

To visualize a solution file for this instance as well, you could run

python3 visualize.py my_input.in --with-solution my_soln.out out.svg

project-sp22-skeleton's People

Contributors

tylerhou avatar rahularya50 avatar tomtominator avatar

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.