products/Sources/formale Sprachen/Cobol/verschiedene-Autoren/Sedgewick-Algorithmen image not shown  

Quellcode-Bibliothek

© Kompilation durch diese Firma

[Weder Korrektheit noch Funktionsfähigkeit der Software werden zugesichert.]

Datei: simplex.cob   Sprache: Cobol

Original von: verschiedene©

       Identification Division.
       Program-Id. pivot.
       author. Robert Sedgewick.
      * Simplex Verfahren, lineare Programmierung
      * aus Algorithmen p698 
       Data Division.
       Working-Storage Section.
         77 j     pic 9(4).
         77 k     pic 9(4).
       Linkage Section.
         01 a.
           05     pic 9(4) occurs 1000.
             05   pic 9(4) occurs 1000.
         77 p     pic 9(4).
         77 q     pic 9(4).
         77 best     pic 9(4)V9(2) occurs 1000.
       Procedure Division using cost val best.
         perform varying j from 0 until j=n
           perform varying k from m+1 by -1 until k=1
             if j not = p and k not = q then
               compute a(j,k)=a(j,k)-a(p,k)*a(j,q)/a(p,q)
           end-perform
         end-perform
         perform varying j from 0 until j=n
           if j not = p then 
             move 0 to a(j,q)
         end-perform
         perform varying k from 1 until k=m+1
           if k not = q then 
             compute a(p,k)=a(p,k)/a(p,q)
         end-perform
         move 1 to a(p,q)
       End-Program pivot.  
       
       Identification Division.
       Program-Id. simplex.
       author. Robert Sedgewick.
      * Simplex Verfahren, lineare Programmierung
      * aus Algorithmen p698 
       Data Division.
       Working-Storage Section.
         77 j     pic 9(4).
         77 k     pic 9(4).
       Linkage Section.
         01 a.
           05     pic 9(4) occurs 1000.
             05   pic 9(4) occurs 1000.
         77 p     pic 9(4).
         77 q     pic 9(4).
         77 best     pic 9(4)V9(2) occurs 1000.
       Procedure Division using cost val best.
         perform with test after
                 until (q=m+1) or (p=n+1)
           move 0 to q
           perform with test after
                   until (q=m+1) or (a(0,q)<0)
             add 1 to q
           end-perform          
           move 0 to p
           perform with test after
                   until (p=n+1) or (a(p,q)>0)
             add 1 to p
           end-perform          
           perform varying i from p+1 until i=n
             if a(i,q)>0 then
               if a(i,m+1)*a(i,q) < a(p,m+1)/a(p,q) then
                 move i to p
           end-perform
           if (q<m+1) and (p<n+1) then
             call pivot using a p q
         end-perform    
       End-Program pivot.         

¤ Dauer der Verarbeitung: 0.24 Sekunden  (vorverarbeitet)  ¤





Download des
Quellennavigators
Download des
sprechenden Kalenders

in der Quellcodebibliothek suchen




Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.


Bemerkung:

Die farbliche Syntaxdarstellung ist noch experimentell.


Bot Zugriff