Teep

195 Reputation

5 Badges

16 years, 94 days

MaplePrimes Activity


These are replies submitted by Teep

Hi again.

The procedure you sent worked fine.

However, I need to alter the first constraint to account for a realistic situation. This involved switching the order of i and j.  I get an error message to adjust the feasibility tolerance; when I try to do that, I am prompted to alter the depth limit. I have tried various values .... with no luck (worksheet is uploaded).


 

``

 

 

restart; with(Optimization)

m := 9;

9

 

9

 

3

(1)

 

dist := Matrix(m, n, [[0, 720, 790, 297, 283, 296, 461, 769, 996], [720, 0, 884, 555, 722, 461, 685, 245, 1099], [790, 884, 0, 976, 614, 667, 371, 645, 219], [297, 555, 976, 0, 531, 359, 602, 715, 1217], [283, 722, 614, 531, 0, 263, 286, 629, 721], [296, 461, 667, 359, 263, 0, 288, 479, 907], [461, 685, 371, 602, 286, 288, 0, 448, 589], [769, 245, 645, 715, 629, 479, 448, 0, 867], [996, 1099, 219, 1217, 721, 907, 589, 867, 0]]):

 

d := Vector([2870000, 572000, 8450000, 350000, 901000, 333000, 306000, 723000, 610000]):

To minimize the objective function, z:

z := add(add(dist[i, j]*d[j]*Y[i, j], j = 1 .. n), i = 1 .. m):

The first constraint is:

for j to n do constraint[j] := add(Y[i, j], i = 1 .. m) = 1 end do;

Y[1, 1]+Y[2, 1]+Y[3, 1]+Y[4, 1]+Y[5, 1]+Y[6, 1]+Y[7, 1]+Y[8, 1]+Y[9, 1] = 1

 

Y[1, 2]+Y[2, 2]+Y[3, 2]+Y[4, 2]+Y[5, 2]+Y[6, 2]+Y[7, 2]+Y[8, 2]+Y[9, 2] = 1

 

Y[1, 3]+Y[2, 3]+Y[3, 3]+Y[4, 3]+Y[5, 3]+Y[6, 3]+Y[7, 3]+Y[8, 3]+Y[9, 3] = 1

 

Y[1, 4]+Y[2, 4]+Y[3, 4]+Y[4, 4]+Y[5, 4]+Y[6, 4]+Y[7, 4]+Y[8, 4]+Y[9, 4] = 1

 

Y[1, 5]+Y[2, 5]+Y[3, 5]+Y[4, 5]+Y[5, 5]+Y[6, 5]+Y[7, 5]+Y[8, 5]+Y[9, 5] = 1

 

Y[1, 6]+Y[2, 6]+Y[3, 6]+Y[4, 6]+Y[5, 6]+Y[6, 6]+Y[7, 6]+Y[8, 6]+Y[9, 6] = 1

 

Y[1, 7]+Y[2, 7]+Y[3, 7]+Y[4, 7]+Y[5, 7]+Y[6, 7]+Y[7, 7]+Y[8, 7]+Y[9, 7] = 1

 

Y[1, 8]+Y[2, 8]+Y[3, 8]+Y[4, 8]+Y[5, 8]+Y[6, 8]+Y[7, 8]+Y[8, 8]+Y[9, 8] = 1

 

Y[1, 9]+Y[2, 9]+Y[3, 9]+Y[4, 9]+Y[5, 9]+Y[6, 9]+Y[7, 9]+Y[8, 9]+Y[9, 9] = 1

(2)

constraint1 := `union`(`union`(`union`(`union`(`union`(`union`(`union`(`union`({constraint[1]}, {constraint[2]}), {constraint[3]}), {constraint[4]}), {constraint[5]}), {constraint[6]}), {constraint[7]}), {constraint[8]}), {constraint[9]}):

The second constraint is:

constraint2 := {add(X[i], i = 1 .. m) = p}:

The third constraint is:

constraint3 := {seq(seq(Y[i, j] <= X[j], i = 1 .. m), j = 1 .. n)}:

The constraints (4 and 5) require binary outputs; zero or one.  This is automatically accounted for, so removed, since all variables will be assumed binary.

Thus, the consolidated constraints are:

 

constraints := `union`(`union`(constraint1, constraint2), constraint3):

 

The minimized solution is:

z[min] := LPSolve(z, constraints, assume = binary)

Error, (in Optimization:-LPSolve) no feasible integer point found; use feasibilitytolerance option to adjust tolerance

 

``

 

 

 

NULL


 

Download Feasibility_Tolerance.mw

Could you suggest any possible fixes?

Thanks in advance.

@ 

Many thanks!

@vv 

I appreciate the guidance - I'm obliged. I did post the worksheet .... thanks again..

@brian bovril 

Many thanks for the response and effort.

However, the link to the solution is incomplete (I get a blank Word document!).

Would you please re-send the .mws file?

First 7 8 9 Page 9 of 9