## ams_version=1.0 Model Main_OilPipelineDesign { Comment: { "Oil pipeline design Problem type: MIP (medium) Keywords: Network object Description: We consider a given set of offshore platforms and onshore wells producing known amounts of oil to be connected to a port. Connections may take place directly between platforms, well sites, and the ports, or may go through connection points at given locations. The configuration of the network and sizes of pipes used must be chosen to minimize construction costs. References: Brimberg, J., P. Hansen, K. Lih, N. Mladenovic and M. Breton, An Oil Pipeline Design Problem, Operations Research 51(2) (2003), pp. 228-239." } DeclarationSection Model_Declarations { Set Platform { Index: i, j; Definition: { data { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 , 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33 } } } ElementParameter Port { Range: Platform; Definition: Last(Platform); } Set Predecessor { IndexDomain: (i); SubsetOf: Platform; Definition: { { j in Platform | j <> Port and Distance(j,i) } } } Set Successor { IndexDomain: (i); SubsetOf: Platform; Definition: { { j in Platform | Distance(i,j) } } } Set Pipe { Index: k; Definition: data { a, b, c, d, e, f }; } Parameter Distance { IndexDomain: (i,j); Definition: { data { ( 1 , 2 ) : 3.500, ( 1 , 3 ) : 1.900, ( 1 , 4 ) : 5.400, ( 2 , 1 ) : 3.500, ( 2 , 3 ) : 3.700, ( 2 , 7 ) : 1.150, ( 3 , 1 ) : 1.900, ( 3 , 2 ) : 3.700, ( 3 , 4 ) : 4.900, ( 3 , 5 ) : 2.500, ( 3 , 7 ) : 3.700, ( 3 , 33 ) : 4.800, ( 4 , 1 ) : 5.400, ( 4 , 3 ) : 4.900, ( 4 , 5 ) : 5.300, ( 4 , 6 ) : 4.000, ( 5 , 3 ) : 2.500, ( 5 , 4 ) : 5.300, ( 5 , 6 ) : 4.300, ( 5 , 8 ) : 2.700, ( 5 , 9 ) : 2.100, ( 5 , 33 ) : 3.000, ( 6 , 4 ) : 4.000, ( 6 , 5 ) : 4.300, ( 6 , 8 ) : 2.600, ( 7 , 2 ) : 1.150, ( 7 , 3 ) : 3.700, ( 7 , 33 ) : 1.600, ( 8 , 5 ) : 2.700, ( 8 , 6 ) : 2.600, ( 8 , 9 ) : 2.200, ( 8 , 10 ) : 2.200, ( 9 , 5 ) : 2.100, ( 9 , 8 ) : 2.200, ( 9 , 12 ) : 2.300, ( 9 , 33 ) : 1.600, ( 10, 8 ) : 2.200, ( 10, 11 ) : 2.000, ( 10, 13 ) : 2.800, ( 10, 33 ) : 5.300, ( 11, 10 ) : 2.000, ( 11, 12 ) : 1.100, ( 11, 13 ) : 1.800, ( 12, 9 ) : 2.300, ( 12, 11 ) : 1.100, ( 12, 13 ) : 2.500, ( 12, 14 ) : 1.200, ( 12, 33 ) : 3.000, ( 13, 10 ) : 2.800, ( 13, 11 ) : 1.800, ( 13, 12 ) : 2.500, ( 13, 14 ) : 2.100, ( 13, 16 ) : 3.200, ( 14, 12 ) : 1.200, ( 14, 13 ) : 2.100, ( 14, 15 ) : 1.200, ( 14, 16 ) : 5.300, ( 15, 14 ) : 1.200, ( 15, 16 ) : 6.300, ( 15, 17 ) : 2.100, ( 15, 33 ) : 1.650, ( 16, 13 ) : 3.200, ( 16, 14 ) : 5.300, ( 16, 15 ) : 6.300, ( 16, 17 ) : 4.800, ( 17, 15 ) : 2.100, ( 17, 16 ) : 4.800, ( 17, 24 ) : 2.700, ( 18, 19 ) : 1.500, ( 19, 17 ) : 7.300, ( 19, 18 ) : 1.500, ( 19, 20 ) : 1.800, ( 19, 21 ) : 0.900, ( 19, 23 ) : 3.000, ( 20, 19 ) : 1.800, ( 20, 21 ) : 1.300, ( 20, 26 ) : 2.200, ( 20, 29 ) : 4.800, ( 21, 19 ) : 0.900, ( 21, 20 ) : 1.300, ( 21, 22 ) : 2.500, ( 21, 23 ) : 2.800, ( 21, 26 ) : 2.900, ( 22, 21 ) : 2.500, ( 22, 23 ) : 0.800, ( 23, 19 ) : 3.000, ( 23, 21 ) : 2.800, ( 23, 22 ) : 0.800, ( 23, 24 ) : 2.400, ( 23, 25 ) : 3.000, ( 23, 26 ) : 5.000, ( 23, 29 ) : 3.700, ( 24, 17 ) : 2.700, ( 24, 23 ) : 2.400, ( 24, 25 ) : 0.900, ( 24, 29 ) : 4.500, ( 25, 23 ) : 3.000, ( 25, 24 ) : 0.900, ( 25, 29 ) : 3.300, ( 25, 30 ) : 0.900, ( 26, 20 ) : 2.200, ( 26, 21 ) : 2.900, ( 26, 23 ) : 5.000, ( 26, 27 ) : 1.200, ( 26, 28 ) : 2.800, ( 26, 31 ) : 2.500, ( 27, 26 ) : 1.200, ( 27, 28 ) : 2.100, ( 27, 31 ) : 1.500, ( 28, 26 ) : 2.800, ( 28, 27 ) : 2.100, ( 28, 29 ) : 1.300, ( 28, 31 ) : 3.000, ( 29, 20 ) : 4.800, ( 29, 23 ) : 3.700, ( 29, 24 ) : 4.500, ( 29, 25 ) : 3.300, ( 29, 28 ) : 1.300, ( 29, 30 ) : 2.600, ( 29, 31 ) : 4.000, ( 30, 25 ) : 0.900, ( 30, 29 ) : 2.600, ( 30, 32 ) : 0.900, ( 31, 26 ) : 2.500, ( 31, 27 ) : 1.500, ( 31, 28 ) : 3.000, ( 31, 29 ) : 4.000, ( 32, 30 ) : 0.900, ( 33, 3 ) : 4.800, ( 33, 5 ) : 3.000, ( 33, 7 ) : 1.600, ( 33, 9 ) : 1.600, ( 33, 10 ) : 5.300, ( 33, 12 ) : 3.000, ( 33, 15 ) : 1.650 } } } Parameter Production { IndexDomain: (i); InitialData: { data { 1 : 5, 2 : 7, 3 : 5, 4 : 6, 5 : 5, 6 : 4, 8 : 7, 9 : 3, 10 : 5, 11 : 4, 12 : 3, 13 : 6, 14 : 9, 16 : 5, 18 : 6, 19 : 5, 20 : 4, 21 : 6, 22 : 3, 23 : 8, 26 : 5, 28 : 5, 29 : 10, 31 : 6, 32 : 6 } } } Parameter CapacityOfPipe { IndexDomain: (k); Definition: data { b : 5, c : 10, d : 25, e : 50, f : 100 }; } Parameter PipeCost { IndexDomain: (k); Definition: data { b : 10, c : 15, d : 25, e : 40, f : 65 }; } Parameter SectionCost { IndexDomain: (i,j,k); Definition: Distance(i, j) * PipeCost(k); } Variable Flow { IndexDomain: (i,j); Range: nonnegative; } Variable PipeBuilt { IndexDomain: (i,j,k); Range: binary; } Variable TotalCost { Range: free; Definition: sum((i,j)|Distance(i,j), sum(k, SectionCost(i, j, k) * PipeBuilt(i,j,k))); } Constraint MultipleChoice { IndexDomain: i | i<>Port; Definition: sum( j in Successor(i), sum( k, PipeBuilt(i,j,k) ) ) = 1; } Constraint FlowConservation { IndexDomain: i | i<>Port; Definition: sum( j in Predecessor(i), Flow(j, i) ) + Production(i) = sum( j in Successor(i), Flow(i, j) ); } Constraint LimitationOnFlow { IndexDomain: (i,j); Definition: Flow(i, j) <= sum(k, CapacityOfPipe(k) * PipeBuilt(i, j, k)); } MathematicalProgram LeastCost { Objective: TotalCost; Direction: minimize; Constraints: AllConstraints; Variables: AllVariables; Type: MIP; } } DeclarationSection Interface_Declarations { Parameter XCoordinate { IndexDomain: (i); Definition: { data { 1 : 7, 2 : 18, 3 : 11, 5 : 14, 6 : 5, 7 : 18, 8 : 12, 9 : 16, 10 : 11, 11 : 16, 12 : 18, 13 : 17, 14 : 22, 15 : 26, 16 : 21, 17 : 33, 18 : 22, 19 : 28, 20 : 28, 21 : 32, 22 : 33, 23 : 35, 24 : 39, 25 : 43, 26 : 32, 27 : 35, 28 : 38, 29 : 40, 30 : 46, 31 : 37, 32 : 49, 33 : 22 } } } Parameter YCoordinate { IndexDomain: (i); Definition: { data { 1 : 70, 2 : 71, 3 : 64, 4 : 58, 5 : 58, 6 : 49, 7 : 63, 8 : 50, 9 : 53, 10 : 43, 11 : 45, 12 : 48, 13 : 40, 14 : 45, 15 : 48, 16 : 30, 17 : 38, 18 : 17, 19 : 16, 20 : 11, 21 : 14, 22 : 22, 23 : 19, 24 : 26, 25 : 22, 26 : 5, 27 : 3, 28 : 8, 29 : 11, 30 : 17, 31 : 1, 32 : 11, 33 : 56 } } } Parameter PlateformSize { IndexDomain: (i); Definition: { if ( Production(i) ) then Production(i) elseif (Port) then 17 else 12 endif; } } } Procedure MainInitialization; Procedure MainExecution { Body: { solve LeastCost; } } Procedure MainTermination { Body: { return 1; } } }