Transportation problem: Difference between revisions

Content added Content deleted
(→‎{{header|REXX}}: flagged as needing improvement, there is a missing subroutine.)
m (→‎{{header|REXX}}: added wordsort. thanx)
Line 3,910: Line 3,910:


=={{header|REXX}}==
=={{header|REXX}}==

{{improve|REXX|<br>This REXX program gets an error: <br><br> 'WORDSORT' is not recognized as an internal or external command.<br><br>}}

<lang rexx>/* REXX ***************************************************************
<lang rexx>/* REXX ***************************************************************
* Solve the Transportation Problem using Vogel's Approximation
* Solve the Transportation Problem using Vogel's Approximation
Line 4,118: Line 4,115:
Say ol
Say ol
End
End
Return</lang>
Return
wordsort: Procedure
/**********************************************************************
* Sort the list of words supplied as argument. Return the sorted list
**********************************************************************/
Parse Arg wl
wa.=''
wa.0=0
Do While wl<>''
Parse Var wl w wl
Do i=1 To wa.0
If wa.i>w Then Leave
End
If i<=wa.0 Then Do
Do j=wa.0 To i By -1
ii=j+1
wa.ii=wa.j
End
End
wa.i=w
wa.0=wa.0+1
End
swl=''
Do i=1 To wa.0
swl=swl wa.i
End
/* Say swl */
Return strip(swl)</lang>
{{out}}
{{out}}
<pre>Sources / Demands / Cost
<pre>Sources / Demands / Cost