Compute total possible configurations in R
I am looking for some help with finding an algorithm. I need to figure out how many possible configurations can be created using a list of resources for each configuration. Some configurations share resources, and some resources are unique to each configuration. For example, lets say I have 3 configurations (config1, config2, and config3 and resources A, B, C, D, E, F.
This table shows how many resources are in each configuration.
| Resources | Config1 | Config2 | Config3 |
|---|---|---|---|
| A | 0 | 1 | 3 |
| B | 1 | 4 | 2 |
| C | 3 | 2 | 0 |
| D | 1 | 1 | 2 |
| E | 0 | 0 | 3 |
| F | 6 | 6 | 6 |
And I have a table of the quantity on hand for each resource:
| Resource | On Hand |
|---|---|
| A | 20 |
| B | 100 |
| C | 35 |
| D | 44 |
| E | 67 |
| F | 90 |
I believe this is an optimization problem, but I am not sure how to set it up for a large number of configurations (e.g., 20-40) and resources (e.g., 5000). Excel has an optimization solver, but cannot handle all of the resources. Is there such an algorithm for R?
Edit in answer to @on_an_island, if I throw this example into Excel Solver, the solution is 11, 0, 3 for Config1, 2 and 3. I also get an answer of 5 of each if I do not require solver to make unconstrained variables non-negative.
However, that doesn't give me the maximum of each configuration. If I simply divide the quantity on hand by each resource for each configuration, then the result is 11, 15, and 6 for Configs 1-3.
| Resources | Config1 | Config2 | Config3 |
|---|---|---|---|
| A | NA | 20 | 6.667 |
| B | 100 | 25 | 50 |
| C | 11.667 | 17.5 | NA |
| D | 44 | 44 | 22 |
| E | NA | NA | 22.33 |
| F | 15 | 15 | 15 |
Comments
Post a Comment