C++ Math Exhaustive Search Algorithm Changes

This project was successfully completed by LiangXiaoJin for $700 USD in 10 days.

Get free quotes for a project like this
Project Budget
$250 - $750 USD
Completed In
10 days
Total Bids
Project Description

We currently have a c++ script (attached) that computes combinations of items (e.g., ice cream flavours). This job is to do 2 things:

1. Add 3 new rules that would change how many combinations are required to run, and also to calculate the results for different thresholds (currently it does this, but in one area, but not in another area).

2. Adjust the greedy chart to adapt to RT2, RT3, RT4, etc.

This script requires some understanding of combinatorics. Here is a decent website explaining the concepts (go down to the Combinations section). [url removed, login to view]

It runs thousands, sometimes billions of combinations, and it does it for hundreds or thousands of rows of data (i.e., different people's data), but we want to add 3 new rules that would change how many combinations need to be run.

Our script adapts to any number of items, but for simplicity, I will use 30C5 in my examples, which is a manageable number (142,506). This means you have 30 items to search among and want to find the optimal 5 items that produce the highest numbers.

-------------------- First Thing (3 rules to add to algorithm) ------------------------

Rule 1: Exclude

We want to be able to EXCLUDE an item from appearing in any combinations, so instead of calculating 30C5 (=142,506) combinations, then we only have 29C5 (=27,405) combinations to calculate. We have less items to try from among our total 30, that's why it only needs to try 29 now.

Rule 2: Force

We want to be able to FORCE an item to appear in all combinations. So instead of calculating 30C5 (=142,506) combinations, then we only have 29C4 (= 23,751) combinations to calculate. We have one more item required, so we search from one less and calculate one less (because that one is required to always be included).

Rule 3: Force X of Y

A bit more complicated than rule 2 above, we also want to be able to force, for example, 2 of the first 10, and 3 of the next 20. That would be 10C2 (=45) + 20C3 (= 1,140). It needs to be able to be broad enough that we could split it into up to 10 different buckets (or generally applicable, so we don't have 10 as a max, would be even better, but not required).

------------------------- Second Thing (adapting "greedy" algorithm) ------------------------

We want to adapt the script so that the "greedy chart" can be run based on RT2, RT3, RT4, etc.

To compute RT2 greedy chart, there are 2 steps:

1. Calculate the top combination for size 2 RT2 (using the other algorithm that already works).

2. Calculate the next best items of the remaining items at RT2 (same functionality as current greedy chart, but the first two items are calculated differently as per above)

The new greedy chart algorithms basically work the same as the current greedy chart algorithm except that RT2 starts with the top size 2 RT2 solution; RT3 starts with the top size 3 RT3 solution; etc.


The script is part of an online process where a CSV gets uploaded (2 example files are attached), the algorithm runs, and then the web page displays a bunch of the output and hosts other output files for download/review. It is a PHP Virtual Private Server, although I don't think that is relevant. You will need to explain to my web developer, who built the web user interface, how the changes to the parameters will work.

Completed by:

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online