Giter VIP home page Giter VIP logo

cowoptimisation's Introduction

#Approach to problem For a section of consecutively occupied boxes, no cuts are obviously the cheapest way to go. I.e. if all boxes were occupied, the cheapest way would be to cut the plank only once, at the end. This is not the case though so we have to look at what happens with empty boxes.

Imagine that we step through the shed as an array in our mind, box by box. In order to step to the next box we must pay a certain cost given by the current box. The cost to leave an occupied box is that of 2m wood. The cost to leave an empty box is either that of 2m wood or the price of a cut. How do we decide what cost to choose here?

If we step through the boxes and find an unoccupied one, we have found a gap of size 1. If we find that the next one is empty as well, we have a gap of size 2. This gap size is important because it will give us a threshold where it will be cheaper to cut than to fill the gap with plank. If the gap is so wide that the price of cutting is lower than that of filling it with plank, we choose the former.

E.g. in the example case, a gap of size 2 is cheaper to cut than to fill so the lowest price is โ‚ฌ40 (2 cuts and 20m of plank)

#Code In solution.js, you will find the code that performs the price minimisation. app.js is mostly jQuery that makes use of the solution but also allows to set custom prices and shed layouts.

#App Here is the app

cowoptimisation's People

Contributors

davidnaas avatar

Watchers

 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.