0

I have a problem that I want to solve but I cant figure out how to model it Before asking here I made research and find things that will help but I couldnt wrap my head around it. Example of problem I have below

So I have many items lets say 40, each item has 2 or 3 features and each feature is useful only if there are 3,4,5,... of them depending on feature.

Objective is getting max amount of different useful features with 10 different items

Example (feature a is useful if 3 or more different items include a, feature b is useful if 5 or more different items include b, c 8 or more items etc)

Items   Features (a,b,c,...)
item1   a,c,d
item2   a,b
item3   a,b,e,
item4   a,c
item5   b,e,f
item6   b,d,e
item7   b,c,d
item8   c,f
item9   c,d,e
item10  d,f
...     ...

one example combination

item1+item2+...+item10 = a(3), b(5) 

so a and b useful features (c is not useful because there are 5 we need 8 to make it useful)

I think I want to model a mixed integer linear program and solve it with a branch and bound solver The objective is the number of features weight for each item and each feature(?) I thought about modelling this as knapsack problem but then I couldnt figure out how to apply this like capacity is 10 but value and weight? there is min requirement for features to be useful, I need some guidance or general algorithm to confront this problem, I can investigate further if I have something to start with

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343

1 Answers1

2

My approach would be:

Step 1: Develop mathematical model

Get a piece of paper and write down a mathematical model. E.g.:

Data:

 a(i,f) = 1   if item i has feature f
          0   otherwise
 K(f)   = number of items with feature f needed to be useful
 N      = number of items to select

Binary Variables:

 x(i) = 1    if item i is selected
        0    otherwise

 u(f) = 1    if feature f is useful in selection
        0    otherwise

Model:

  maximize sum(f,u(f))
  subject to 
       sum(i,x(i)) = N
       u(f)*K(f) <= sum(i, a(i,f)*x(i))   for all f

Step 2: implementation

This should now be trivial. Which is the purpose of first writing down the mathematical model.

Erwin Kalvelagen
  • 15,677
  • 2
  • 14
  • 39