Coder Social home page Coder Social logo

baskets's Introduction

This contains an implementation to calculate the optimum set of loans
given a comma-delimited input file of loans and loan sets in the following 
format:

loan id, loan amount, set id, set minimum, set maximum
...

USAGE:

The program should be invoked as:

build_loan_sets.rb -i <input file>

For example:

build_loan_sets.rb -i loan-basket-01.csv

and will generate a file loan-based-01.out.csv containing the allocations.

INPUT FILE FORMAT NOTES:

If there are more loans than sets (the usual case), then the
columns for loan sets should be empty; e.g.,

1004,183000,,,

If there are more sets than loans, then the CSV columns should just
be blank, e.g.:

,,14,2000000,4000000

MANIFEST:

README - this file
build_loan_sets.rb - the program
sample.rb - a sample script using the NP API
test.rb - a set of tests
extconf.rb - an internal program to build the NP API
mulknap.c - the underlying knapsack algorithm solution code
np.c - the bridge code between Ruby and mulknap.c
loan-basket-01.csv - a sample input dataset
loan-basket-01-out.csv - a sample output dataset

INSTALLATION:

- on a Unix system that has Ruby installed, installation is simply:
   ruby extconf.rb
   make

- on a Windows system, installation is essentially the same, but the
devkit package must be installed.  Somewhat detailed steps are:
1- install Ruby 1.8.7 to C:\Ruby (http://rubyforge.org/frs/download.php/72085/rubyinstaller-1.8.7-p302.exe)
2- install DevKit (http://rubyinstaller.org/add-ons/devkit/); note that
this will also need the 7-zip software: http://www.7-zip.org/
3- start a command shell
4- cd to the directory containing this file
5- run "ruby extconf.rb"
6- run "make"
7- you can then run "build_loan_sets.rb -i loan-basket-01.csv" to regenerate the sample output file.  If Windows complains that it cannot open the file build_loan_sets.rb, you can specify to use ruby in the invocation, i.e.,
  ruby build_loan_sets.rb -i loan-basket-01.csv



baskets's People

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

Forkers

dm03514

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.