(working code below)
I'm using NMaximize[] to solve an optimization problem comprising several projects with different costs. I have several constraints. When I solve for my variables as Elements in Reals I obtain a solution. When I change the domain to Integers (between 0 and 1) I get the following errors (mainly I get a 1/0 division error). Ideas? I'm not sure how to set starting conditions, etc., so I really don't know how to troubleshoot this.
Power::infy: Infinite expression 1/0 encountered
projCosts = {{40, 10, 20, 20, 0}, {65, 36, 30, 25, 30}, {6, 8, 10, 0,
0}, {20, 10, 20, 20, 0}}; yearlyFunds = {120, 40, 40, 55,
60}; totalPossibleFunds = {90, 65 + 36 + 30 + 25 + 30, 6 + 8 + 10,
20 + 10 + 20 + 20};
projScore = {.741, .845, .353, .457};
NMaximize[{projScore . {a, b, c,
d}, (projCosts[[#]][[1]] & /@ Range[Length[projScore]] . {a, b, c,
d}) <= yearlyFunds[[1]] && (projCosts[[#]][[2]] & /@
Range[Length[projScore]] . {a, b, c, d}) <=
yearlyFunds[[2]] && (projCosts[[#]][[3]] & /@
Range[Length[projScore]] . {a, b, c, d}) <=
yearlyFunds[[3]] && (projCosts[[#]][[4]] & /@
Range[Length[projScore]] . {a, b, c, d}) <= yearlyFunds[[4]] &&
0 <= a <= 1 && 0 <= b <= 1 && 0 <= c <= 1 &&
0 <= d <=
1 && ((totalPossibleFunds[[1]]*a +
totalPossibleFunds[[3]]*c)/(totalPossibleFunds[[1]]*a +
totalPossibleFunds[[3]]*c + totalPossibleFunds[[2]]*b +
totalPossibleFunds[[4]]*d)) <= 4/10}, {a, b, c, d} \[Element]
Integers]