i have a combinatorial optimization problem.
I have X bids containing a price and n rows. The price is the total price for these n rows. n can be between 1 and 12. All rows have a number attached (1-12). This means all in all there are 12 different rows. A bid can never have the same row twice. I can either accept a bid or decline it. It is not possible to somehow divide the bid into two (or more).
Now I have a Bit array with a length of 12 Bits telling me for each and every row if I need that row or not.
What I want is to calculate the cheapest possible allocation for the rows that I need. Having a headache I am not able to solve this problem at the moment. Maybe one of you guys can help me a little.
Here my simple Bid class:
public class Bid {
private int price;
private int[] rows; // e.g. rows[0] = 3 means this bid contains row 3
private int connectionID;
public Bid(int price, int[] rows, int connectionID) {
super();
this.price = price;
this.rows = rows;
this.connectionID = connectionID;
}
public int getPrice() {
return price;
}
public int[] getRows() {
return rows;
}
public int getConnectionID() {
return connectionID;
}
}
Thanks a lot!
Ps.: The ConnectionID helps me to identify the Bids.