MATH 441 Section 201
A sample input for LINGO for the chemical laboratory remodeling problem determining the longest paths from START to each other node.
Online Course Material

We have entered the given nice names to the arcs and nodes but LINGO keeps them as 1,2,3 etc. and so when we enter data for the arcs we are forced to use the uninteresting labels 1,2,3 etc. to enter the tail and head.

MODEL:
!xij=flow on arc (i,j) i->j;

Sets:
node / s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19, start, f1,f2,f3,f4,f5,f6,f7,f8,f9,f10,f11,f12,f13,f14,f15,f16,f17,f18,f19/: b;
! the nodes will be numbered 1 through 39 even if I give them these more useful names;
endsets

[objective] Max=@sum( arc(a) :cost(a)*x(a) );

@for(node(i): [balance] @sum(arc(a) | head(a)#EQ#i: x(a))
-@sum(arc(a) | tail(a)#EQ#i: x(a))=b(i) );

@for(arc(a): [upperbd] x(a) < upper(a) );
@for(arc(a): [lowerbd] -x(a) < -lower(a) );

!no need to ask for integrality;

Data:
b = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;
!This is a new case where we are defining the sets;
!during the initializing phase;
!arc tail head cost lower upper;
! arc, tail, head, cost, lower, upper =
!s1f1 s1 f1 3 0 1000
!s1f1 s2 f2 4 0 1000
!s1f1 s3 f3 1 0 1000
!s1f1 s4 f4 1 0 1000
!s1f1 s5 f5 5 0 1000
!s1f1 s6 f6 2 0 1000
!s1f1 s7 f7 3 0 1000
!s1f1 s8 f8 1 0 1000
!s1f1 s9 f9 1 0 1000
!s1f1 s10 f10 5 0 1000
!s1f1 s11 f11 1 0 1000
!s1f1 s12 f12 6 0 1000
!s1f1 s13 f13 3 0 1000
!s1f1 s14 f14 5 0 1000
!s1f1 s15 f15 10 0 1000
!s1f1 16 f16 10 0 1000
!s1f1 s17 f17 10 0 1000
!s1f1 s18 f18 start 0 1000
!s1f1 s19 f19 2 0 1000
!starts1 start s1 0 0 1000
!starts14 start s14 0 0 1000
!starts15 start s15 0 0 1000
!starts16 start 16 0 0 1000
!starts17 start s17 0 0 1000
!starts18 start s18 0 0 1000
!f1start f1 start 0 0 1
!f2start f2 start 0 0 1
!f3start f3 start 0 0 1
!f4start f4 start 0 0 1
!f5start f5 start 0 0 1
!f6start f6 start 0 0 1
!f7start f7 start 0 0 1
!f8start f8 start 0 0 1
!f9start f9 start 0 0 1
!f10start f10 start 0 0 1
!f11start f11 start 0 0 1
!f12start f12 start 0 0 1
!f13start f13 start 0 0 1
!f14start f14 start 0 0 1
!f15start f15 start 0 0 1
!f16start f16 start 0 0 1
!f17start f17 start 0 0 1
!f18start f18 start 0 0 1
!f19start f19 start 0 0 1
!s1start s1 start 0 0 1
!s2start s2 start 0 0 1
!s3start s3 start 0 0 1
!s4start s4 start 0 0 1
!s5start s5 start 0 0 1
!s6start s6 start 0 0 1
!s7start s7 start 0 0 1
!s8start s8 start 0 0 1
!s9start s9 start 0 0 1
!s10start s10 start 0 0 1
!s11start s11 start 0 0 1
!s12start s12 start 0 0 1
!s13start s13 start 0 0 1
!s14start s14 start 0 0 1
!s15start s15 start 0 0 1
!s16start 16 start 0 0 1
!s17start s17 start 0 0 1
!s18start s18 start 0 0 1
!s19start s19 start 0 0 1
! precedences given by the following arcs.
!f1s2 f1 s2 0 0 1000
!f5s2 f5 s2 0 0 1000
!f7s2 f7 s2 0 0 1000
!f1s3 f1 s3 0 0 1000
!f5s3 f5 s3 0 0 1000
!f3s4 f3 s4 0 0 1000
!f12s4 f12 s4 0 0 1000
!f13s4 f13 s4 0 0 1000
!f14s4 f14 s4 0 0 1000
!f1s5 f1 s5 0 0 1000
!f2s6 f2 s6 0 0 1000
!f3s6 f3 s6 0 0 1000
!f5s6 f5 s6 0 0 1000
!f9s6 f9 s6 0 0 1000
!f10s6 f10 s6 0 0 1000
!f11s6 f11 s6 0 0 1000
!f19s6 f19 s6 0 0 1000
!f1s7 f1 s7 0 0 1000
!f2s8 f2 s8 0 0 1000
!f3s8 f3 s8 0 0 1000
!f16s8 f16 s8 0 0 1000
!f2s9 f2 s9 0 0 1000
!f3s9 f3 s9 0 0 1000
!f8s9 f8 s9 0 0 1000
!f15s9 f15 s9 0 0 1000
!f2s10 f2 s10 0 0 1000
!f3s10 f3 s10 0 0 1000
!f7s10 f7 s10 0 0 1000
!f15s10 f15 s10 0 0 1000
!f2s11 f2 s11 0 0 1000
!f3s11 f3 s11 0 0 1000
!f5s11 f5 s11 0 0 1000
!f9s11 f9 s11 0 0 1000
!f17s11 f17 s11 0 0 1000
!f6s12 f6 s12 0 0 1000
!f8s12 f8 s12 0 0 1000
!f9s12 f9 s12 0 0 1000
!f10s12 f10 s12 0 0 1000
!f11s12 f11 s12 0 0 1000
!f18s12 f18 s12 0 0 1000
!f2s13 f2 s13 0 0 1000
!f3s13 f3 s13 0 0 1000
!f6s13 f6 s13 0 0 1000
!f8s13 f8 s13 0 0 1000
!f9s13 f9 s13 0 0 1000
!f10s13 f10 s13 0 0 1000
!f18s13 f18 s13 0 0 1000
!f2s19 f2 s19 0 0 1000
!f3s19 f3 s19 0 0 1000
!f9s19 f9 s19 0 0 1000
!f15s19 f15 s19 0 0 1000 ;
!the nodes have been entered so that s1 is 1, s19 is 19, start is start and f1 is 21, f19 is 39. I would prefer not to have to do the substitution but I'm not sure how to get around it.
arc, tail, head, cost, lower, upper =
s1f1 1 21 3 0 1000
s2f2 2 22 4 0 1000
s3f3 3 23 1 0 1000
s4f4 4 24 1 0 1000
s5f5 5 25 5 0 1000
s6f6 6 26 2 0 1000
s7f7 7 27 3 0 1000
s8f8 8 28 1 0 1000
s9f9 9 29 1 0 1000
s10f10 10 30 5 0 1000
s11f11 11 31 1 0 1000
s12f12 12 32 6 0 1000
s13f13 13 33 3 0 1000
s14f14 14 34 5 0 1000
s15f15 15 35 10 0 1000
s16f16 16 36 10 0 1000
s17f17 17 37 10 0 1000
s18f18 18 38 20 0 1000
s19f19 19 39 2 0 1000
starts1 20 1 0 0 1000
starts14 20 14 0 0 1000
starts15 20 15 0 0 1000
starts16 20 16 0 0 1000
starts17 20 17 0 0 1000
starts18 20 18 0 0 1000
f1start 21 20 0 0 1
f2start 22 20 0 0 1
f3start 23 20 0 0 1
f4start 24 20 0 0 1
f5start 25 20 0 0 1
f6start 26 20 0 0 1
f7start 27 20 0 0 1
f8start 28 20 0 0 1
f9start 29 20 0 0 1
f10start 30 20 0 0 1
f11start 31 20 0 0 1
f12start 32 20 0 0 1
f13start 33 20 0 0 1
f14start 34 20 0 0 1
f15start 35 20 0 0 1
f16start 36 20 0 0 1
f17start 37 20 0 0 1
f18start 38 20 0 0 1
f19start 39 20 0 0 1
s1start 1 20 0 0 1
s2start 2 20 0 0 1
s3start 3 20 0 0 1
s4start 4 20 0 0 1
s5start 5 20 0 0 1
s6start 6 20 0 0 1
s7start 7 20 0 0 1
s8start 8 20 0 0 1
s9start 9 20 0 0 1
s10start 10 20 0 0 1
s11start 11 20 0 0 1
s12start 12 20 0 0 1
s13start 13 20 0 0 1
s14start 14 20 0 0 1
s15start 15 20 0 0 1
s16start 16 20 0 0 1
s17start 17 20 0 0 1
s18start 18 20 0 0 1
s19start 19 20 0 0 1
! precedences given by the following arcs.;
f1s2 21 2 0 0 1000
f5s2 25 2 0 0 1000
f7s2 27 2 0 0 1000
f1s3 21 3 0 0 1000
f5s3 25 3 0 0 1000
f3s4 23 4 0 0 1000
f12s4 32 4 0 0 1000
f13s4 33 4 0 0 1000
f14s4 34 4 0 0 1000
f1s5 21 5 0 0 1000
f2s6 22 6 0 0 1000
f3s6 23 6 0 0 1000
f5s6 25 6 0 0 1000
f9s6 29 6 0 0 1000
f10s6 30 6 0 0 1000
f11s6 31 6 0 0 1000
f19s6 39 6 0 0 1000
f1s7 21 7 0 0 1000
f2s8 22 8 0 0 1000
f3s8 23 8 0 0 1000
f16s8 36 8 0 0 1000
f2s9 22 9 0 0 1000
f3s9 23 9 0 0 1000
f8s9 28 9 0 0 1000
f15s9 35 9 0 0 1000
f2s10 22 10 0 0 1000
f3s10 23 10 0 0 1000
f7s10 27 10 0 0 1000
f15s10 35 10 0 0 1000
f2s11 22 11 0 0 1000
f3s11 23 11 0 0 1000
f5s11 25 11 0 0 1000
f9s11 29 11 0 0 1000
f17s11 37 11 0 0 1000
f6s12 26 12 0 0 1000
f8s12 28 12 0 0 1000
f9s12 29 12 0 0 1000
f10s12 30 12 0 0 1000
f11s12 31 12 0 0 1000
f18s12 38 12 0 0 1000
f2s13 22 13 0 0 1000
f3s13 23 13 0 0 1000
f6s13 26 13 0 0 1000
f8s13 28 13 0 0 1000
f9s13 29 13 0 0 1000
f10s13 30 13 0 0 1000
f18s13 38 13 0 0 1000
f2s19 22 19 0 0 1000
f3s19 23 19 0 0 1000
f9s19 29 19 0 0 1000
f15s19 35 19 0 0 1000;

enddata

end