Integer programming with binary variables in Solver - issue with constraint?

tyedye4

New Member
Joined
Sep 26, 2024
Messages
2
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I am learning to use Excel Solver with no prior exposure. I thought I was starting to understand it, until I started working on a problem with binary variables. The objective is to maximize the number of customers reached by selecting one or more websites to advertise on. The constraint is that the budget cannot exceed $10,000. Additionally, each customer can only be counted once regardless of how many websites they visited.

The dataset I'm working with has 53 rows of customers and 10 columns for websites. A customer who has visited a website will have a 1 in the column, 0 otherwise. Without sharing the whole spreadsheet, the layout appears as so. I thought by adding across the columns I could set a mutually exclusive constraint in Solver to prevent it from counting one customer multiple times, but it does not appear that I have set it up correctly. Using the below as an example, the formula I'm using to add the values in the row is in F6. My constraint is $F$6:$F$9 = 1. If I remove this constraint, Solver can produce a solution, except it's counting each customer multiple times (based on what each column is adding up to) and that's not quite what I need to do.

I would be very grateful for advice in how to approach this problem. Please let me know if there's any additional information that would be helpful.

BCDEF
Customer1234
10010=SUM(B2:B5)
21100
30101
 

Excel Facts

Which came first: VisiCalc or Lotus 1-2-3?
Dan Bricklin and Bob Frankston debuted VisiCalc in 1979 as a Visible Calculator. Lotus 1-2-3 debuted in the early 1980's, from Mitch Kapor.
Welcome to the Forum!

Based on the limited data posted, website 2 looks optimum (before we factor in the relative costs) as it reaches 2 out of 3 customers.

This analysis involves adding up each column. It's not clear why you're adding across the columns? Is it relevant to the calculation?
 
Upvote 0
Welcome to the Forum!

Based on the limited data posted, website 2 looks optimum (before we factor in the relative costs) as it reaches 2 out of 3 customers.

This analysis involves adding up each column. It's not clear why you're adding across the columns? Is it relevant to the calculation?

Thank you for the welcome. :)

I had it in my head that in order to force Solver to count each customer once and only once (even if they visited multiple websites, only one should be chosen), I would need to add across the row. The more I think about it, the more it doesn't make much sense and it doesn't seem to be working that way. I attached a preview of the full spreadsheet model.
 

Attachments

  • SpreadsheetPreview.png
    SpreadsheetPreview.png
    177.1 KB · Views: 10
Upvote 0
Here's what I think you're trying to do:

ABCDEFGHIJKL
1
2Website12345678910
3Cost$5.00$8.00$3.50$5.50$7.00$4.50$6.00$5.00$3.00$2.20
4Pick?0000010011
5
6Budget$10.00
7Total Cost$9.70
8Reach20
9
1081151013710767
11Customer
1211000111000
1320001101101
1430100101100
1540101100110
1650100101000
1760001100001
1870000110000
1981010101000
2091101110000
21100011000010
22111001101000
23121111111000
24130100000000
25140111010110
26150010001010
27160100101110
28171101000111
29181101100100
30191000010001
31200100011000
Sheet1
Cell Formulas
RangeFormula
B7B7=SUMPRODUCT(C4:L4,C3:L3)
B8B8=SUMPRODUCT(C10:L10,C4:L4)
C10:K10C10=SUM(C12:C31)
Named Ranges
NameRefers ToCells
solver_adj=Sheet1!$C$4:$L$4B7:B8
solver_lhs2=Sheet1!$C$4:$L$4B7:B8


1727657753393.png


This is not the optimum solution - you can reach 20 with a lower spend. I could be wrong (I don't use Solver myself, so I'll be happy to be corrected) but I don't think it's possible to set major and minor objectives, i.e. in this case:

Major: Maximise Reach (subject to Spend <= Budget), and
Minor: Minimise Spend (within Budget)

But you can get there with a second step - the optimum solution is to advertise in 5 and 10 at cost $9.20 for a reach of 20.

1727658166396.png
 
Upvote 0
Solution

Forum statistics

Threads
1,223,840
Messages
6,174,956
Members
452,593
Latest member
Jason5710

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top