Home
sistema automatizado para el control de proyectos en la pequeña y
Contents
1. GuardarDatos CodAparicion Cm32 GuardaCM32 MiOrden CrearMiDondeEstan OrdenVP CR Borrar end with MiCodigos end preparardatos Los algoritmos CodAparaicion y Cm32 se basan en los modelos dise ados para nuestro proyecto O Modelo 0 Actividad inicial O Modelo 1 Una actividad precedente In Modelo 2 Dos o m s actividades nrecedentes 2 Modelo 2 Incluye 3 actividades ficticias ae is Modelo 3 Actividades precedentes Er conectando a otro grupo de actividades N Actividad Pai final La red se construye de acuerdo con los modelos de nodos Las actividades que llegan tienen c digos asociados al modelo del nodo Con los c digos asignados a las actividades y definidos los grupos los algoritmos del m dulo URed calculan los pares que hemos denominado conjuntos i j correspondientes a los eventos de inicio y terminaci n de las actividades para la creaci n de la red 17 VD 0 JC P Un rz SysPert Manual T cnico La implementaci n en Pascal del proceso en carrusel descrito se muestra a continuaci n La estructura principal es un ciclo de repetici n hasta que Colal est vac a Esto es hasta que todas las actividades tengan definidos los pares i j En VActival se guarda un registro de cada actividad con un campo denominado Ok cuyos valores son cero para las actividades en proceso y uno para aquellas cuyo proceso concluy El programa examina Ok y si su valor es cero regresa
2. Index VectorOpStatus TRUE 123 SysPert Manual T cnico END PROCEDURE GpoVector Recall Index WORD input VAR Gp ShortString output BEGIN IF Index gt V Size THEN BEGIN VectorOpStatus FALSE A Nil Corregir a una actividad nula EXIT END Gp VecPtr Index VectorOpStatus TRUE END CONSTRUCTOR TFicVector Init MaxElem WORD input BEGIN MaxVectorSize MaxElem VSize 0 GetMem VecPtr MaxElem SizeOf TRFic VectorOpStatus TRUE END DESTRUCTOR TFicVector Done BEGIN MaxVectorSize 0 VSize 0 FreeMem VecPtr Max VectorSize SizeOf TRFic VecPtr NIL VectorOpStatus TRUE END FUNCTION TFicVector CurrentSize WORD BEGIN VectorOpStatus TRUE CurrentSize VSize END PROCEDURE TFicVector Store Index WORD input Fic TRFic input BEGIN IF Index gt MaxVectorSize THEN BEGIN VectorOpStatus FALSE EXIT END VecPtr Index Fic IF Index gt VSize THEN VSize Index 124 SysPert Manual T cnico VectorOpStatus TRUE END PROCEDURE TFicVector Recall Index WORD input VAR Fic TRFic output BEGIN IF Index gt V Size THEN BEGIN VectorOpStatus FALSE A Nil Corregir a una actividad nula EXIT END Fic VecPtr Index VectorOpStatus TRUE END q Gn nn En StatusType Method PARKER Ga dan no ni E PROCEDURE Status Type Reset BEGIN OverFlow FALSE UnderFlow FA
3. VectorOpStatus BOOLEAN CONSTRUCTOR Init MaxElem WORD input DESTRUCTOR Done FUNCTION CurrentSize WORD PROCEDURE Store Index WORD input X word input PROCEDURE Recall Index WORD input VAR X word output PROCEDURE Fill FillValue word input NumElem WORD input PROCEDURE AddScalar Scalar word input PROCEDURE MiultScalar Scalar word input PROCEDURE AddVector VectB WVector input FUNCTION MultVector VectB WVector input word 111 SysPert Manual T cnico END OneEstima ARRAY 1 1 OF TEstima OneEstimaP TVEstima tr OneEstima OBJECT Max VectorSize VSize WORD VecPtr OneEstimaPtr VectorOpStatus BOOLEAN CONSTRU DESTRUC CTOR Init MaxElem WORD input TOR Done FUNCTION CurrentSize WORD PROCEDU PROCEDU RE Store Index WORD input X TEstma input RE Recall Index WORD input VAR X TEstima output PROCEDU RE Fill FillValue TEstima input NumElem WORD input END StatusType Object REPRESENTATION OverFlow UnderFlow Object MisMatch Dynamic Memory Exhausted General Failure BOOLEAN SPECIFICATION PROCEDURE Reset END StackNodePtr StackNode StackNode Object REPRESENTATION Info Next SPEC PROC POINTER StackNodePtr IFICATION EDURE Init VAR Captured_ Info un
4. input A TRVcpm input PROCEDURE Recall Index WORD input VAR A TRVcpm output end OneGpo ARRAY 1 1 OF ShortString OneGpoPtr OneGpo GpoVector OBJECT Max VectorSize VSize Word VecPtr OneGpoPtr VectorOpStatus BOOLEAN CONSTRUCTOR Init MaxElem WORD input DESTRUCTOR Done FUNCTION CurrentSize WORD PROCEDURE Store Index WORD input Gp ShortString input PROCEDURE Recall Index WORD input VAR Gp ShortString output end OneFic ARRAY 1 1 OF TRFic OneFicPtr OneFic TFicVector OBJECT Max VectorSize VSize Word VecPtr OneFicPtr VectorOpStatus BOOLEAN CONSTRUCTOR Init MaxElem WORD input DESTRUCTOR Done FUNCTION CurrentSize WORD PROCEDURE Store Index WORD input Fic TRFic input PROCEDURE Recall Index WORD input VAR Fic TRFic output end Var Gpo VDura Gpo Vector 116 SysPert Manual T cnico JGpo WVector VActival AVector Vcpm TVcpm FicVector TFicVector VEstima TVEstima qHol ColaFic Colal cGpos Queue RIndex TRIndex JMax nT integer DurPro real integer cc32 flEncolar fliP flJMax boolean sTP NomAr string sigm Mu Sigma real implementation CONSTRUCTOR WVector Init MaxElem WORD input BEGIN Max VectorSize MaxElem VSize 0 GetMem VecPtr MaxElem SizeOf word VectorOpStatus TRUE
5. B A N X A Area 1 0 inicializa la 1 sima sumatoria M N 1 n mero de subintervalos para el c lculo for j 1 to M do begin ciclo que obtiene la sumatoria de las reas de los subintervalos X X H Area 1 Area 1 Y X end for j Area i H Y A Y B 2 Area i 2 f rmula trapecial N 2 N 106 SysPert Manual T cnico end for i Rich 4 Area 2 Area 1 3 interpolacion de Richardson entre las dos sumatorias N y 2N subintervalos AreaBC Rich end AreaBC function Kalcula AreaTar real real Realiza la exploraci n para determinar la Z buscada a partir de un rea determinada var H real Izq boolean f1 f2 factores de aproximaci n en la exploraci n ArZ real b1 b2 l mites del intervalo de exploraci n Areal Area2 real ZNeg boolean k integer begin K1 0 K2 0 k 0 contador ZNeg False A 4 Valor inicial para la variable aleatoria en el limite inferior del rango explorador B 3 9 Valor inicial para la variable aleatoria en el limite superior del rango explorador N 16 Numero de intervalos en dividira el rango explorador H B A N ancho del intervalo para el rango explorador if AreaTar 0 5 then Areal AreaTar variable aleatoria en el centro de la distribuci n else begin if AreaTar lt 0 5 then begin utilizado para realizar los c lculos en el lado positivo sim trico de la curva AreaTar 1 AreaTar ZNeg True end b2 B b2 b1 valor inicial
6. Colal DeQueue Ax SizeOf Ax VActival Recall Ax Index A1 until Colal Is Empty El procedimiento Pares discrimina entre tres situaciones diferentes por el n mero de actividades precedentes a la actividad en proceso La variable LVP se relaciona con los modelos descritos anteriormente ver figura la siguiente figura En la estructura de opci n m ltiple case A 7 L VP 18 SysPert Manual T cnico selecciona el llamado al procedimiento que resuelve el caso de las actividades iniciales ParCero o al procedimiento para las actividades que solamente les antece una actividad ParUno o el que resuelve para las actividades con dos o m s actividades precedentes ParMas case A1 LVP of 0 ParCero Ax 1 ParUno Ax else ParMas Ax end case e ParCero resuelve el Modelo 0 e ParUno resuelve el Modelol e ParMas resuelve los dem s casos URed contiene 18 procedimientos y una funci n procedure ArmaRed procedure Caso2 procedure Caso3 procedure IDiferente procedure IMisma procedure jPendiente procedure M1 procedure M10M2 procedure M2 procedure M3 procedure M3R procedure M3S procedure ParCero var Ax TA ctiva procedure Pares Ax TActiva procedure ParMas var Ax TActiva procedure ParUno var Ax TActiva procedure SolMi cMi Queue Ax TActiva procedure SolPivote Ap TActiva function gpoVP gS VP ShortString boolean 19 SysPert Manual T cnico SysCpm Este programa crea u
7. END DESTRUCTOR TVcpm Done BEGIN MaxVectorSize 0 VSize 0 FreeMem VecPtr Max VectorSize SizeOf TRVcpm VecPtr NIL VectorOpStatus TRUE END FUNCTION TVcpm CurrentSize WORD BEGIN VectorOpStatus TRUE CurrentSize VSize END PROCEDURE TVcpm Store Index WORD input A TRVcpm input BEGIN IF Index gt MaxVectorSize THEN BEGIN VectorOpStatus FALSE EXIT END VecPtr Index A IF Index gt V Size THEN VSize Index VectorOpStatus TRUE END 122 SysPert Manual T cnico PROCEDURE TVcpm Recall Index WORD input VARA TRVcpm output BEGIN IF Index gt V Size THEN BEGIN VectorOpStatus FALSE A Nil Corregir a una actividad nula EXIT END A VecPtr Index VectorOpStatus TRUE END CONSTRUCTOR GpoVector Init MaxElem WORD input BEGIN MaxVectorSize MaxElem VSize 0 GetMem VecPtr MaxElem SizeOf ShortString VectorOpStatus TRUE END DESTRUCTOR GpoVector Done BEGIN MaxVectorSize 0 VSize 0 FreeMem VecPtr MaxVectorSize SizeOf ShortString VecPtr NIL VectorOpStatus TRUE END FUNCTION GpoVector CurrentSize WORD BEGIN VectorOpStatus TRUE CurrentSize VSize END PROCEDURE GpoVector Store Index WORD input Gp ShortString input BEGIN IF Index gt MaxVectorSize THEN BEGIN VectorOpStatus FALSE EXIT END VecPtr Index Gp IF Index VSize THEN VSize
8. Escriba el T sTP if Ok then begin Sigma 0 Mu DurPro for ik 1 to qHol Items In do begin repeat qHol DeQueue rRC SizeOf rRC qHol EnQueue rRC SizeOf rRC preserva qHol VEstima Recall rRC Index rEstima Sigma Sigma rEstima Varianza end for ik 1 to qHol Items_In Sigma Sqrt Sigma rParm 1 4 rParm 2 FloatToStr StrToFloat sTP 0 5 Mu Sigma rParm 3 FloatToStr StrToFloat sTP 0 5 Mu Sigma rParm 4 3 cPert rParm end fif Ok then end procedure TfmMain Antesde2Click Sender TObject Calcula la probabilidad de no terminar el proyecto antes de su TP var Ok boolean ik integer rEstima TEstima rRC TRC rParm TcParm begin Ok InPutQuery Prob de no terminar en T Escriba el T sTP if Ok then begin Sigma 0 51 SysPert Manual T cnico Mu DurPro for ik 1 to qHol Items In do begin repeat qHol DeQueue rRC SizeOf rRC qHol EnQueue rRC SizeOf rRC preserva qHol VEstima Recall rRC Index rEstima Sigma Sigma rEstima Varianza end for ik 1 to qHol Items_In Sigma Sqrt Sigma rParm 1 1 rParm 2 FloatToStr StrToFloat sTP Mu Sigma rParm 3 2 cPert rParm end if Ok then end procedure TfmMain EnelperiodolClick Sender TObject Calcula la probabilidad de no terminar el proyecto dentro de un determinado periodo T1 T2 var Ok boolean ik integer rEstima TEstima rRC TRC rParm TcParm begin Ok InPutQuery Prob
9. SysPert Manual T cnico aDestino j aFuente J aDestino Dur rEstima DurMe aDestino iPx 0 aDestino tPx 0 aDestino iLx 0 aDestino tLx 0 aDestino hTotal 0 aDestino hLib 0 aDestino hInter 0 Vcpm Store aDestino Index aDestino end until aFuente LVP gt 0 for k 1 to nk do begin carga las ficticias en Vcpm FicVector Recall k rFic aDestino i rFic i aDestino j rFic aDestino Dur 0 aDestino Index 1 aDestino iPx 0 aDestino tPx 0 aDestino iLx 0 aDestino tLx 0 aDestino hTotal 0 aDestino hLib 0 aDestino hInter 0 Vcpm Store aDestino Index aDestino inc 1 end for k repeat carga las intermedias y finales en Vcpm VActival Recall i nk aFuente aDestino Index aFuente Index nk aDestino i aFuente i aDestino j aFuente j VEstima Recall i nk rEstima aDestino Dur rEstima DurMe StrToFloat sNK aDestino iPx 0 aDestino tPx 0 aDestino iLx 0 aDestino tLx 0 aDestino hTotal 0 aDestino hLib 0 aDestino hInter 0 if VActival VectorOpStatus then Vcpm Store aDestino Index aDestino inc 1 until not VActival VectorOpStatus end CargaTabla 103 SysPert Manual T cnico procedure Cpm begin CargaTabla Proximo Lejano Holguras end end 104 SysPert Manual T cnico unit Upert interface uses SysUtils UDatos UMain UValz procedure cPert cParm TcParm implementation procedure cPert cParm TcParm begin case StrToInt cP
10. W Vector TVEstima StatusT ype StackNode Snack QueueNode AVector TVcpm GpoVector TFicVector Tipos TRIndex TEstima Onelnt OnelntPtr OneEstima OneEstimaPtr StackNodePtr QueueNodePtr VisitProc TActiva TVActiva TRVcpm TRFic TRC TRLin6 TRLin8 TRLin9 TStr4 TcParm TVP TGrupo TRGpos OneActiva OneActivaPtr OneCPM OneCPMPtr OneGpo OneGpoPtr OneFic OneFicPtr Constantes SysPert Manual T cnico maxGpos Variables y su tipo asociado Gpo VDura GpoVector JGpo WVector VActival A Vector Vepm TVcpm FicVector TFic Vector VEstima TVEstima qHol ColaFic Colal cGpos Queue RIndex TR Index JMax nT integer DurPro real integer cc32 flEncolar fliP flJMax boolean sTP NomAr string sigm Mu Sigma real En el ap ndice anexo al informe impreso se presenta un diccionario de datos con referencias cruzadas entre todas las unidades conteniendo todas las variables empleadas en el paquete SysPert Manual T cnico APENDICE LISTADOS DEL C DIGO DE TODOS LOS M DULOS 33 SysPert Manual T cnico unit UMain interface uses Windows Messages SysUtils Classes Graphics Controls Forms Dialogs Grids StdCtrls Menus ComCtrls ActnList ImgList Tool Win miunit UGraficaNodos ExtCtrls type TfmMain class TForm btAddActs TButton btCreaRed TButton btGrabar TButton btRecuperar TButton btSalir TButton MainMenul TMainMenu Arch
11. Zi TP i Ti Si gt TP i Ti ZiS i 39 1 96 V86 9 Ti ZiSi lt 4 IC toss lt Ti ZiSi 39 1 96 V86 9 1 IC t oss 39 1 96 N86 9 33 32 94 lt 1 IC Foss 45 05 45 SysPert Manual T cnico 1 96 1 96 Figura 10 c Campana de Gauss de distribuci n normal del ejemplo c SysPert Manual T cnico ARQUITECTURA DEL SISTEMA AUTOMATIZADO PARA EL CONTROL DE PROYECTOS EN LA PEQUENA Y MEDIANA EMPRESAS MEXICANAS primera etapa El siguiente diagrama de bloques muestra los ocho m dulos principales que componen el paquete de software dise ado sobre nuestro modelo M dulo Principal El paquete se dise para obtener tres productos de software que pudieran operar independientemente o bien integrando un solo paquete con otros m dulos que se podr n a adir en la segunda etapa del proyecto prevista para un siguiente ciclo Los m dulos UCode y UDatos son comunes a todas las versiones Los m dulos Principal y UMain se tienen que configurar de acuerdo a cada versi n ya que UMain contiene la interfaz del usuario para cada caso A continuaci n se describe el conjunto de m dulos que conforman los productos que hemos denominado SysRed SysCpm y SysPert 10 SysPert Manual T cnico SysRed Este programa crea una red a partir de la lista de actividades y sus precedentes El modelo utilizado se denomina AOA actividades en los arcos Los m dulos que constituyen este programa son
12. for I 0 to High GruposA 1 do ESTOS FOR SON PARA COMPARAR for J I 1 to High GruposA do EL PRIMER GRUPO CON EL SEGUNDO 89 SysPert Manual T cnico begin if High GruposA I lt gt High GruposA J then begin compara 0 Compara2 0 for K 0 to High GruposA I do para Verificar en los grupos for L 0 to High GruposA J do if GruposA I K GruposA J L then compara compara 1 esto puede estar mal por si la cadena contiene n if compara 1 High GruposA I then SI ESTE GRUPO I ES SUBGRUPO DE OTRO J begin for L 0 to High GruposA I do para Verificar en los grupos for M 0 to High GruposA J do if GruposA J M GruposA LL then GruposA J M 0 for z 0 to High NuevoDondeEsta J do begin if NuevoDondeEsta J compara2 lt gt 0 then Compara2 Compara2 1 end SetLength NuevoDondeEsta J compara2 1 NuevoDondeEsta J compara2 I 1 PARA DECIRME QUE ESE ESTABA COMPUESTO DE OTRO GRUPO compara2 compara2 1 end if compara 1 High GruposA I then if compara 1 High GruposA J then O SI JES UN SUBGRUPO DEI for L 0 to High GruposA I do para Verificar en los grupos for M 0 to High GruposA J do if GruposA I L GruposA J M then GruposA LL 0 ELIMA A LOS QUE SON SUBGRUPOS DEL ORIGINAL end if High GruposA I lt gt High GruposA J then end for J I 1 to High GruposA AQUI ME DA LOS GRUPOS DEPURADOS AL CIEN PORCIENTO HO MAS BIEN LE PONGO CEROS A LOS ELEMNTOS Q
13. 1 to cVPG Items In Calcula mVLP m nimo LVP gk 0 inicializa el indice de grupos nFin 0 repeat mLVP MaxInt for k 1 to GpoVP VSize do begin GpoVP Recall k gS if StrToInt gS 1 0 and mLVP StrToInt gS 1 then mLVP StrToInt gS 1 captura el m nimo LVP en el vector de grupos GpoVP end for k 1 to GpoVP VSize Forma grupo con mLVP flG False k 0 repeat inc k GpoVP Recall k gS if StrToInt gS 1 mLVP then begin inc gk gSS Copy gS Pos gS 1 Length gS Pos gS copia en gSS el VP if gSS lt gt then Gpo Store gk gSS gS 1 0 GpoVP Store k gS fIG True inc nFin end until flG or k gt GpoVP VSize 3 Suprimir el grupo formado de todos los VP s que lo contengan for k 1 to GpoVP VSize do begin GpoVP Recall k gS Gpo Recall gk sVP if gS 1 lt gt 0 and Pos sVP gS gt 0 and Gpo VectorOpStatus then begin Delete gS Pos sVP gS Length sVP GpoVP Store k gS end end for 1 to GpoVP VSize until not Gpo VectorOpStatus or nFin gt GpoVP VSize en M3 02 nunca se hace falsa modificar condici n end 1f cVPG Items In gt 0 end if cVP32 Items_In gt 0 end CreaGrupos 4 SysPert Manual T cnico procedure CargaDatos Carga el vector VActival y la Colal con los valores de la tabla de datos var k word rActiva TV Activa begin with fmMain sgActiviDatos do begin VActival Init RowCount 1 VEstima Init RowCount 1 V
14. n f para el l mite inferior b y f para el l mite superior 5 del intervalo explorador 28 SysPert Manual T cnico La funci n Kalcula implementa en Pascal la t cnica descrita function Kalcula AreaTar real real Realiza la exploraci n para determinar la Z buscada a partir de un rea determinada var H real Izq boolean f1 f2 factores de aproximaci n en la exploraci n ArZ real b1 b2 l mites del intervalo de exploraci n Areal Area2 real ZNeg boolean k integer begin K1 0 K2 0 k 0 contador ZNeg False A 4 Valor inicial para la variable aleatoria en el limite inferior del rango explorador B 3 9 Valor inicial para la variable aleatoria en el limite superior del rango explorador N 16 N mero de intervalos en dividir el rango explorador H B A N fancho del intervalo para el rango explorador if AreaTar 0 5 then Areal AreaTar variable aleatoria en el centro de la distribuci n else begin if AreaTar lt 0 5 then begin utilizado para realizar los c lculos en el lado positivo sim trico de la curva AreaTar 1 AreaTar ZNeg True end b2 B b2 b1 valor inicial del limite superior del primer intervalo Area2 AreaBC A b2 N area del limite superior del primer intervalo repeat c lculo de reas sucesivas hasta revasar el rea de la variable aleatoria desconocida inc K1 inc k espia b1 b2 Areal Area2 preserva el rea de la cota inferior del
15. then begin inc JMax JComun JMax ColaIP EnQueue RFic i SizeOf word repeat procesa todas las ficticias pendientes ColaIP DeQueue RFic i SizeOf word RFic j JComun ColaFic EnQueue RFic SizeOf RFic until ColalP Is Empty fliP False Al i JComun VActival Store Al Index A 1 end 15 SysPert Manual T cnico else begin Al 1 Ap j VActival Store A1 Index A1 end if Ap Ok 0 then if fIM2 then M2 else M1 end MloM2 fprocedure iFaltante var tempColaVP tempcVPA tempColaAP tempColaIP Queue tempAl tempAp temppivAp TVActiva tempaVP tempkAux word tempflM2 tempflM3 tempflP tempflDoneCaso2 boolean tempRFic TRFic tempJComun word 1 integer j word begin tempColaVP Init SizeOf word ColaVP Size tempcVPA Init SizeOf word cVPA Size tempColaAP Init SizeOf word ColaAP Size tempColalP Init SizeOf word ColalP Size for 1 1 to ColaVP Size do begin ColaVP DeQueue j SizeOf j tempColaVP EnQueue j SizeOf j end for i 1 to ColaVP Size do begin cVPA DeQueue j SizeOf j tempcVPA EnQueue SizeOf j end for 1 1 to ColaVP Size do begin ColaAP DeQueue j SizeOf j tempColaAP EnQueue j SizeOf j end for 1 1 to ColaIP Size do begin 74 SysPert Manual T cnico ColaIP DeQueue j SizeOf tempColaIP EnQueue j SizeOf j end ColaVP Clear cVPA Clear ColaAP Clear ColalP Clear tempkAux kAux tempflM2 f1M2 tempflM
16. with sgActiviDatos do begin inicializa el StringGrid Font Size 1 ColWidths 0 ColWidths 1 ColWidths 2 ColWidths 3 ColWidths 4 ColWidths 5 Cells 0 0 SCH Cells 1 0 Nombre Cells 2 0 Precedentes Cells 3 0 T Opt I E I Cells 4 0 T Prob Cells 5 0 T Pes Cells 0 1 Format 8d 1 Width GridWidth 25 Left fmMain TabSheet1 Left fmMain TabSheet1 Width Width div 2 centra StringGrid en TabSheetl end with sgActiviDatos sgFic Cells 0 0 No sgFic Cells 1 0 1 sgFic Cells 2 0 3 sgFic Visible False IbFicticias Visible False 36 SysPert Manual T cnico sgCPM Cells 0 0 sgCPM Cells 1 0 sgCPM Cells 2 0 de sgCPM Cells 3 0 Dur Media N mero ko i sgCPM Cells 4 0 Varianza iPx 15 sgCPM Cells 5 0 tPx sgCPM Cells 6 0 iLx sgCPM Cells 7 0 tLx sgCPM Cells 8 0 hTotal sgCPM Cells 9 0 hLib sgCPM Cells 10 0 hInter btCreaRed Enabled False IbRC Visible False IbTituloPERT Visible False Label Visible False Labell Visible False IbProba Visible False IbProbaCom Visible False TabSheet2 Enabled True TabSheet2 Visible True PageControll ActivePage TabSheetl sgCPM Visible False sgRC Visible False sgActiviDatos SetFocus sgFic Font Size 8 sgCPM Font Size 8 Label2 Font Size 12 LbRc Font Size 12 LbFicticias Font Size 12 Grafica
17. 0 6334 0 2591 1 2 4 5 7 8 0 3733 i 0 6266 Programa del ejemplo con probabilidades para los tiempos TP i en los nodos evento i Los tiempos de la gerencia TP i son supuestos que se pueden programar para cada evento nodo i Ejemplo a Con la misma red proyecto ejemplo y tiempo esperado Ts 39 determine lo siguiente Calcule la probabilidad de que el proyecto se complete en el tiempo esperado T 39 pero dentro de 1 desviaci n est ndar Z s TP Ts Ss pero TP T s 1S3 gt Zs Ts 1S Tg S 8 S 1 campana de Gauss 9 e i TET H 39 18 T 39 39 15 P T s 1S 3 0 84134 0 15866 0 68268 tablas de distribuci n Normal para Z 1 y Z 1 Campana de Gauss de distribuci n normal ejemplo a Ejemplo b Con el mismo ejemplo calcule la probabilidad de que el proyecto se cumpla exactamente dentro de la unidad de tiempo 37 es decir que P TP 3 37 b 36 37 39 37 39 36 39 PI TP s3 37 P TP lt 37 PI TP lt 36 P4 TP 4737 2 P4Z47 37 39 N86 9t P1 Zs 36 39 N86 9 PTP 37 P iZ 0 7276 P Z g 0 9704 0 23343 0 16592 0 06751 Figura 9 b Campanas de Gauss de distribuci n normal para el ejemplo b Ejemplo c Calcule un intervalo de confianza de 95 para la terminaci n de proyecto a 1 0 95 0 05 2 0 05 2 0 025 en tablas de distribuci n normal Z 1 96
18. END DESTRUCTOR WVector Done BEGIN MaxVectorSize 0 VSize 0 FreeMem VecPtr Max VectorSize SizeOf word VecPtr NIL VectorOpStatus TRUE END FUNCTION WVector CurrentSize WORD BEGIN VectorOpStatus TRUE CurrentSize VSize END PROCEDURE WVector Store Index WORD input X word input 117 SysPert Manual T cnico BEGIN IF Index gt MaxVectorSize THEN BEGIN VectorOpStatus FALSE EXIT END VecPtr Index X IF Index VSize THEN VSize Index VectorOpStatus TRUE END PROCEDURE WVector Recall Index WORD input VARX word output BEGIN IF Index gt V Size THEN BEGIN VectorOpStatus FALSE X 0 EXIT END X VecPtr Index VectorOpStatus TRUE END PROCEDURE WVector Fill FillValue word input NumElem WORD input VARI WORD BEGIN IF NumElem gt MaxVectorSize THEN NumElem MaxVectorSize VSize NumElem FOR I 1 TO NumElem DO VecPtr I FillValue VectorOpStatus TRUE END PROCEDURE WVector AddScalar Scalar word input VARI WORD BEGIN FOR I 1 TO VSize DO VecPtr 1 VecPtr I Scalar VectorOpStatus TRUE END PROCEDURE WVector MultScalar Scalar word input 118 SysPert Manual T cnico VAR I WORD BEGIN FOR I 1 TO VSize DO VecPtr 1 VecPtr I Scalar VectorOpStatus TRUE END PROCEDURE WVector AddVector VectB WVector input VARI WORD BEGIN IF Vsize
19. EnQueue Ap Index SizeOf Ap Index dec k until k 0 if cMi Is_ Empty then begin cVPA EnQueue pivA SizeOf pivA SolPivote Ax end else begin cMi EnQueue pivA Index SizeOf pivA Index SolMi cMi Ax end end while k cVPA Items_In repeat revisar si repeat debe ser while porque k puede ser cero caso test06 cVPA DeQueue Ap SizeOf Ap kJ Ap j cVPA Enqueue Ap SizeOf Ap Error se encola Ap cuando debe ser Ap Index revisar estado de cVPA until k 0 or kJ gt 0 while not cVPA Is Empty do begin cVPA DeQueue Ap SizeOf Ap Ap j kJ Ap Ok 1 VActival Store Ap Index Ap end while VActival Recall Ax Index A1 Al i JMax VActival Store A 1 Index A 1 end M2 procedure M3S var jComun word begin jComun 0 66 SysPert Manual T cnico if pivAp j lt gt 0 then Comun pivAp j kAux Colalp Items In if kAux 0 then kAux 1 esto evita que el siguiente innecesariamente ifjComun 0 then repeat ColaAP DeQueue aVP SizeOf aVP VActival Recall aVP Ap if Ap j lt gt O and Ap cApar lt gt 2 then jComun Ap j ColaAP EnQueue aV P SizeOf aV P dec kAux until jComun lt gt 0 or kAux 0 ciclo se repita 65554 veces if j Comun 0 calcula la j de la pivAp then begin inc Max jComun jMax end pivAp j jComun pivAp Ok 1 VActival Store pivAp Index piv Ap if fIM2 then begin inc JMax JComun JMax if fliP then ColaIP EnQueue R Fic i SizeOf word
20. In do begin cVP32 DeQueue k SizeOf k VActival Recall k A 1 pk 1 if Al LVP gt 1 then brinca las comas y convierte a numero el elemento del VP repeat if Al VP pk lt gt then sVP sVP A1 VP pk else begin V Actival Recall StrToInt sVP Ap flG Ap cM3 2 if fiG then cVP32 EnQueue k SizeOf k reencola las que tienen cM32 las dem s las desecha sVP end inc pk until sVP end for k 1 to cVP32 Items Inj repeat Filtro2 elimina actividades con VP repetido cVP32 DeQueue aPiv SizeOf aPiv decola pivote cVPG EnQueue aPiv SizeOf aPiv guarda pivote en cola para el vector de grupos VActival Recall aPiv A1 cVP32 DeQueue aVP SizeOf aVP decola la siguiente acividad con cM32 if cVP32 Last Op Ok verifica que la cVP32 est correcta then begin VActival Recall aVP A p if A1 VP lt gt Ap VP verifica VP repetidos then cVP32 EnQueue aV P SizeOf aV P reencola las no repetidas end if cVP32 Last_ Op Ok until cVP32 Is Empty if cVPG Items In gt 0 crea los grupos then begin GpoVP Init cVPG Items In inicializa vector de grupos for k 1 to cVPG Items In do de la cola cVPG carga vector de las VP s con cM32j begin cVPG DeQueue aVP SizeOf aVP carrusel en cVPG cVPG EnQueue aVP SizeOf aVP VActival Recall aVP Ap GpoVP Store k IntToStr Ap LVP Ap VP carga vector de las VP s con cM32 formato LVP VP 40 SysPert Manual T cnico end for k
21. RFic i pivAp j ColaIP EnQueue R Fic i SizeOf word repeat ColaIP DeQueue R Fic i SizeOf word RFic j JComun ColaFic EnQueue RFic SizeOf R Fic until ColalP Is Empty fliP False Ap j JComun Ap Ok 1 A1 1 JComun VActival Store Ap Index Ap VActival Store A1 Index A1 end else begin while not ColaAP Is Empty do fpone la misma j a las A31 con i diferente begin ColaAP DeQueue aVP SizeOf aVP VActival Recall aVP Ap if Ap j 0 then Ap j jComun 67 SysPert Manual T cnico Ap Ok 1 VActival Store Ap Index Ap end while not ColaAP Is Empty if fliP then begin RFic j JComun fliP False ColaIP EnQueue R Fic i SizeOf word repeat ColaIP DeQueue R Fic i SizeOf word ColaFic EnQueue RFic SizeOf R Fic until ColaIP Is Empty end Al 1 jComun VActival Store A1 Index A1 end end M3S function gpoVP gS VP ShortString boolean var ColaGpos ColaVP Queue k nk integer gElem elemVP TStr4 rGpos TRGpos Ok boolean begin ColaGpos Init SizeOf TRGpos 100 ColaVP Init SizeOf TStr4 100 Ok True utilizada para la verificaci n final si el grupo est en VP gElem for nk 1 to Length gS do separa los elementos del grupo if gS nk lt gt then gElem gElem gS nk else begin rGpos Cad gElem rGpos Si False ColaGpos EnQueue rGpos SizeOf rGpos gElem end elemVP for nk 1 to Length VP do separa los elementos del VP if VP nk lt then e
22. SysPert Manual T cnico Crl 1 0 cont 0 for I 1 to High MiCodigos ElemVp 1 do if Cr1 I 0 then begin for J I 1 to High MiCodigos ElemVp do begin if Cr1 J 0 then if High MiCodigos ElemVp I High MiCodigos ElemVp J then begin for K 1 to High MiCodigos ElemVp I do for L 1 to High MiCodigos ElemVp I do if MiCodigos ElemVp I K MiCodigos ElemVp J L then cont cont 1 c High MiCodigos ElemVp I c High MiCodigos ElemVp I if cont High MiCodigos ElemVp I then Micodigos CR1 J I end if High MiCodigos ElemVp I High MiCodigos ElemVp J then cont 0 end for J I 1 to High MiCodigos ElemVp end for I 1 to High MiCodigos ElemVp 1 for I 1 to High MiCodigos ElemVp do begin Vactival Recall I eso eso cr CRI I Vactival Store I eso end for I 1 to High MiCodigos ElemVp gpo MaxVectorSize High GruposA 1 for I 0 to High GruposA do begin strgrupo for J 0 to High GruposA I do begin if j High GruposA I then strgrupo strgrupo IntToStr GruposA LJ else strgrupo strgrupo IntToStr GruposA LJ end for J 0 to High GruposA I Gpo Store I 1 strgrupo end for I 0 to High GruposA end TCodigos CR 80 SysPert Manual T cnico EEE o o ole K ole ole ale ole ole ale ok EE procedure TCodigos OrdenVP var Lj kliinteger AQUI YA TRAIGO EN MI VP A B C integer C320 array of integer Auxiliar array of array of int
23. Vactival Vactiva2 dd ee ee E ee ME DA EL ORDEN SI HAY UNA ANTES QE MD ds iM lE D M eee Te eee ee ELEC EE t for I 1 to High ElemVp do NuevoOrden I 0 for I 1 to High ElemVp do begin if NuevoOrden I 0 then NuevoOrden I I for J 1 to High ElemVp I do if ElemVp 1 J gt I then if NuevoOrden ElemVp LJ 0 then begin for K 1 to High ElemVp do if NuevoOrden K gt I then NuevoOrden K K 1 NuevoOrden ElemVp I J I end if NuevoOrden ElemVp I J 0 then end for I 1 to High ElemVp for I 1 to high Micodigos ElemVp do AQUI CAMBIO DE VALOR A MI ELEMVP SEGUN EL NUEVO ORDEN for J 1 to High ElemVp I do PARA PASAR ENTRE LOS ELEMENTOS Elemvp 1 J NuevoOrden Elemvp 1 J for I 1 to high Micodigos ElemVp do PARA MODIFICAR A LOS VP begin SysPert Manual T cnico VActiva2 Recall LEso Eso VP for J 1 to High ElemVp I 1 do PARA PASAR ENTRE LOS ELEMENTOS eso vp eso vp IntToStr Elemvp LJ eso Vp eso vp IntToStr Elemvp 1 High ElemVp I VActiva2 Store LEso end for I 0 to high Micodigos GruposA do PARA MODIFICAR A LOS GRUPOS gt for J 0 to High Micodigos GruposA I do Micodigos GruposA LJ NuevoOrden Micodigos GruposA LJ modifica los numero en el orden los nuevos grupos for I 1 to VActiva2 MaxVectorSize do begin VActiva2 Recall NuevoOrden I eso eso index I Vactiva3 Store I eso end for I 1 to VActiva2 MaxVectorSize
24. begin AssignFile f NomAr Reset f fmMain Caption NomAr with fmMain sgActiviDatos do begin k 1 RowCount 1 while not EOF f do begin Read f Lin RowCount RowCount 1 FixedRows 1 for kl 0 to 6 do Rows k Strings kl Lin kl inc k end while end with btCreaRed Enabled True Calcularl Enabled False end if NomAr else end if Ok then end btRecuperarClick procedure TfmMain Terminarl Click Sender TObject Cierra la aplicaci n begin Application Terminate end 46 SysPert Manual T cnico procedure preparardatos Prepara los datos para su proceso asignando c digos a las actividades begin MiCodigos Tcodigos Create with MiCodigos do begin VerifComas GuardarDatos VERIFICA QUE LOS ELEMENTOS NO SOBREPASE LOS LIMITES Y LOS GUARDA REGRESA 0 SI ESTA BIEN 1 SIESTA MAL CodAparicion IME GENERA LA TABLA Y ME DICE SI VIENE SOLA O ACOMPA ADA Cm32 GuardaCM32 MiOrden CrearMiDondeEstan OrdenVP CR borrar end with MiCodigos end preparardatos nn EEE procedure TfmMain CargarDatos2 Carga el vector VEstima con base en V Actival y los tiempos de la tabla de datos Var k Integer rEstima TEstima rActiva TV Activa S string begin for k 1 to VEstima MaxVectorSize do begin VActival Recall K rActiva rEstima Index k S sgActiviDatos Cells 3 rActiva Index2 rEstima tOp StrToFloat sgActiviDatos Cells 3 rActiva Index2 Aqu tr
25. de software resulta la funci n que calcula el rea bajo la curva AreaBC function AreaBC A B real N integer real Calcula el rea bajo la curva con la f rmula trapecial Luthe pp 170 181 var i j M integer begin for i 1 to 2 do begin H B A N X A Area i 0 inicializa la i sima sumatoria M N 1 n mero de subintervalos para el c lculo for j 1 to M do begin ciclo que obtiene la sumatoria de las reas de los subintervalos X X H Area i Area 1 Y X end for j Area i H Y A Y B 2 Area i 2 f rmula trapecial N 2 N end for 1 Rich 4 Ar ea 2 Ar ea 1 3 linterpolaci n de Richardson entre las dos sumatorias N y 2N subintervalos AreaBC Rich end AreaBC La funci n AreaBC la utilizan los procedimientos CalcArearZ CalcAreaZZ CalZlzq y la funci n Kalcula de UValz La funci n Kalcula es una aportaci n relevante y original del grupo de investigaci n resuelve el c lculo del valor de la variable aleatoria en la distribuci n normal a partir del valor del rea bajo la curva La t cnica consiste en una exploraci n de izquierda a derecha en la curva utilizando un par de valores l mite de un peque o intervalo b b hasta que el valor buscado x de la variable aleatoria quede entre ambos Despu s se realiza una fase de precisi n aproximando los valores exploradores b y b al valor buscado x para obtener los mejores resultados Al respecto se utilizan dos factores de aproximaci
26. decir donde se encuentran los grupos if DondeGrupos J Posicion lt gt 0 then posicion posicion 1 SetLength DondeGrupos J posicion 1 DondeGrupos J Posicion A SetLength Grupos A 1 end fif ColaCm32 Items In gt 2 then ColaCm32 Clear Posicion 0 end for J I 1 to VActival MaxVectorSize FIN DEL FOR I y J SetLength OrdenGrupos High Grupos for I 0 to High OrdenGrupos do OrdenGrupos I I 1 for I 0 to High Grupos 2 do PARA OBTENER GRUPOS NO REPETIDOS 92 SysPert Manual T cnico for J I 1 to High Grupos 1 do begin if High Grupos I High Grupos J then begin A 0 if High Grupos I gt 0 then for K 0 to High Grupos I do for L 0 to High Grupos I do if Grupos LK Grupos J L then A A 1 if A 1 High Grupos I then begin SetLength Grupos J 1 AQUI ME PONE EN cero A LOS REPETIDOS OrdenGrupos J I 1 end if A 1 High Grupos I then end if High Grupos I High Grupos J 1f end for J I 1 to High Grupos 1 FIN FOR J EI for I 0 to High DondeGrupos 1 do ENCUENTRAN LOS GRUPOS for J 0 to High DondeGrupos I do PARA OBTENER DONDE SE DondeGrupos LJ OrdenGrupos DondeGrupos LJ 1 posicion High DondeGrupos 0 A 0 for I 0 to High Grupos do PARA AHORAR MEMORIA begin if High Grupos I gt 0 then AN COPIARLOS EN GRUPOS A begin A AHl SetLength GruposA A SetLength GruposA A 1 J High Grupos I 1 for J 0 to High Grupos I do
27. del proyecto para un evento i del proyecto De esta manera el gerente del proyecto puede programar con la probabilidad de que un cierto evento nodo i se cumpla cuando mucho en un tiempo TP i que se cuantifica en forma conveniente de acuerdo al modelo PERT probabil stico Estos valores de probabilidad se pueden tener consultando las tablas de distribuci n normal est ndar extensamente publicadas Ejemplo Con la red proyecto cuyos tiempos estimados se anotan en tabla como to tm tp para cada trabajo determine un programa de tiempos esperados T i para cada evento nodo i Duraci n estimada Tiempo esperado Variancia C lculo con la f rmula de S i Tiempo esperado y variancia de trabajos en red proyecto del ejemplo El software produce la soluci n de nodos en pares i j de este ejemplo con 13 trabajos Red proyecto del ejemplo con trabajos y tiempos te La aplicaci n del software al ejemplo planteado entrega los siguientes resultados como programa de tiempos a cumplir en el proyecto con la informaci n de las holguras en trabajos no cr ticos As la administraci n puede preparar el movimiento de recursos a la actividad que le convenga La tabla que sigue contiene la estructura que se prepar para la interfase de entrega del programa m todo PERT para proyectos NODO Tiempo Varianza tiempo EVENTO i Ruta mayor lesperadoTi Sei programado Zi TP i Ti Si Probabilidad TP i 0 2473 1 2 4 5 7 i 0 3665
28. do begin VActiva3 Recall Leso Vactival Store I eso end Vactival Vactiva3 a MiCodigos GuardarDatos aqui los pongo en su lugar nuevo al vp end TCodigos MiOrden AERE EAE E da E E E E ER AE E eee eee aT A AT a a o E procedure TCodigos Ordenar var ij d l temp n k integer eso esol eso2 TVActiva begin n V Actival Max VectorSize d 1 while d lt n do d d 2 repeat d d div 2 88 SysPert Manual T cnico for I 1 to n d 1 do begin j i l j d VActival Recall l eso carga ambos datos VActival Recall j esol while j gt 1 and eso LVP lt eso1 LVP do begin eso2 eso eso esol esol eso2 VActival Store l eso carga ambos datos VActival Store j esol I j j d end while j gt 1 and eso LVP lt esol LVP end for I 1 to n d 1 until d lt 0 end TCodigos Ordenar LEER O A dn a ee SEEK ore eee eee D LLLI ee eee Rees The eee a EEE procedure TCodigos GuardaCM32 var eso TVActiva ij k 1 m n a z Integer compara integer compara2 integer Orden array of array of integer GruposArreglados array of array of integer NuevoDondeEsta array of array of integer begin compara 0 Compara2 0 for I 1 to VActival MaxVectorSize do PRIMERO PONGO EN TODOS UNOS Y CEROS begin VActival Recall I eso if eso cApar 3 then eso cM3 1 else eso cM3 0 VActival Store I eso end for I 1 to VActival MaxVectorSize
29. el ndice de la actividad al final de Colal en caso contrario elimina la actividad del carrusel Los valores del par i j se almacenan en VActival En la entrada al ciclo l nea 2 se verifica el c digo de repetici n cR de cada actividad para evitar repetir innecesariamente parte del proceso ya que ambas actividades tienen el evento inicial i com n En la l nea 4 se obtiene la actividad con inicio com n y en la l nea 5 se asigna el mismo evento inicial a la actividad con inicio com n Si el c digo de repetici n cR es igual a cero el control se transfiere a la linea 20 para iniciar el proceso de la actividad y obtener el par i j invocando al procedimiento Pares La l nea 22 verifica si el Ok de la actividad procesada es igual a cero en cuyo caso se regresa la actividad a Cola para su proceso posterior La l nea 24 decola la siguiente actividad en Colal y se repite el proceso descrito hasta que Cola est vac a repeat if Al cR gt 0 actividad con inicio com n con otra then begin VActival Recall Al cR Ap se busca en VActival la actividad con inicio com n A1 1 Ap i asigna el evento de inicio com n misma i VActival Store A1 Index A1 if Colal Items In lt nT then begin if not flJMax then begin inc JMax flJMax True end VActival Recall Ax Index A1 Al j JMax A1 Ok 1 VActival Store A1 Index A1 end end else Pares Ax VActival Recall Ax Index A1 if Al Ok 0 then Colal EnQueue Ax SizeOf Ax
30. hecha false end with fmMain end IniciaFormas procedure Resetear Reinicializa diversos objetos utilizados por la aplicaci n vectores y colas begin Colal Clear VActival Done Gpo Done VDura Done JGpo Done VCpm Done FicVector Done VEstima Done end procedure MiGrafica 37 SysPert Manual T cnico Env a las i j de las actividades para graficar la red Var LK Integer Tipos array of word L Word begin setLength Tipos FmMain SgCPM RowCount 1 Grafica Dar Tamano FmMain SgCPM RowCount 1 For I 0 to FmMain SgCPM RowCount 2 do para guardar las I J de las actividades begin if AnsiPos 0 0 FmMain SgCPM cells 3 1 1 0 then begin Tipos I 0 end else Tipos I 2 end For k 0 to High Indicedos do para guardar las I J de las actividades begin if Tipos Indicedos k 1 0 then Tipos Indicedos k 1 1 else Tipos Indicedos k 1 3 end ya encontre los tipos de actividades k 1 for I 0 To High Tipos do begin if Tipos I lt 1 then begin L StrToInt FmMain SgCPM cells 1 I 1 Grafica GuardarCordenadas K L StrToInt FmMain SgCPM cells 2 I 1 Tipos I inc k end end for I 0 To High Tipos do begin if Tipos I gt 1 then begin Grafica GuardarCordenadas K StrToInt FmMain SgCPM cells 1 I 1 StrToInt FmMain SgCPM cells 2 I 1 Tipos I inc k end 38 SysPert Manual T cnico end end MiGrafica p
31. if Ap tPx gt maxTPx then maxTPx Ap tPx inc nk until nk Vcpm VSize nk 1 repeat determina los tiempos de inicio y terminaci n pr ximo Vepm Recall nk Ap if Ap i ki then begin Ap iPx maxTPx Ap tPx maxTPx Ap Dur Vcpm Store Ap Index Ap end inc nk until nk gt Vcpm VSize end until k Vcpm VSize or fITp if maxTPx gt DurPro then DurPro maxTPx until ki JMax verificar que JMax sea el valor m s alto para las j s end Proximo procedure Lejano var k kj nk integer Al Ap TRVcpm fITL boolean miniLx real integer begin k Vcpm VSize 1 repeat se procesan las actividades terminales primero dec k Vcpm Recall k A 1 if Alj JMax then begin Al tLx DurPro Al iLx Al tLx Al Dur Vcpm Store Al Index A 1 end until k lt 1 kj JMax repeat dec kj flTL False k Vcpm VSize 1 repeat dec k Vcpm Recall k A 1 if Al i kj 100 SysPert Manual T cnico then begin flTL True miniLx A1 iLx nk k 1 repeat Vepm Recall nk Ap if Ap i kj then if Ap iLx miniLx then miniLx Ap iLx dec nk until nk lt 1 nk Vcpm VSize 1 repeat Vepm Recall nk Ap if Ap j kj then begin Ap tLx miniLx Ap iLx miniLx Ap Dur Vcpm Store Ap Index Ap end dec nk until nk lt 1 end until k 1 or fITL until kj 1 end Lejano procedure Holguras var k nk integer Al Ap TRVcpm rRC TRC rEstima TEstima flOk boolean begin k 0 qHol Init SizeOf rRC 10
32. mas peque o end otro SetLength GruposA I High GruposA J 1 cambio el tama o del guardado al del SetLength GruposA J High GruposA I for K 0 to High GruposA I do GruposA I k GruposA J k SetLength GruposA J High AuxA 0 1 for K 0 to High GruposA J do GruposA J k AuxA 0 k end if GruposA I 0 gt GruposA J 0 then HASTA AQUI TENGO LOS GRUPOS YA ORDENADOS Y MODIFICADOS AHORA BUSCO A LOS GRUPOS AQUI SetLength MiDondeGrupos 0 SetLength MiDondeGrupos VActival MaxVectorSize 1 vector que me dira que grupos contiene los lvp for I 0 to High GruposA do BUSCARE POR GRUPO EN LOS VP begin for J 1 to High ElemVp do J revisar esta parte begin A 0 if High ElemVp J gt 1 SI HAY MAS DE UN ELEMENTO ENTONCES BUSCA then begin if GruposA I K ElemVp J L then inc A if A High GruposA I 1 For K 0 to High GruposA I do BUSCA SI HAY SE ENCUENTRA EL GRUPO For L 0 to High ElemVp J do then begin N High MiDondeGrupos J 1 SetLength MiDondeGrupos J N 1 MiDondeGrupos J N I 1 84 SysPert Manual T cnico end if A High GruposA I 1 then end if High ElemVp J gt 1 then end for J 1 to High ElemVp end for I 0 to High GruposA AQUI YA ENCONTRE DONDE SE ENCUENTRAN LOS GRUPOS end TCodigos CrearMiDondeEstan LLLLLLLLLELLLELLELLELLLLLLLLLELLELLLLLLLLLLLLELLLLLLLLLLLLLLLLLLLELLLLI EEEE EEE E A AA dd UE a aa procedure TCodigos MiOrden
33. una petici n de c lculo por ejemplo a probabilidad de terminar el proyecto antes de su tiempo programado TP ejecuta las siguientes instrucciones para el m dulo UPert rParm 1 1 rParm 2 FloatToStr StrToFloat sTP Mu Sigma rParm 3 1 cPert rParm y as se configura la l nea de par metros para la petici n con el arreglo rParm de tres elementos rParm gt 1 FloatToStr StrToFloat sTP Mu Sigma 1 25 SysPert Manual T cnico la cual ser interpretada en UPert por la siguiente estructura case de opci n m ltiple case StrToInt cParm 1 of 1 CalcAreaZ StrToFloat cParm 2 StrToInt cParm 3 2 CalcAreaZZ StrToFloat cParm 2 StrToFloat cParm 3 StrToInt cParm 4 3 CalcAreaZZ StrToFloat cParm 2 StrToFloat cParm 3 StrToInt cParm 4 4 CalcAreaZZ StrToFloat cParm 2 StrToFloat cParm 3 StrToInt cParm 4 5 CalZIzq StrToFloat cParm 2 StrToFloat cParm 3 StrToFloat cParm 4 StrToInt cParm 5 end case Cada una de las cinco opciones del case precedente invoca con los parametros correspondientes alguno de los tres m dulos CalcArearZ CalcAreaZZ CalZlzq de la unidad UValz los cuales se describen con amplitud m s adelante 26 SysPert Manual T cnico UNIDAD UValz UValz resuelve a trav s de m todos num ricos de integraci n el problema del c lculo del rea bajo la curva de la funci n que representa la distribuci n normal o Campana de Gauss y que perm
34. 00 repeat inc k Vcpm Recall k A 1 A1 hTotal Al iLx Al iPx holgura total de la actividad if Al hTotal 0 selecciona las actividades sin holgura para la ruta cr tica then begin SetLength IndiceDos High IndiceDos 2 IndiceDos High IndiceDos A 1 Index rRC Index A 1 Index rRC 1 A1 1 RC j Al j 101 SysPert Manual T cnico qHol EnQueue rRC SizeOf rRC VEstima Recall A 1 Index rEstima Sigm Sigm rEstima Varianza end nk A1 Index A1 hLib 0 flOk False repeat inc nk Vepm Recall nk Ap if Vepm VectorOpStatus and Al j Ap i then begin A1 hLib Ap iPx A1 tPx calcula la hilgura libre flOk True end until Ok or A1 hLib gt 0 or not Vcpm VectorOpStatus if not Vepm VectorOpStatus then Al hLib DurPro Al tPx A1 hInter A1 hTotal A1 hLib calcula la holgura de interferencia Vcpm Store Al Index A 1 until k Vcpm VSize end Holguras procedure CargaTabla var i nk k integer aFuente TV Activa aDestino TRVcpm sNk shortString rFic TRFic rEstima TEstima begin FicVector Init ColaFic Items In for 1 1 to ColaFic Items In do begin ColaFic DeQueue rFic SizeOf rFic FicVector Store i rFic end for i nk FicVector V Size Vepm Init VActival VSize nk 1 0 repeat carga las iniciales en Vcpm inc i VActival Recall i aFuente VEstima Recall 1 rEstima if aFuente LVP 0 then begin aDestino Index aFuente Index aDestino i aFuente i 102
35. 3 flM3 tempflP flP tempflDoneCaso2 flDoneCaso2 tempRFic RFic tempJComun JComun if pivAp i 0 then begin tempc VPA EnQueue Ap Index SizeOf Ap Index Pares pivAp VActival Recall pivAp Index pivAp end else begin end end iFaltante begin ParMas flDoneCaso2 False utilizada en caso2 con IMisma VActival Recall Ax Index A 1 ColaVP Init SizeOf word A1 LVP cVPA Init SizeOf word A1 L VP ColaIP Init SizeOf word 1000 ColaAP Init SizeOf word 1000 flP False flM2 False fiM3 False fliCero False SVP A1 VP for n 1 to AI LVP 1 do begin S Copy SVP 1 Pos SVP 1 Val S aVP Code ColaVP EnQueue aVP SizeOf word cVPA EnQueue aVP SizeOf word Delete SVP 1 Length S 1 end for n 1 to cVPA Items In do begin cVPA DeQueue aVP SizeOf aVP 75 SysPert Manual T cnico VActival Recall aVP Ap fIM3 Ap cApar 3 cVPA EnQueue aVP SizeOf aVP end Val SVP aVP Code ColaVP EnQueue aVP SizeOf word cVPA EnQueue aVP SizeOf word while not cVPA Is Empty do begin cVPA DeQueue aVP SizeOf word VActival Recall aVP Ap if Ap cApar 1 or Ap cApar 2 then Caso2 else begin if cVPA Is Empty then jPendiente else begin fliCero Ap i 0 para ejecutar IFaltante pivAp Ap revisar si es la ltima de cVPA kAux cVPA Items In repeat cVPA DeQueue aVP SizeOf word VActival Recall aVP Ap fliCero Ap i 0 para ejecutar IFaltante fIM2 pivAp 1 A
36. A 0 begin VActiva2 Store A eso A A 1 end if eso LVP lt gt 0 and eso cApar 0 then end for I 1 to VActival MaxVectorSize for I 1 to VActival MaxVectorSize do begin GENERA UN NUEVO ARREGLO VActiva2 Recall Leso EL CUAL SERVIRA PARA SABER COMO SE CAMBIARAN LOS VALORES DE NuevoOrden eso Index I ElemVp PARA DESPUES SER ALMACENADOS NUEVAMENTE end for I 1 to VActival MaxVectorSize V Actival V Activa2 a MiCodigos GuardarDatos aqui los pongo en su lugar nuevo al vp for I 1 to high Micodigos ElemVp do AQUI CAMBIO DE VALOR A MI ELEMVP SEGUN EL NUEVO ORDEN for J 1 to High ElemVp I do PARA PASAR ENTRE LOS ELEMENTOS Elemvp LJ NuevoOrden Elemvp 1 J for I 1 to high Micodigos ElemVp do PARA MODIFICAR A LOS VP begin VActiva2 Recall I Eso Eso VP for J 1 to High ElemVp I 1 do PARA PASAR ENTRE LOS ELEMENTOS eso vp eso vp IntToStr Elemvp LJ 86 SysPert Manual T cnico eso Vp eso vp IntToStr Elemvp LHigh ElemVp I VActiva2 Store LEso end for I 1 to high Micodigos ElemVp for I 0 to high Micodigos GruposA do PARA MODIFICAR A LOS GRUPOS gt modifica los for J 0 to High Micodigos GruposA I do Micodigos GruposA LJ NuevoOrden Micodigos GruposA LJ numero en el orden los nuevos grupos for I 1 to VActiva2 MaxVectorSize do begin VActiva2 Recall Leso Eso Index Vactiva2 Store I Eso end
37. Actival Store A1 Index A1 end else for m 1 to k do begin ColaVP DeQueue aT SizeOf word VActival Recall aT A Temp if MaxJ Atemp j then begin MaxJ ATemp j JTemp Ap j Ap j ATemp ATemp j JTemp VActival Store Ap Index Ap VActival Store Atemp Index Atemp end if ATemp cApar 3 then begin ATemp j JMax ATemp Ok 1 VActival Store Atemp Index Atemp end else ColaVP EnQueue aVP SizeOf word Ap Ok 1 Al i Ap j VActival Store Ap Index Ap VActival Store Al Index A1 end if fliP then begin RFic j Ap j fliP False ColaIP EnQueue R Fic i SizeOf word repeat ColalP DeQueue R Fic i SizeOf word ColaFic EnQueue RFic SizeOf RFic until ColalP Is_Empty end JMax MaxJ end Caso3 procedure jPendiente begin 63 SysPert Manual T cnico if Ap j 0 then begin inc JMax Ap j JMax end if fliP then begin RFic j Ap j fliP False ColaIP EnQueue R Fic i SizeOf word repeat ColalP DeQueue R Fic i SizeOf word ColaFic EnQueue RFic SizeOf RFic until ColalP Is_Empty end Ap Ok 1 VActival Store Ap Index Ap Ali Apy VActival Store Al Index A 1 end jPendiente procedure M1 begin repeat ColaVP DeQueue aVP SizeOf word VActival Recall aVP Ap case Ap cApar of 1 2 Caso2 3 Caso3 end fcase until ColaVP Is_Empty end M1 procedure SolPivote Ap TActiva begin end SolPivote procedure SolMi cMi Queue Ax TAc
38. Ap end end else if cc32 end IDiferente procedure Caso2 var f131 f132 mismal cc3 boolean kAux integer begin pivAp Ap fl31 False f132 False 61 SysPert Manual T cnico for kAux 1 to cVPA Items In do begin determinar si hay a31 y a32 mediante un carrusel en cVPA cVPA DeQueue aVP SizeOf aVP VActival Recall aVP Ap if Ap cM3 1 then f131 True levanta f131 si hubiera a31 if Ap cM3 2 then f132 True levanta f132 si hubiera a32 cVPA EnQueue aVP SizeOf aVP end for kAux 1 to cVPA Items In if pivAp cM3 0 or pivAp cM3 2 and not fl31 and f132 then begin mismal False cc3 False pivAp Ap kAux cVPA Items In if kAux gt 0 then begin repeat cVPA DeQueue aVP SizeOf word cVPA EnQueue aVP SizeOf word VActival Recall aVP Ap if Ap cApar 3 or pivAp cApar 3 then begin cc3 True cc32 Ap cM3 2 revisar que al final quede el valor correcto para cc32 end if pivAp i Ap i then mismal True dec kAux until kAux 0 end if not cc3 and mismal then IMisma else IDiferente end pivAp cM3 0 or pivAp cM3 2 and fl31 or f132 end Caso2 procedure Caso3 var m k JTemp MaxJ word begin if Ap j 0 then begin if Ap cApar 3 then inc JMax Ap j JMax VActival Store Ap Index Ap end MaxJ Ap k ColaVP Items In 62 SysPert Manual T cnico if k lt 1 then begin Ap Ok 1 Al 1 Ap j VActival Store Ap Index Ap V
39. Cero var Ax TActiva var Al TVActiva begin VActival Recall Ax Index A 1 Ali VActival Store Al Index A 1 end PreCero procedure ParUno var Ax TActiva var Al Ap TVActiva VPIndex word begin VActival Recall Ax Index A 1 VPIndex StrToInt A 1 VP VActival Recall VPIndex Ap if Ap j 0 then begin inc JMax Ap j JMax end Ali Apy Ap Ok 1 True V Actival Store A1 Index A1 V Actival Store Ap Index Ap end PreUno procedure ParMas var Ax TActiva var A1 Ap ATemp pivAp TV Activa ColaVP cVPA ColaAP ColalP cMi Queue n aT aVP kAux word Code integer fliCero findica que aluna actividad del VP tiene 1 0 ver l neas 718 y 724 fIM2 fIM3 58 SysPert Manual T cnico fIP flDoneCaso2 boolean RFic TRFic JComun word S SVP string procedure IMisma begin if pivAp cApar 2 then begin if pivAp j 0 then begin inc Jmax pivAp j JMax end if fliP then begin ColaIP EnQueue RFic i SizeOf word RFic i pivAp end else begin RFic i pivAp fliP True end end else begin kAux cVPA Items In if kAux gt 0 then begin repeat cVPA DeQueue aVP SizeOf word VActival Recall aVP A p if fliP then begin ColaIP EnQueue RFic i SizeOf word RFic i Ap j end else begin RFic i Ap j fliP True end dec kAux until kAux 0 end end else inc JMax JComun JMax if fliP then ColaIP EnQueue RFic i SizeOf word 59 SysPert M
40. Dura Init RowCount 1 nT 0 for k 1 to RowCount 1 do begin rActiva Index StrToInt Rows k Strings 0 rActiva Nombre Rows k Strings 1 rActiva LVP 0 StrToInt Rows k Strings 2 rActiva VP Rows k Strings 2 rActiva i 0 StrTolnt Rows k Strings 4 rActiva j 0 StrToInt Rows k Strings 5 rActiva cApar 0 StrToInt Rows k Strings 6 rActiva cM3 0 StrToInt Rows k Strings 7 rActiva cR 0 StrToInt Rows k Strings 8 VDura Store k fmMain sgActiviDatos Rows k Strings 9 rActiva Ok 0 rActiva index2 k VActival Store k rActiva hf rActiva LVP gt 0 and rActiva cApar 0 then inc nT MA considerar la variable nT en sus rutinas Cola EnQueue rActiva Index SizeOf word end end with fmMain sgActiviDatos fmMain btCreaRed Enabled True end CargaDatos procedure ReCargaDatos Carga la tabla de resultados con los valores calculados var k nk integer rActiva TV Activa rFic TRFic rRC TRC rEstima TEstima rCpm TRVcpm sDura ShortString X real begin 42 SysPert Manual T cnico fmMain sgCPM Visible True fmMain sgRC Visible True with fmMain sgFic do begin RowCount 1 k 0 if FicVector VSize gt 0 not ColaFic Is Empty then begin Visible True fmMain lbFicticias Visible True repeat RowCount RowCount 1 FixedRows 1 inc k FicVector Recall k rFic Rows k Strings 0 Format 5d k IntToStr k Rows k Strings 1 Format 5
41. E CAPAR 3 begin Y CM3 1 for J 0 to High ElemVp I do begin Vactival Recall ElemVp I J eso if eso cApar 3 and eso cM3 1 then begin Auxiliar Lc320 I ElemVp LJ c320 1 c320 1 1 end if eso cApar 3 and eso cM3 1 then end for J 0 to High ElemVp I j end for 1 0 to High ElemVp AQUI SE PONEN LOS GRUPOS O SEA EL CODIGO 32 for I 1 to high ElemVp do con este paso entre los elementos del vp begin if High MiDondeGrupos I gt 0 AQUI VEO SI HAY GRUPOS then begin B 1 for A 1 to High Auxiliar I do if Auxiliar I A lt gt 0 then inc B esto lo analizas Wi for J 0 to High MiDondeGrupos I do ES LA QUE ME DICE QUE Y CUANTOS GRUPOS TIENE begin for K 0 to High GruposA MiDondeGrupos I J 1 do PARA PASAR EN LOS ELEMENTOS DEL GRUPO begin for L 1 to High Auxiliar I do PARA PASAR ENTRE LOS ELEMENTOS YA GUARDADOS Si no he guardado el elemento ESTA PARTE ESTA MAL if Auxiliar I L GruposA MiDondeGrupos LJ 1 k then C 1 ya esta en el vp if C 0 SI NO ESTA EN EL VP LO PONE 82 SysPert Manual T cnico then begin Auxiliar I B GruposA MiDondeGrupos LJ 1 K inc B end 1f C 0 then C 0 end for K 0 to High GruposA MiDondeGrupos I J 1 end for J 0 to High MiDondeGrupos I end if High MiDondeGrupos I gt 0 then end for I 1 to high ElemVp Y A NO LO TENGO QUE PONER O MAS BIEN SI PARA GUARDAR LA NUEVA CADENA for I 1 to h
42. EEE E DL LM FUNCTION Stack Is Full BOOLEAN BEGIN Is Full Size gt MaxSize END Stack Is Full di AG o eat AA E CC FUNCTION Stack Is Status Ok BOOLEAN BEGIN Is Status Ok Last Op Ok END Stack Is Status Ok Rad da QI M D Md M ARMED FUNCTION Stack Items In WORD BEGIN 126 SysPert Manual T cnico Items In Size END Stack Items_In Rs nd O a EE PROCEDURE Stack Push VAR Item UNTYPEDy ItemSize WORD VAR NewNodePtr StackNodePtr BEGIN Status Reset Last_Op_Ok FALSE IF Size gt MaxSize THEN Status OverFlow TRUE ELSE IF ItemSize lt gt InfoSize THEN Status Object_MisMatch TRUE ELSE BEGIN Last_Op_Ok TRUE New NewNodePtr NewNodePtr Init inserting Item of ItemSize Top Top NewNodePtr Inc Size END If END Stack Push pete Phe PIER Ree EEEE eee EE PROCEDURE Stack Pop VAR Item UNTYPED ItemSize WORD VAR TrashNodePtr StackNodePtr BEGIN Status Reset Last Op Ok FALSE IF NOT Size gt 0 THEN Status UnderFlow TRUE ELSE IF ItemSize lt gt InfoSize THEN Status Object MisMatch TRUE ELSE BEGIN Last Op Ok TRUE TrashNodePtr Top Top Top Next Dec Size TrashNodePtr Yield Info Item of ItemSize TrashNodePtr Clear ItemSize Dispose TrashNodePtr END If END Stack Pop iS PROCEDURE Stack Show Status VAR F TEXT BEGIN 127 SysPert Manual T cnico Write F OBJECT STATUS 9
43. GruposA A 1 J Grupos LJ end if High Grupos I gt 0 then if I lt High Grupos then OrdenGrupos I High GruposA 1 end for I 0 to High Grupos do for I 0 to High DondeGrupos 1 do ENCUENTRAN LOS GRUPOS for J 0 to High DondeGrupos I do PARA OBTENER DONDE SE DondeGrupos I J OrdenGrupos DondeGrupos I J 1 SetLength MiDondeGrupos High DondeGrupos 1 93 SysPert Manual T cnico for I 0 to High DondeGrupos do begin SetLength MiDondeGrupos I High DondeGrupos I 1 for J 0 to High DondeGrupos I do begin MiDondeGrupos LJ DondeGrupos LJ DE AQUI ME DICE QUE GRUPOS CONTIENE Y EN DONDE ESTAN end REPETIDOS Y TODO 1 2 3 3 4 end end TCodigos Cm32 SEE AEEA E EE a a a eee abe ETE ET E A aE E EEEE E EE a KEA E A S A a E a A aa En Ga a E procedure TCodigos CodAparicion var I integer J integer L integer K integer eso TV Activa begin SetLength CodApa V Actival MaxVectorSize 2 for I 1 to VActival MaxVectorSize do SetLength CodApa I 3 for E 1 to VActival MaxVectorSize do ESTE FOR ES PARA LLENAR LA TABLITA DE CEROS for J 1 to 2 do CodApalI J 0 for 1 1 to V Actival MaxVectorSize do for J 1 to High ElemVp I do HASTA EL NUMERO DE ELEMNTOS begin IESTOS FOR ME LLENAN LA TABLA QUE LES EXPLIQUE if ElemVp LJ lt gt 0 then begin if High ElemVp I 1 then CodApa ElemVp LJ 1 1 QUE SI VIENE SOLO ESE ELEMENTO LE PONENE UN 1 if High ElemVp I g
44. Hol VEstima Recall rRC Index rEstima Sigma Sigma rEstima Varianza end for ik 1 to qHol Items_In Sigma Sqrt Sigma rParm 1 2 rParm 2 FloatToStr StrToFloat sTP Mu Sigma end if Ok then Ok InPutQuery Probabilidad de terminar el proyecto entre TP1 TP2 Escriba el TP2 sTP if Ok then begin rParm 3 FloatToStr StrToFloat sTP Mu Sigma rParm 4 1 cPert rParm end end Terminarelproyectoenelperiodol Click procedure TfimMain AlrededordesuTP1 Click Sender TObject Calcula la probabilidad de terminar el proyecto en su TE d var Ok boolean ik integer rEstima TEstima rRC TRC rParm TcParm begin Ok InPutQuery Prob alrededor de su TE Escriba el T sTP if Ok then begin Sigma 0 Mu DurPro for ik 1 to qHol Items_In do begin repeat qHol DeQueue rRC SizeOf rRC qHol EnQueue rRC SizeOf rRC preserva qHol VEstima Recall rRC Index rEstima Sigma Sigma rEstima Varianza end for ik 1 to qHol Items_In Sigma Sqrt Sigma rParm 1 3 rParm 2 FloatToStr StrToFloat sTP Sigma rParm 3 FloatToStr StrToFloat sTP Sigma 50 SysPert Manual T cnico rParm 4 2 cPert rParm end if Ok then end procedure TfmMain Exactamenteenl Click Sender TObject Calcula la probabilidad de terminar el proyecto exactamente en T var Ok boolean ik integer rEstima TEstima rRC TRC rParm TcParm begin Ok InPutQuery Prob t rmino exactamente en T
45. IF Last Op Ok THEN WriteLn F Last constructor was successful ELSE IF Status OverFlow THEN WriteLn F Attempted an insertion into a full structure ELSE IF Status UnderFlow THEN WriteLn F Attempted a deletion from an empty structure ELSE IF Status Object MisMatch THEN WriteLn F Attempted an insertion deletion with wrong type object ELSE IF Status Dynamic Memory Exhausted THEN WriteLn F Heap exhausted attempted insertion ignored ELSE IF Status General Failure THEN WriteLn F General failure EndIf END Stack Show_ Status Lees ae ere te E E ERA Ce Tee ee EM LLL EA dx E LLL EL I ETT EE Aud up LRL Re IL LLL LM EE k E M 1 QueueNode Method extends methods of StackNode ac LM LK MEL Ql NL LLL LL AEE EE LLL PROCEDURE QueueNode SetNext to Ptr QueueNodePtr BEGIN Next Ptr END QueueNode SetNext OTT a EE EE Queue Methods FEER REA A eee a NERA EE EE E IR ETE eae E PROCEDURE Queue Init ItemSize WORD Maxltems WORD BEGIN Stack Int ItemSize MaxItems Bottom NIL END Queue Init ooo tee Te TEE Re eT ae IDEE EH PROCEDURE Queue Clear BEGIN Stack Clear Bottom NIL END Queue Clear 128 SysPert Manual T cnico Gn a Ree he TER A PROCEDURE Queue EnQueue VAR Item UNTYPED ItemSize WORD VAR NewNodePtr QueueNodePtr NewElemPtr POINTER BEGIN Status Reset Last_Op_Ok FALSE IF Size gt MaxSize THEN Status OverFl
46. Instituto Polit cnico Nacional qe 5 Unidad Interdisciplinaria de Ingenier a a y Ciencias Sociales y Administrativas een upiesa SISTEMA AUTOMATIZADO PARA EL CONTROL DE PROYECTOS EN LA PEQUENA Y MEDIANA EMPRESAS MEXICANAS primera etapa Registro CGPI 20060083 ANEXO AL INFORME FINAL Profesores Participantes Ing Carlos Careaga De La Garza Lic Humberto Oviedo Galdeano Ing Mario Oviedo Galdeano M xico D F enero de 2006 INTRODUCCION El paquete se dise para obtener tres productos de software que pudieran operar independientemente o bien integrados en un solo paquete y con otros m dulos que se podr n a adir en la segunda etapa del proyecto prevista para un siguiente per odo Los tres productos se han denominado SysRed SysCpm y SysPert Nuestro paquete de software pretende automatizar la construcci n de una red de actividades y utilizarla para la programaci n de tiempos en cualquier proyecto Su dise o se basa en las t cnicas de planeaci n y programaci n La metodolog a PERT cuyo modelo considera en forma m s realista el concepto de probabilidad para los tiempos de las actividades que intervienen en un proyecto las duraciones de los trabajos son tiempos esperados a cumplir El m todo PERT probabil stico se basa en tiempos estimados de gente que conoce el tipo de actividad por realizar En este anexo se hace una explicaci n general de la t cnica que se aplica para resolver problemas de redes d
47. JGpo VSize JComun 0 for kAux 1 to cVPA Items In do begin calcula la JComun para las 31 en carrusel cVPA DeQueue aVP SizeOf aVP VActival Recall aVP A p if Ap j gt 0 and Ap cM3 1 then JComun Ap j cVPA EnQueue aVP SizeOf aVP end for kAux 1 to cVPA Items Inj if JComun 0 then begin inc JMax JComun JMax end for kAux 1 to cVPA Items In do begin procesa las A31 utilizando la JComun en carrusel cVPA DeQueue aVP SizeOf aVP VActival Recall aVP A p if Ap cM3 1 then begin Ap j JComun Ap Ok 1 VActival Store Ap Index Ap end cVPA EnQueue aVP SizeOf aVP end for kAux 1 to cVPA Items Inj if fliP then ColaIP EnQueue RFic i SizeOf word encola la ltima ficticia pendiente repeat procesa todas las ficticias pendientes ColalP DeQueue R Fic i SizeOf word RFic j JComun ColaFic EnQueue RFic SizeOf R Fic until ColalP Is Empty 71 SysPert Manual T cnico fliP False registra que ya no hay ficticias pendientes Al i JMax VActival Store A1 Index A1 end if f131 if not f131 and kG 1 then procesa A1 i begin for gk 1 to JGpo VSize do begin JGpo Recall gk JComun if JComun gt 0 then begin A T i JComun VActival Store A1 Index A1 end if JComun gt 0 end for gk 1 to JGpo VSize end if not f13 1 and flGpo and kG 1 if not f131 and kG gt 1 then procesa las ficticias por haber mas de un gpo en VP begin for gk 1 to JGpo VSize do be
48. L ULTIMO ES COMA ME LO QUITA Arreglada 0 Chr j 1 ME DA LA LONGUITUD DE ARREGLADA YA LA ARREGLO end if length Dato lt gt 0 then FIN DEL IF GRANDE Eso Vp 0 Chr j 1 Eso VP Arreglada MODIFICA EL VALOR DE ESO VActival Store k eso Y LO GUARDA YA ARREGLADO end for k 1 to VActival MaxVectorSize end TCodigos VerifComas procedure TCodigos borrar begin setLength ElemVp 0 setLength CodApa 0 setLength GruposA 0 setLength MiDondeGrupos 0 setLength CR1 0 end end 98 SysPert Manual T cnico unit UCPM interface uses SysUtils UDatos UMain URed procedure CargaTabla procedure Cpm var IndiceDos array of word implementation procedure Proximo var k ki nk integer Al Ap TRVcpm fITp boolean maxTPx real futilizada ara determinar el iPx de las actividades subsecuentes begin k 0 DurPro 0 maxTPx 0 repeat procesa las iniciales inc k Vcpm Recall k A 1 if Al i l then begin A1 iPx 0 inicio pr ximo de la actividad Al tPx Al Dur terminaci n pr xima de la actividad Vcpm Store A1 Index A1 end until Al i gt 1 ki 1 repeat inc ki flTp False k 0 repeat procesa todas las intermedias y las finales inc k Vcpm Recall k A 1 if Al j ki then begin flTp True maxTPx A1 tPx nk k 1 repeat se utiliza para calcular maxTPx entre las acts con misma j Vepm Recall nk Ap if Ap j ki 99 SysPert Manual T cnico then
49. LSE Object_MisMatch FALSE Dynamic Memory Exhausted FALSE General Failure FALSE END StatusType Reset dA MA A LIE MCI oc o A StackNode Methods dd EE d LU M C CM LL LM PROCEDURE StackNode Init VAR Captured Info untyped Info Size WORD Next Node StackNodePtr BEGIN GetMem Info Info Size Move BYTE Captured Info BYTE Info Info Size Next Next Node END StackNode Init quomm dU ETT A TN USE o dc a PROCEDURE StackNode Yield Info VAR Yielded Info untyped Info Size WORD BEGIN Move BYTE Info BYTE Yielded Info Info Size END StackNode Yield Info di AC RM MEL CE PROCEDURE StackNode Clear Info Size WORD BEGIN FreeMem Info Info Size 125 SysPert Manual T cnico END Stack Node Clear q da dc Stack Methods RG a ln doa pd PROCEDURE Stack Init ItemSize WORD Maxltems WORD BEGIN Top NIL Size 0 Last_Op_Ok TRUE MaxSize Maxltems InfoSize ItemSize Status Reset END Stack Init CE E F AE a a aE E E KEE E E RE EAEk E E EE ee ee EE E Y PROCEDURE Stack Clear VAR Ptr StackNodePtr BEGIN WHILE Top lt gt NIL DO BEGIN Ptr Top Top Top Next Dec Size Ptr Clear InfoSize Dispose Ptr END While Status Reset Last Op Ok TRUE END Stack Clear Rs c d E NEL LL M LL M EL II X CU E FUNCTION Stack Is Empty BOOLEAN BEGIN Is Empty Size 0 END Stack Is Empty xxu EE DELL IL M LL Rn ee E Dd MC
50. Main lbProba Caption La probabilidad que se relice en sTP o menos es Format Yof ArZ 100 FloatToStr ArZ 100 fmMain lbProba Visible True if fmMain Vercomplementol Checked then fmMain lbProbaCom Caption La probabilidad que no se relice en sTP es Format Yof 1 ArZ 100 FloatToStr 1 ArZ 100 end 2 begin fmMain lbProbaCom Caption La probabilidad que no se relice es Format f 1 ArZ 100 FloatToStr 1 ArZ 100 fmMain lbProbaCom Visible True fmMain lbProba Visible False end 108 SysPert Manual T cnico end case fmMain lbProba Visible True fmMain lbProbaCom Visible True end CalcAreaZ procedure CalcAreaZZ TP1 TP2 real Op integer var A TPtempo real N integer begin N 16 if TP2 lt TP1 then begin TPtempo TP1 TP1 TP2 TP2 TPtempo end else begin ArZ AreaBC TP1 TP2 N case Op of l begin fmMain lbProba Caption La probabilidad que se relice entre TP1 y TP2 es Format f ArZ 100 FloatToStr ArZ 100 fmMain lbProba Visible True fmMain lbProbaCom Visible False fmMain lbProbaCom Caption La probabilidad que no se relice en TI T2 es Format Yof 1 ArZ 100 FloatToStr 1 ArZ 100 end 2 begin fmMain lbProba Caption La probabilidad que se relice alrededor de T es Format f ArZ 100 FloatToStr ArZ 100 fmMain lbProbaCom Caption La probabilidad que no se
51. Principal UMain UDatos UCode y URed El m dulo Principal inicializa el proceso crea el formulario y corre la aplicaci n UMain es el m dulo b sico y opera pr cticamente toda la aplicaci n Contiene al formulario principal y es la interfaz gr fica del usuario se utiliza tanto para la captura de datos como para el despliegue de resultados La siguiente figura muestra el formulario con el men principal barra de herramientas la p gina de entrada de datos visible las p ginas no visibles de resultados en forma tabular y la de la gr fica de la red La p gina de entrada muestra la tabla de actividades RED C Wocaments and Settings NARIOWIS docementes 0D Raiz Redmi Ot_red cao Ver mj ol amp H Pod Rewisdor Bico keen Montes Peosdeies E a H 1 R C D E F H i K i L En la figura aparece la lista de 12 actividades con se vestor de precedentes La red se obtiene al oprimir el bot n rotulado Crear red y los resultados se presentan en forma tabular y de manera gr fica Las siguientes figuras muestran las dos panatallas de salida tabular y gr fica 11 SysPert Manual T cnico DE RED C Wocements and Settings WARIOWSE docementes D RelzRedunt Gite frctwo Yes Dj aj amp Bj Pad Pelado Gus Salida tabular f RED C Wocements and Settings INARIO is tes D imm M frchio Ye Dj aj e D Ped Rewsio Grice Essex moo Salida gr fica 12 SysPert Manua
52. Recall rCpm Index rEstima Sigma Sigma rEstima Varianza iPiv rCpm i o es rCpm i tPxPiv rCpm iPx 1k 0 end until Ok or not Vepm VectorOpStatus until iPiv 1 Sigma Sqrt Sigma rParm 1 1 rParm 2 FloatToStr StrToFloat sTP Mu Sigma rParm 3 1 cPert rParm end if InPutQuery gt sTP then end procedure TfmMain FormClose Sender TObject var Action TCloseAction Cierra el formulario y destruye Grafica y MiCodigos begin Grafica Destroy MiCodigos Destroy end procedure TfmMain VercomplementolClick Sender TObject Conmuta la opci n verComplemento begin Opciones Checked not Opciones1 Checked end procedure TfmMain tbtNuevoClick Sender TObject Crea una nueva lista de actividades var ij integer begin Caption Pert StatusBar 1 SimpleText Pulse lt Intro gt para introducir otra actividad with sgActiviDatos do begin for 1 sgActiviDatos RowCount 1 downto 1 do for j 0 to 6 do 56 SysPert Manual T cnico begin Rowsli Strings j end RowCount 0 RowCount sgActiviDatos RowCount 1 FixedCols 0 FixedRows 1 Row 1 Cells 0 1 Format 8d 1 PageControll ActivePage TabSheetl end with sgActiviDatos do end TfmMain ToolButtonl Click end 57 SysPert Manual T cnico unit URed interface uses Sysutils UMain UDatos procedure ArmaRed procedure Pares Ax TV Activa implementation procedure Par
53. TCodigos Cm32 var I J Integer K L integer M Integer AN Integer posicion integer ColaCm32 Queue Grupos array of array of integer DondeGrupos array of array of integer OrdenGrupos array of integer eso TVActiva 91 SysPert Manual T cnico begin ColaCm32 init SizeOf Integer 10 A 0 PARA SABER EN QUE ELEMENTO DEL ARREGLO GRUPO SE PONE posicion 0 SetLength Grupos 1 SetLength DondeGrupos 0 SetLength DondeGrupos V Actival Max VectorSize 1 for I 1 to VActival MaxVectorSize 1 do ESTOS DOS CICLOS ME HACEN DAR LA VUELTA for J I 1 to VActival MaxVectorSize do PARECIDA A LA DE LA BURBUJA begin J EI ME DICEN EN QUE COLUMNA ESTOY if High ElemVp I lt gt High ElemVp J then SI LA LONGUITUD DE VECTOR ES DIFERENTE for K 1 to High ElemVp I do ESTOS DOS FOR ME EXAMINAN A TODOS for L 1 to High ElemVp J do ELEMENTOS DE CADA UNO if ElemVp LK ElemVp J L then ColaCm32 EnQueue ElemVp LK SizeOf Integer if ColaCm32 Items_In gt 2 then begin SetLength Grupos A ColaCm32 Items In for M 0 to ColaCm32 Items In 1 do ColaCm32 DeQueue Grupos A M SizeOf Integer Para Guardar los grupos A A 1 Posicion 0 for N 0 to High DondeGrupos I do para decir donde se encentran los grupos if DondeGrupos I Posicion lt gt 0 then posicion posicion 1 SetLength DondeGrupos I posicion 1 DondeGrupos I Posicion A Posicion 0 for N 0 to High DondeGrupos J do para
54. UE SON SUBGRUPOS DE LOS OTROS K 1 SetLength GruposArreglados K A 0 for I 0 to High GruposA do AQUI LA VOLVEMOS A GUARDAR YA ORDENADA begin for J 0 to High GruposA I do PARA PASAR ENTRE LOS ELEMENTOS if GruposA I J lt gt 0 then Y YA PASARLO A OTRO begin A AHl SetLength GruposArreglados k 1 A 90 SysPert Manual T cnico GruposArreglados K 1 A 1 GruposA I J end if GruposA I J lt gt 0 then if High GruposArreglados K 1 gt 1 then PARA ELIMINAR LOS REPETIDOS begin K K 1 SetLength GruposArreglados K end if High GruposArreglados K 1 gt 1 then A 0 end for I 0 to High GruposA PARA VOLVER A PASARLOS YA BIEN ORDENADOS A GRUPOSA SetLength GruposA High GruposArreglados for I 0 to High GruposArreglados 1 do para dar los nuevos tama os SetLength GruposA I High GruposArreglados I 1 for I 0 to High GruposArreglados do FOR S PARA VOLVELOS A PASAR for J 0 to High GruposArreglados I do GruposA LJ GruposArreglados LJ ANA COMPLETAMENTE DEPURADOS Y NO REPETIDOS for I 0 to High GruposA do LES PONE 2 A LOS QUE EXISTEN EN LOS GRUPOS Y LO GUARDO for J 0 to High Micodigos GruposA I do begin VActival Recall Micodigos GruposA LJ eso eso cM3 2 VActival Store Micodigos GruposA LJ eso end for J 0 to High Micodigos GruposA I end TCodigos GuardaCM32 eee ere Tee ete BAS eR o Cte ee ee LLL A a EE ii eT ee eee procedure
55. abilidad de no terminar el proyecto entre TP1 TP2 Escriba el TP 1 sTP if Ok then begin Sigma 0 Mu DurPro for ik 1 to qHol Items In do begin repeat qHol DeQueue rRC SizeOf rRC qHol EnQueue rRC SizeOf rRC preserva qHol VEstima Recall rRC Index rEstima Sigma Sigma rEstima Varianza end for ik 1 to qHol Items_In Sigma Sqrt Sigma rParm 1 2 rParm 2 FloatToStr StrToFloat sTP Mu Sigma end if Ok then Ok InPutQuery Probabilidad de terminar el proyecto entre TP1 TP2 Escriba el TP2 sTP if Ok then begin rParm 3 FloatToStr StrToFloat sTP Mu Sigma rParm 4 4 52 SysPert Manual T cnico cPert rParm end end Enelperiodol Click procedure TfmMain Conprobabilidadl Click Sender TObject Calcula el tiempo de terminaci n del proyecto con una probabilidad dada var Ok boolean ik integer rEstima TEstima rRC TRC rParm TcParm begin Ok InPutQuery TP con probabilidad de Escriba la probabilidad sTP if Ok then begin Sigma 0 Mu DurPro for ik 1 to qHol Items_In do begin repeat qHol DeQueue rRC SizeOf rRC qHol EnQueue rRC SizeOf rRC preserva qHol VEstima Recall rRC Index rEstima Sigma Sigma rEstima Varianza end for ik 1 to qHol Items_In Sigma Sqrt Sigma rParm 1 5 rParm 2 FloatToStr StrToFloat sTP 100 rParm 3 FloatToStr Mu rParm 4 FloatToStr Sigma rParm 5 1 cPert rParm end if Ok end procedu
56. anual T cnico repeat ColaIP DeQueue RFic i SizeOf word RFic j JComun ColaFic EnQueue RFic i SizeOf R Fic until ColalP Is Empty fliP False if pivAp j 0 then pivAp j JComun pivAp Ok 1 Al 1 JComun V Actival Store pivAp Index pivAp VActival Store A1 Index A1 flDoneCaso2 True end IMismaj procedure IDiferente begin if cc32 then begin presencia de grupos if pivAp j 0 then begin inc JMax pivAp j JMax end if fliP then begin ColaIP EnQueue RFic i SizeOf word RFie i pivAp j end else begin RFic i pivAp fliP True end pivAp Ok 1 VActival Store pivAp Index pivAp end else begin ausencia de grupos Ap pivAp if Ap Ok 0 then if Ap j 0 then begin inc JMax Ap j JMax if fliP then begin ColaIP EnQueue RFic i SizeOf word RFic i Ap j end 60 SysPert Manual T cnico else begin RFic i Ap j fliP True end Ap Ok 1 VActival Store Ap Index Ap end else begin if fliP then begin ColaIP EnQueue RFic i SizeOf word RFic i Ap j end else begin RFic i Ap j ColaIP EnQueue RFic i SizeOf word ojo verificar fliP True end Ap Ok 1 VActival Store Ap Index Ap end else begin posiblemente se requiera verificar ficticias pendientes if fliP then begin ColaIP EnQueue RFic i SizeOf word RFic i Ap j end else begin RFic i Ap j fliP True end Ap Ok 1 con reserva o duda esta linea y la siguiente VActival Store Ap Index
57. arm 1 of 1 CalcAreaZ StrToFloat cParm 2 StrToInt cParm 3 2 CalcAreaZZ StrToFloat cParm 2 StrToFloat cParm 3 StrToInt cParm 4 3 CalcAreaZZ StrToFloat cParm 2 StrToFloat cParm 3 StrToInt cParm 4 4 CalcAreaZZ StrToFloat cParm 2 StrToFloat cParm 3 StrToInt cParm 4 5 CalZIzq StrToFloat cParm 2 StrToFloat cParm 3 StrToFloat cParm 4 StrToInt cPar m 5 end case end cPert cParm TcParm end 105 SysPert Manual T cnico unit UValz interface uses SysUtils procedure CalZIzq Pro Mu Sigma real Op integer procedure CalcAreaZ TP real Op integer procedure CalcAreaZZ TP1 TP2 real Op integer implementation uses UMain UDatos var 1 M integer N integer n mero de subintervalos en que se divide el intervalo de integraci n A limite inferior del intervalo de integraci n B l mite superior del intervalo de integraci n Rich valor de la integral despu s de la interpolaci n de Richardson H amplitud constante de los subintervalos X real variable independiente de la funci n Area array 1 2 of real arreglo de reas 1 N subintervalos 2 2N subintervalos K1 K2 longInt nDatos integer Dato1 Dato2 real Izq boolean ArZ real function Y x real real begin Y Exp amp x 2 Sqrt 2 pi end Y function AreaBC A B real N integer real Calcula el rea bajo la curva con la f rmula trapecial Luthe pp 170 181 begin for 1 1 to 2 do begin H
58. d rFic i IntToStr rFic i Rows k Strings 2 Format 5d rFic j IntToStr rFic j until k Fic Vector VSize end end with fmMain sgFic with fmMain sgRC do begin RowCount 1 k 0 Visible True fmMain IbRC Visible True Cells 0 0 No Cells 1 0 1 Cells 2 0 3 for nk 1 to qHol Items_In do begin repeat RowCount RowCount 1 FixedRows 1 inc k qHol DeQueue rRC SizeOf rRC qHol EnQueue rRC SizeOf rRC preserva qHol Rows k Strings 0 Format 5d k IntToStr k Rows k Strings 1 Format 5d rRC i IntToStr rRC 1 Rows k Strings 2 Format 5d rRC j IntToStr rRC j end for nk 1 to qHol Items_In until qHol Is_Empty end with fmMain sgRC with fmMain sgCPM do begin RowCount 1 k 0 nk 0 X 0 43 SysPert Manual T cnico repeat RowCount RowCount 1 FixedRows 1 inc k Vepm Recall k rCpm VEstima Recall k rEstima Rows k Strings 0 Format 12d rCpm Index IntToStr rCpm Index Rows k Strings 1 Format 12d rCpm i Rows k Strings 2 Format 12d rCpm j IntToStr rCpm j Rows k Strings 3 Format 15 1f rCpm Dur FloatTostr rCpm Dur if rCpm Dur 0 then begin inc nk Rows k Strings 4 Format 13 2f X end else begin VEstima Recall k nk rEstima Rows k Strings 4 Format 13 2f rEstima Varianza end Rows k Strings 4 Format 13 2f rEstima Varianza FloatTostr
59. del l mite superior del primer intervalo Area2 AreaBC A b2 N f rea del l mite superior del primer intervalo repeat c lculo de reas sucesivas hasta revasar el area de la variable aleatoria desconocida inc K 1 inc k espia b1 b2 Areal Area2 preserva el rea de la cota inferior del intervalo b2 b2 H favanza al siguiente intervalo Area2 AreaBC A b2 N calcula el rea del nuevo limite superior del intervalo until Area2 gt AreaTar Se detiene el proceso cuando el intervalo envuelve a la variable aleatoria buscada 107 SysPert Manual T cnico or k 100000 si no converge el m todo MaxInt 2147483647 se utiliz con algunos ejemplos de prueba f1 AreaTar Areal AreaTar primer factor de ajuste para acercar el l mite bl a bx K1 k f2 Area2 AreaTar AreaTar segundo factor de ajuste para acercar el limite b2 a bx while b1 lt b2 do begin ciclo utilizado para cruzar los valores exploradores b1 y b2 inc K2 if b1 gt 0 then b1 b1 1 f1 else b1 b1 1 f1 if b2 gt 0 then b2 b2 1 f2 else b2 b1 1 f2 end while b1 b1 b2 2 Areal AreaBC A b1 N end else del if AreaTar 0 5 Area2 AreaTar Areal instrucci n aparentemente in til if ZNeg then b1 b1 para valores sim tricos Kalcula b1 valor buscado end procedure CalcAreaZ TP real Op integer var Areal N integer begin A 4 N 16 Dato1 TP ArZ AreaBC A Dato1 N case Op of l begin fm
60. des y exhibici n de resultados begin CargaDatos Preparardatos CargarDatos2 CreaGrupos ArmaRed Cpm Calcularl Enabled True ReCargaDatos TabSheet2 V isible True PageControll ActivePage TabSheet2 btCreaRed Enabled False MiGrafica Grafica Graficar PnGraficar end 14 SysPert Manual T cnico El procedimiento CargaDatos l nea 5 realiza el almacenamiento de los datos b sico que identifican a cualquier actividad en el vector objeto VActival La estructura de dichos datos es la siguiente TVActiva record Index word Asigna un secuencial a cada actividad 1 n Nombre ShortString Guarda el nombre que el usuario asigne LVP word ness Indica la longitud del vector de precedencias VP ShortString Vector de precedencias de cada actividad RA eee Evento inicial y terminal de cada actividad CApar bute 0 eee ceee ee ee C digo de aparici n CM3 byle e E ers C digo Modelo 3 cR word C digo de repetici n Ok byte inm Re Indica si una actividad ha sido procesada Index2 word s Indice secundario end y el objeto Colal que almacena los ndices de todas las actividades para su proceso TActiva record Index word Indice de cada actividad end Las siguientes figuras muestran el proceso de todas las atividades y el rol de Colal y los vectores VActival y VEstima El procedimiento CargarDa
61. e 1 GENERO UN ARREGLO CON MaxVectorSize DE FILAS colaz init SizeOf integer 11 95 SysPert Manual T cnico for k 1 to VActival MaxVectorSize do PARA PASAR POR TODOS LOS ELEMENTOS DE VACTIVAI begin VActival Recall k esol colaz clear J 1 for I 1 to length esol VP do begin if esol VP I in 0 9 then begin StrCola J eso1 VP I J J 1 end if esol VP I in 0 9 then else if esol VP I then begin StrCola 0 chr J 1 IntCola StrToInt StrCola IntCola StrToInt StrCola if intCola gt V Actival MaxVectorSize then begin result 1 exit end if intCola gt V Actival MaxVectorSize then if IntCola gt 0 then Colaz EnQueue IntCola SizeOf integer J 1 end if esol VP T in 0 9 else end for I 1 to length esol VP FIN DEL FOR I StrCola 0 chr J 1 IntCola StrToInt StrCola IntCola StrToInt StrCola if intCola gt V Actival MaxVectorSize then begin result 1 exit end if intCola gt V Actival MaxVectorSize then if IntCola gt 0 then Colaz EnQueue IntCola SizeOf integer J 1 Esol LVP Colaz Items_In VActival Store k esol if Colaz Items_In gt 0 then begin SetLength ElemVp K Colaz Items In 1 QUE TENDRAN ESA FILA M Colaz Items_In Colaz Items In ELEMENTOS for L 1 to M do 96 SysPert Manual T cnico colaz DeQueue ElemVp K L SizeOf Integer end if Colaz Items In gt 0 then else begin S
62. e actividades en proyectos con una descripci n del algoritmo original En la segunda parte se muestra el dise o del paquete y se hace una descripci n de todos los m dulos que lo constituyen con una explicaci n detallada de sus partes relevantes Se incluyen algunas pantallas representativas de la interfaz gr fica del usuario y una breve descripci n de su operaci n Se detallan las estructuras de datos empleadas En el ap ndice se presentan los listados completos y se agrega un diccionario de datos con referencias cruzadas El paquete fue desarrollado con la herramienta Delphi versi n 5 cuya licencia acad mica pertenece a la UPIICSA TECNICAS DE PLANEACI N Y PROGRAMACION El m todo PERT utiliza la red que facilita seguir el trabajo ilustrando su secuencia tambi n se usa para programar tiempos esperados de actividades y de eventos nodos con la probabilidad de una distribuci n normal para cumplirlos Un proyecto combina actividades interrelacionadas conforme al tiempo originando una secuencia l gica tal que empezar un trabajo excepto los iniciales depende de que otros se terminen En general dise ar la red proyecto puede ser una labor dif cil el alumno o el usuario requiere de imaginaci n e inventiva primero se hace una lista de los distintos trabajos por hacer decidiendo la secuencia actividades precedentes entre ellos y luego se intenta el modelo de red La uni n de diversos nodos y flechas forma una red con distinta
63. eger eso esol esoAux TVActiva V Activa2 A Vector begin SetLength Auxiliar High ElemVp 1 SetLength C320 High ElemVp 1 for I 0 to High ElemVp do C320 1 1 for 1 0 to High ElemVp do AQUI ALMACENO EN AUXILIAR A TODOS LOS DE CAPAR 1 begin DE TODOS LOS VP SetLength Auxiliar I High ElemVp I 1 A 0 for J 0 to High ElemVp I do begin Vactival Recall ElemVp I J eso if eso cApar 1 then begin Auxiliar Lc320 I ElemVp LJ c320 1 c320 1 1 end if eso cApar 1 then end for J 0 to High ElemVp I j end for I 0 to High ElemVp for 1 0 to High ElemVp do AQUI ALMACENO EN AUXILIAR A TODOS LOS DE CAPAR 2 begin Y CM3 0 for J 0 to High ElemVp I do begin Vactival Recall ElemVp LJ eso if eso cApar 2 and eso cM3 0 then begin Auxiliar Lc320 I ElemVp LJ c320 1 c320 1 1 end if eso cApar 2 and eso cM3 0 then end for J 0 to High ElemVp I end for I 0 to High ElemVp 81 SysPert Manual T cnico for I 0 to High ElemVp do AQUI ALMACENO EN AUXILIAR A TODOS LOS DE CAPAR 2 begin JN CM3 2 for J 0 to High ElemVp I do begin Vactival Recall ElemVp LJ eso if eso cApar 2 and eso cM3 2 then begin Auxiliar Lc320 I ElemVp LJ c320 1 c320 1 1 end if eso cApar 2 and eso cM3 2 then end for J 0 to High ElemVp I j end I 0 to High ElemVp for I 0 to High ElemVp do AQUI ALMACENO EN AUXILIAR A TODOS LOS D
64. enido then begin inc kG gSn gt for kAux 1 to Length gS do calcula la j del Gpo if gS kAux ki then gSn gSn gs kAux else begin VActival Recall StrToInt gSn Ap if Ap j gt O and Ap cApar 3 then JGpo Store gk Ap j gSn end else VActival Recall StrTolnt gSn Ap if Ap j gt 0 then JGpo Store gk Ap j JGpo Recall gk JComun if JComun 0 then begin inc JMax JGpo Store gk JMax end gSn for kAux 1 to Length gS do procesa las A32 del Gpo if gS kAux ki then gSn gSn gs kAux else begin VActival Recall StrToInt gSn Ap if Ap j 0 then JGpo Recall gk Ap j Ap Ok 1 VActival Store Ap Index Ap gSn end else for kAux 1 to Length gS VActival Recall StrToInt gSn Ap JGpo Recall gk Ap j Ap Ok 1 VActival Store Ap Index Ap if fliP then begin ColaIP EnQueue RFic i SizeOf word JGpo Recall gk RFic j repeat ColaIP DeQueue RFic i SizeOf word ColaFic EnQueue RFic SizeOf RFic until ColalP Is Empty fliP False end then 70 SysPert Manual T cnico else begin JGpo Recall gk RFic 1 end else end if flGpo kG gt 0 flGpo False until gk Gpo VSize if f131 then si hubiera A31 genera la ficticia por c gpo begin for gk 1 to JGpo VSize do begin JGpo Recall gk JComun if JComun gt 0 then begin if fliP then ColaIP EnQueue RFic i SizeOf word rFic 1 JComun fliP True end if JComun gt 0 end for gk 1 to
65. es pueden tener el mismo nodo i pero con diferente j o bien el mismo j pero con diferente i Para corregirlo se agregan una flecha F y un nodo k ficticios Un trabajo flecha ficticia no consume tiempo pero este tipo de red la usa al representar precedencias M TODO PERT PROBABILISTICO Mediante el concepto de probabilidad la metodolog a PERT tiene un modelo que maneja en forma m s realista los tiempos de las actividades que intervienen en un proyecto En tal caso las duraciones de los trabajos son tiempos esperados a cumplir El m todo PERT probabil stico se basa en tiempos estimados de gente que conoce el tipo de actividad por realizar as toma en cuenta la opini n de expertos que pueden proporcionar valores de duraci n de la siguiente manera Tres estimaciones para la duraci n de cualquier trabajo del proyecto Tiempos esperados variancias y programaci n to tiempo optimista si todo transcurre bien t m tiempo m s probable si todo transcurre ordinariamente t p tiempo pesimista si todo transcurre mal Luego se aplican en la f rmula del PERT para calcular el tiempo esperados te como promedio ponderado _ E A tt 6 Suposiciones del modelo PERT probabil stico Los tiempos esperados te de los diversos trabajos se consideran como variables aleatorias de una distribuci n de probabilidad B de tipo gaussiana los valores de variable aleatoria se dispersan dentro del espacio de tres desviac
66. etLength ElemVp K 2 ElemVp K 1 0 end if Colaz Items In gt 0 else end for k 1 to VActival MaxVectorSize FIN FOR K end TCodigos GuardarDatos QUT TTD lp nee a AEE a Aa E Ek E EE te SERERE dl E A Ka EE E E AE a K A a AAA R EE procedure TCodigos VerifComas PROCEDIMIENTO QUE MODIFICA DEPURA Y GUARDAR LOS ELEMENTOS DE var MEL OBJETO VACTIVALI eso TVActiva J I k L Estado Integer Dato Arreglada String 30 begin for k 1 to VActival MaxVectorSize do PARA PASAR POR TODOS LOS ELEMENTOS DE VACTIVAI begin VActival Recall k eso CARGO LOS ELEMENTOS DEL INDICE K EN ESO J 1 Estado 1 0 el ultimo fue numero 1 El Ultimo fue una coma Dato Eso VP LO PASO POR QUE NECESITO A LA CADENA CON INDICES L Length Eso vp if eso VP then QUE SINO ALMACENO UN DATO begin MES EQUIVALENTE A CERO eso VP 0 VActival Store k eso Y LO GUARDA YA ARREGLADO EXIT end if length Dato lt gt 0 then SI EL TAMA O DEL VP DE ESO ES MAYOR A CERO begin for I 1 to length Dato do begin if Dato I in 0 9 then begin Arreglada J Dato I J J 1 Estado 0 end if length Dato lt gt 0 then else if Dato I and Estado 0 then 97 SysPert Manual T cnico begin Arreglada J Dato I J J 1 Estado 1 end if length Dato lt gt 0 else if Dato I and Estado 0 then end for I 1 to length Dato FIN DEL FOR if Arreglada j 1 then J J 1 SI E
67. gin JGpo Recall gk JComun if JComun gt 0 then begin if fliP then ColaIP EnQueue RFic i SizeOf word rFic 1 JComun fliP True end if JComun gt 0 end for gk 1 to JGpo VSize inc JMax JComun JMax if fliP then ColaIP EnQueue R Fic i SizeOf word encola la ltima ficticia pendiente repeat procesa todas las ficticias pendientes ColaIP DeQueue RFic i SizeOf word RFic j JComun ColaFic EnQueue RFic SizeOf RFic until ColalP Is Empty fliP False registra que ya no hay ficticias pendientes Al i JComun VActival Store A1 Index A1 end if not f13 1 and flGpo and kG gt 1 JGpo Done end M3R procedure M3 GrupoMj var flM3r boolean begin if Ap Ok 0 or Ap cM3 2 then begin 72 SysPert Manual T cnico flM3r False cVPA ColaVP kAux cVPA Items In while not flM3r and kAux gt 0 do begin cVPA DeQueue aVp SizeOf aVP VActival Recall aVp Ap fIM3r Ap cM3 2 cVPA EnQueue Ap Index SizeOf Ap Index dec kAux end while if fIM3r then M3R else M3S end if Ap Ok 0 then else if Al 1 0 then begin Al 1 JMax VActival Store Al Index Al if fliP then ColaIP EnQueue RFic i SizeOf word else begin if RFic i 62852 then RFic i JMax 1 RFic j JMax ColaFic EnQueue RFic SizeOf RFic fliP False verificar que funcione para todos los casos se puso por Al I en M3 01 end end end M3 procedure MloM2 begin if Ap Ok 1 and A1 i 0 then 1f fliP
68. iDatos RowCount 1 sgActiviDatos Col 1 sgActiviDatos Row sgActiviDatos RowCount 1 48 SysPert Manual T cnico sgActiviDatos Cells 0 sgActiviDatos RowCount 1 Format 8d sgActiviDatos Row btCreaRed Enabled True end end procedure TfmMain Antesdel Click Sender TObject Calcula la probabilidad de terminar el proyecto antes de su TP var Ok boolean ik integer rEstima TEstima rRC TRC rParm TcParm begin Ok InPutQuery Probabilidad de terminar el proyecto en Escriba el TP sTP if Ok then begin Sigma 0 Mu DurPro for ik 1 to qHol Items In do begin repeat qHol DeQueue rRC SizeOf rRC qHol EnQueue rRC SizeOf rRC preserva qHol VEstima Recall rRC Index rEstima Sigma Sigma rEstima Varianza end for ik 1 to qHol Items_In Sigm Sigma Sigma Sqrt Sigma rParm 1 1 rParm 2 FloatToStr StrToFloat sTP Mu Sigma rParm 3 1 cPert rParm end if Ok then end procedure TfmMain Terminarelproyectoenelperiodol Click Sender TObject Calcula la probabilidad de terminar el proyecto en el periodo T1 T2 var Ok boolean ik integer rEstima TEstima rRC TRC rParm TcParm begin Ok InPutQuery Probabilidad de terminar el proyecto entre TP1 TP2 Escriba el TP1 sTP if Ok 49 SysPert Manual T cnico then begin Sigma 0 Mu DurPro for ik 1 to qHol Items In do begin repeat qHol DeQueue rRC SizeOf rRC qHol EnQueue rRC SizeOf rRC preserva q
69. idades y se calculan los pares i j que corresponden al evento inicial i y al evento terminal j de cada actividad Tambi n se calcula la duraci n esperada y la varianza La segunda figura muestra la p gina con estos resultados adem s se pueden observar la tabla de actividades que forman la ruta cr tica y la tabla de actividades ficticias as como la duraci n esperada del proyecto Ti y la varianza total 22 SysPert Manual T cnico Pantalla con las tablas de resultados mostrando los pares i j duraci n y varianza esperadas En esta pantalla se muestra la gr fica de la red Los pares i j determinados por el software se muestran con los n meros correspondientes en los nodos de la red 23 SysPert Manual T cnico En la tabla resultados el usuario puede utilizar la opci n Calcular en men principal para obtener Las probabilidades de terminar el proyecto e Igual o antes de e Enel periodo e Enel tiempo esperado d e Exactamente en Probabilidad de no terminar el proyecto e Enel tiempo programado TP o antes e Entre dos tiempos programados TP1 y TP2 Tiempo de terminaci n del proyecto con probabilidad El intervalo de confianza para el tiempo esperado TE La siguiente figura muestra algunas de las opciones mencionadas El formulario opera 26 manejadores de eventos btAddActsClick A ade actividades a la
70. igh Micodigos ElemVp do PARA MODIFICAR A LOS VP begin VActival Recall LEso Eso VP for J 1 to High Auxiliar I 1 do PARA PASAR ENTRE LOS ELEMENTOS eso vp eso vp IntToStr Auxiliar LJ eso Vp eso vp IntToStr Auxiliar I High Auxiliar T VActival Store LEso end for I 1 to high Micodigos ElemVp GuardarDatos nT 0 for I 1 to Vactival MaxVectorSize do PARA MODIFICAR A LOS VP begin VActival Recall LEso if Eso LVP gt 0 and Eso cApar 0 then inc nT end for I 1 to Vactival MaxVectorSize end TCodigos OrdenVP ul pd e d DKL C ELE LL LL M LLL LL EERE EEEE ctc a A i LL M LaL LL do PEL a EE procedure TCodigos CrearMiDondeEstan sirve para decirme donde se encuentran los grupos var LJ K L M N Aux posicion integer A B word AuxA array of array of integer begin ORDENAMOS LOS GRUPOS PRIMERO EN EL ORDEN NATURAL for I 0 to High GruposA do for J 0 to High GruposA I do for K J to High GruposA I do 83 SysPert Manual T cnico if GruposA I J gt GruposA I K then begin Aux GruposA LJ GruposA I J GruposA I K GruposA I K Aux end if GruposA LJ gt GruposA LK then ORDENAMOS LOS GRUPOS ENTRE ELLOS MISMO SetLength AuxA 1 for I 0 to High GruposA do for J I 1 to High GruposA do if GruposA I 0 gt GruposA J 0 then begin for K 0 to High GruposA I do begin SetLength AuxA 0 K 1 AuxA 0 k GruposA I k ya copie al
71. ilidad dada AbrirundocumentolClick Abre un archivo pregrabado con una lista de actividades GuardarundocumentolClick Graba en un archivo la lista de actividades actual Precedentes1 Click Marca la opci n ver precedentes Ficticias1 Click Conmuta para hacer visibles o no las actividades ficticias probOcurrEvTPClick Calcula la probabilidad de que ocurra un determinado evento en un tiempo dado FormClose Cierra el formulario y destruye Grafica y MiCodigos VercomplementolClick Conmuta la opci n verComplemento tbtNuevoClick Crea una nueva lista de actividades Los procedimientos independientes del formulario son l Ii Uo Up IniciaFormas Prepara las tablas de datos y resultados con encabezados y ancho de columnas Resetear Reinicializa diversos objetos utilizados por la aplicaci n vectores y colas MiGrafica Prepara los datos y crea los elementos para la gr fica de la red CreaGrupos Crea los grupos de actividades precedentes CargaDatos Carga el vector VActival y la Colal con los valores de la tabla de datos ReCargaDatos Carga la tabla de resultados con los valores calculados PrepararDatos Prepara los datos para su proceso asignado c digos a las actividades La unidad UPert funciona como enlace con otro de los m dulos sustantivos del paquete la unidad UValz donde se realizan todos los c lculos probabil sticos basados en la distribuci n normal En UMain las ocho opciones del men Calcular formulan
72. intervalo b2 b2 H avanza al siguiente intervalo Area2 AreaBC A b2 N calcula el rea del nuevo limite superior del intervalo until Area2 gt AreaTar Se detiene el proceso cuando el intervalo envuelve a la variable aleatoria buscada f1 AreaTar Areal AreaTar primer factor de ajuste para acercar el limite bl a bx K1 k f2 Area2 AreaTar AreaTar segundo factor de ajuste para acercar el limite b2 a bx while b1 lt b2 do begin ciclo utilizado para cruzar los valores exploradores b1 y b2 inc K2 ifb1 gt 0 then b1 b1 1 f1 else b1 b1 1 f1 ifb2 gt 0 then b2 b2 1 f2 29 SysPert Manual T cnico else b2 b1 1 f2 end while b1 b1 b2 2 Areal AreaBC A b1 N end else del if AreaTar 0 5 if ZNeg then b1 b1 para valores sim tricos Kalcula b1 valor buscado end UValz debe su nombre precisamente a este c lculo de la variable aleatoria a partir del rea conocida bajo la curva Las tablas ordinarias de Z solamente se pueden utilizar para el c lculo inverso es decir para obtener el rea bajo la curva a partir del valor de la variable aleatoria 30 SysPert Manual T cnico UNIDAD UDatos UDatos contiene las estructuras de datos definidas para el paquete completo de software En este m dulo se definen todos los tipos de datos necesarios como las clases arreglos lineales y tablas pilas colas registros etc Tambi n se declaran las variables globales Clases
73. iones a uno y otro lado de la media los valores te son estad sticamente independientes t A frecuencia tiempo gt La gt to 6s tp Distribuci n B para los tiempos esperados te de los trabajos i j La medida de dispersi n para la variable aleatoria te se calcula con la f rmula para la variancia siguiente 2 bot te 6 La distribuci n D es gaussiana pero se distingue de otras distribuciones de este tipo porque las colas de la campana cruzan el eje horizontal teniendo de esta manera la ubicaci n para las duraciones pesimista y optimista las cuales no pueden rebasar dichos valores ya sea para m s o para menos La ubicaci n para el tiempo m s probable puede ser en cualquier lugar del intervalo entre to y t p que se consideran valores extremos para la 2 varlable aleatoria t e Para el intervalo entre t o y t p se consideran 6 desviaciones La f rmula para el tiempo esperado proporciona la ponderaci n de las estimaciones de los expertos para calcular el mismo as se puede observar la ponderaci n de 2 3 partes de rea bajo la campana para el tiempo m s probable y la tercera parte complementaria del rea bajo la campana se reparte igualmente con un sexto del rea para cada uno de los tiempos optimista y pesimista El m todo PERT probabil stico tambi n considera tiempos esperados Ti para cada uno de los eventos nodos i del proyecto pero distribuidos conforme a la distribuci n normal en ta
74. ite obtener la probabilidad de que un evento ocurra en un determinado tiempo es el caso del tiempo de terminaci n de una actividad o de toda la red de actividades Tambi n resuelve el problema contrario calcular el tiempo de ocurrencia de un evento en una red de actividades dada una probabilidad de que suceda 1 b Mediante la f rmula trapecial calcularemos el valor de la integral dx p 8 II e Cuya gr fica es P a lt Z lt b P Z lt b 1 P Z xa DISTRIBUCI N NORMAL La funci n expresada en t rminos de Pascal es function Y x real real begin Y Exp x x 2 Sqrt 2 pi end Y Para calcular el rea bajo la curva se utiliz el m todo trapecial descrito por el Dr Rodolfo Luthe Garc a i h rad zy e y Geom tricamente el primer miembro de la expresi n anterior equivale al rea 4 bajo la curva y f x entre las rectas x xo x 7 x y el eje x El segundo miembro el valor aproximado de la integral representa el rea del trapecio formado por las tres rectas antes mencionadas y la que une los puntos pivotes usados en la interpolaci n lineal tal como se muestra en la siguiente figura Rodolfo Luthe Antonio Olivera y Fernando Schutz M todos Num ricos M xico D F M xico Editorial Limusa 1978 pp 170 181 27 SysPert Manual T cnico y f x Aproximaci n polinomial lineal del rea bajo una curva Traducido lo anterior al c digo Pascal en el paquete
75. ivol TMenultem Nuevol TMenultem Terminarl TMenultem StatusBarl TStatusBar Abrirunaredl TMenultem ActionListl TActionList ImageListl TlmageList Calcularl TMenultem CPM3 TMenultem PERT3 TMenultem ToolBarl TToolBar tbtNuevo TToolButton ToolButton2 TToolButton ToolButton3 TToolButton ToolButton4 TToolButton ToolButton5 TToolButton Verl TMenultem Ficticias1 TMenultem N2 TMenultem Precedentes1 TMenultem PageControll TPageControl TabSheetl TTabSheet TabSheet2 TTabSheet sgActiviDatos TStringGrid sgFic TStringGrid sgCPM TStringGrid sgRC TStringGrid IbRC TLabel IbFicticias TLabel Label2 TLabel 34 SysPert Manual T cnico Antesdel TMenultem Terminarelproyectoenelperiodo 1 TMenultem AlrededordesuTP1 TMenultem Exactamenteenl TMenultem Antesde2 TMenultem Enelperiodol TMenultem Tiempodeterminacindelproyectol TMenultem Conprobabilidad1 TMenultem ElintervalodeconfianzaparaelTE 1 TMenultem Opciones1 TMenultem IbProba TLabel IbProbaCom TLabel Actionl TAction OpenDialogl TOpenDialog SaveDialogl TSaveDialog Abrirundocumentol TMenultem Guardarundocumentol TMenultem ToolButton8 TToolButton ToolButton9 TToolButton TabSheet3 TTabSheet PnGraficar TPanel Vercomplementol TMenultem Labell TLabel IbTituloPERT TLabel procedure btAddActsClick Sender TObject procedure FormActivate Sender TObject procedu
76. ject Inicializa algunas variables antes de abrir el formulario begin Colal Init SizeOf TActiva 65535 Gpo Init maxGpos IniciaFormas Caption Pert StatusBarl SimpleText Pulse Intro para introducir otra actividad PageControll ActivePage TabSheet2 sgActiviDatos Visible True PageControll ActivePage TabSheetl sgActiviDatos SetFocus end procedure TfmMain btAuxClick Sender TObject Actualmente inhabilitado se utiliz para pruebas begin label2 Caption sgActiviDatos Rows sgActiviDatos Row Strings 0 end procedure TfmMain btGrabarClick Sender TObject Graba en un archivo la lista de actividades actual var S string f file of TRLin6 k kl word Lin TRLin6 begin S InputBox Grabar archivo Nobre del archivo prt AssignFile f S Rewrite f with fmMain sgActiviDatos do for k 1 to RowCount 1 do begin for kl 0 to 6 do Lin kl Rows k Strings kl Write f Lin end end procedure TfmMain btRecuperarClick Sender TObject Abre un archivo pregrabado con una lista de actividades actualmente inhabilitado 45 SysPert Manual T cnico var S string f file of TRLin6 k kl word Lin TRLin6 Ok boolean begin PageControll ActivePage TabSheetl sgCPM Visible False sgRC Visible False fsgFic Visible False Ok InputQuery Abrir archivo Nombre del archivo NomAr if Ok then begin NomAr NomAr prt if NomAr then btCreaRed Enabled False else
77. l Ax Index A 1 if A1 0k 0 then Colal EnQueue Ax SizeOf Ax Colal DeQueue Ax SizeOf Ax VActival Recall Ax Index A 1 until Colal Is Empty Pares Ax end end ArmaRed end 78 SysPert Manual T cnico unit MiUnit interface uses Windows Messages SysUtils Classes Graphics Controls Forms Dialogs Grids StdCtrls Udatos Type TCodigos class ElemVp array of array of integer CONTIENE A VP EN ENTEROS CodApa array of array of integer Gruposa array of array of integer MiDondeGrupos array of array of integer DICE DONDE ESTAN LOS GRUPOS CRI array of integer CODIGO DE REPETICION procedure VerifComas ME ARREGLA A VP Y ME DICE SI ESTA MAL function GuardarDatos integer IVERIFICA QUE LOS ELEMENTOS NO SOBREPASES LOS LIMITES Y LOS GUARDA REGRESA 0 SI ESTA BIEN 1 SI ESTA MAL procedure CodAparicion GENERA LA TABLA Y DICE SI VIENE SOLA O ACOMPA ADA procedure Cm32 procedure CrearMiDondeEstan procedure GuardaCM32 procedure Ordenar procedure MiOrden procedure OrdenVP procedure CR Function a X integer Integer procedure borrar end var MiCodigos TCodigos RRO TET OS ee CST ATR RAPT et ee eee eee Te LU LL E LL LE implementation procedure TCodigos CR var c 1 J integer eso T Vactiva K L integer cont integer StrGrupo string 30 begin SetLength Crl VActival MaxVectorSize 1 for I 0 to VActival MaxVectorSize 1 do 79
78. l T cnico En la salida tabular se muestran adem s de los datos los pares i j cuyos valores representan el nodo inicial y el nodo terminal de cada actividad tambi n aparecen en una tabla aparte las activididades ficticias en caso de haberlas Por su parte la salida gr fica muestra la red desde su nodo inicial hasta el nodo terminal Los procedimientos independientes del formulario son 1 A ES at IniciaFormas Prepara las tablas de datos y resultados con encabezados y ancho de columnas Resetear Reinicializa diversos objetos utilizados por la aplicaci n vectores y colas MiGrafica Prepara los datos y crea los elementos para la gr fica de la red CreaGrupos Crea los grupos de actividades precedentes CargaDatos Carga el vector VActival y la Colal con los valores de la tabla de datos ReCargaDatos Carga la tabla de resultados con los valores calculados PrepararDatos Prepara los datos para su proceso asignado c digos a las actividades Adem s del formulario en la unidad UMain se definen las clases TCodigo y aCo cuyos diagramas RE Representaci n Especificaciones se muestran a continuaci n TCodigo Especificaciones procedure VerifComas function GuardarDatos integer procedure CodAparicion procedure Cm32 procedure CrearMiDondeEstan procedure GuardaCM32 procedure Ordenar procedure MiOrden procedure OrdenVP procedure CR Function a X integer Integer procedure borrar Representaci n Ele
79. l caso el tiempo esperado Ti se calcula con la sumatoria de los tiempos esperados correspondientes a los trabajos que forman la ruta mayor para cumplir dicho evento nodo i Xte Ti Fix campana de Gauss Le pu G x Distribuci n Normal para tiempos esperados Ti de los eventos nodos La suma de variancias en tal ruta mayor resulta en variancia de Ti Si Y Ste Entre todas las rutas de la red la que resulta estad sticamente m s larga es cr tica los diferentes nodos eventos del proyecto se cumplen en un tiempo Ti te suma de valores aleatorios te Esta variable Ti tambi n es aleatoria pero distribuida conforme a una normal Los valores obtenidos para cada uno de los eventos del proyecto son particulares lo cual es pr cticamente imposible manejar Para superar este inconveniente el modelo PERT probabil stico propone una conversi n de los valores particulares hacia los valores de una distribuci n normal est ndar con par metros N p N 0 1 PN IUD NR A Y la fi la con la f rmula Si En donde Z es la desviaci n normal est ndar que se puede encontrar en las tablas de distribuci n normal T es el tiempo esperado para el evento i de inter s en el proyecto S es la ra z cuadrada de la variancia S que se puede calcular por la suma de las variancias de los trabajos sobre la ruta mayor para cumplir el evento i TP ies tiempo programado por la administraci n
80. lemVP elemVP VP nk else begin ColaVP EnQueue elemVP SizeOf TStr4 elemVP 68 SysPert Manual T cnico end for nk 1 to ColaGpos Size do carrusel del grupo para verificar si est en VP begin ColaGpos DeQueue rGpos SizeOf rGpos for k 1 to ColaVP Size do carrusel de VP begin ColaVP DeQueue elemVP SizeOf elemVP ColaVP EnQueue elemVP SizeOf elemVP if rGpos Cad elemVP then rGpos Si True end ColaGpos EnQueue rGpos SizeOf rGpos end for nk 1 to ColaGpos Size do verificaci n final begin ColaGpos DeQueue rGpos SizeOf rGpos Ok 0k and rGpos Si end gpoVP Ok end gpoVP procedure M3R var JComun word kG nG gk kAux integer f131 flGpo flOk boolean gS gSn ShortString nk word begin JGpo Init Gpo VSize JComun 0 kG 0 gk 0 for kAux 1 to JGpo MaxVectorSize do inicializa el arreglo las J s de los grupos en cero JGpo Store kAux 0 for kAux 1 to cVPA Items In do begin determinar si hay a31 mediante un carrusel en cVPA cVPA DeQueue aVP SizeOf aVP VActival Recall aVP Ap if Ap cM3 1 then f131 True levanta fl31 si hubiera a31 cVPA EnQueue aVP SizeOf aVP end for kAux 1 to cVPA Items Inj repeat comprueba que un Gpo est contenido en Al VP ine gk Gpo Recall gk gS flGpo gpoVP gS A1 VP se levanta la bandera si el Gpo est contenido flGpo pos gS A1 VP lt gt 0 69 SysPert Manual T cnico if flGpo el grupo si est cont
81. lista FormActivate Inicializa algunas variables antes de abrir el formulario btAuxClick Actualmente inhabilitado se utiliz para pruebas btGrabarClick Graba en un archivo la lista de actividades actual btRecuperarClick Abre un archivo pregrabado con una lista de actividades actualmente inhabilitado TerminarlClick Cierra la aplicaci n 7 CargarDatos2 Carga el vector VEstima con base en VActival y los tiempos de la tabla de datos Qn de OS e 24 SysPert Manual T cnico AlrededordesuTP1Click Calcula la probabilidad de terminar el proyecto en su TE d ExactamenteenlClick Calcula la probabilidad de terminar el proyecto exactamente en T Antesde2Click Calcula la probabilidad de no terminar el proyecto antes de su TP Enelperiodo1Click Calcula la probabilidad de no terminar el proyecto dentro de un btCreaRedClick Inicia los procesos de preparaci n de datos creaci n de la red c lculo de probabilidades y exhibici n de resultados btSalirClick Cierra la aplicaci n FormCreate Crea el formulario MiCodigos y Grafica sgActiviDatosKeyPress Crea una actividad vac a al oprimir Enter AntesdelClick Calcula la probabilidad de terminar el proyecto antes de su TP TerminarelproyectoenelperiodolClick Calcula la probabilidad de terminar el proyecto en el periodo T1 T2 determinado periodo T1 T2 ConprobabilidadlClick Calcula el tiempo de terminaci n del proyecto con una probab
82. lt gt VectB VSize THEN BEGIN VectorOpStatus FALSE EXIT END FOR I 1 TO VSize DO VecPtr I VecPtr I VectB VecPtr I VectorOpStatus TRUE END FUNCTION WVector MultVector VectB WVector input word VAR EWORD Sum word BEGIN IF VSize lt gt VectB VSize THEN BEGIN VectorOpStatus FALSE MultVector 0 EXIT END SUM 0 FOR I 1 TO VSize DO Sum Sum VecPtr I VectB VecPtr I VectorOpStatus TRUE MultVector Sum return function value END CONSTRUCTOR TVEstima Init MaxElem WORD input y BEGIN MaxVectorSize MaxElem VSize 0 GetMem VecPtr MaxElem SizeOf word VectorOpStatus TRUE 119 SysPert Manual T cnico END DESTRUCTOR TVEstima Done BEGIN MaxVectorSize 0 VSize 0 FreeMem VecPtr Max VectorSize SizeOf word VecPtr NIL VectorOpStatus TRUE END FUNCTION TVEstima CurrentSize WORD BEGIN VectorOpStatus TRUE CurrentSize VSize END PROCEDURE TVEstima Store Index WORD input X TEstima input BEGIN IF Index gt MaxVectorSize THEN BEGIN VectorOpStatus FALSE EXIT END VecPtr Index X IF Index VSize THEN VSize Index VectorOpStatus TRUE END PROCEDURE TVEstima Recall Index WORD input VAR X TEstima output BEGIN IF Index gt V Size THEN BEGIN VectorOpStatus FALSE X tOp 0 X tMe 0 X tPe 0 X DurMe 0 EXIT END X VecPtr Index VectorOpStatu
83. mVp array of array of integer CodApa array of array of integer GruposA array of array of integer MiDondeGrupos array of array of integer CRI array of integer 13 VD 0 0 UU Non ra SysPert Manual T cnico Especificaciones destruir Graficar DarTamano GuardarCordenadas ordenar MaxMin LasX LonY Lasy Arreglar CreaObjetos NEliminar NDibujar MoverNodo MoverNodo2 Arrastrar ArrastraSobre NMover Shift NRevizar NRevizar2 NBarras NAcomodar CambiarTamano Flechas QuecarBarras MostrarCombo ObtenCoordenadas Al oprimir el bot n Crear Red se inician todos los procesos para tener la red y el programa de Representaci n Tamano Integer Max Min integer X array of integer Y array of integer LoY array of array of integer LoXZ array of array of integer Coor array of array of integer CoorTipo Array of Integer CoorTipo2 Array of Integer NNodos array of Tshape Ima Timage Zoom TEdit Indice Integer Etiqueta TLabel Etiqueta2 array of TLabel BarraHorizontal TScrollBar BarraVertical TScrollBar Escala Integer Posicion Integer AntBarraHor Integer AntBarraVer Integer XIma Yima integer Hecha boolean tiempos A continuaci n se muestra el manejador de tal evento procedure TfinMain btCreaRedClick Sender TObject Inicia los procesos de preparaci n de datos creaci n de la red c lculo de tiempos y holguras c lculo de probabilida
84. na red a partir de la lista de actividades y sus precedentes utilizando el programa SysRed El modelo utilizado se denomina AOA actividades en los arcos Los m dulos que constituyen este programa son Principal UMain UDatos Ucode Ured y UCpm El m dulo Principal inicializa el proceso crea el formulario y corre la aplicaci n UMain es el m dulo b sico y opera pr cticamente toda la aplicaci n Contiene al formulario principal y es la interfaz gr fica del usuario se utiliza tanto para la captura de datos como para el despliegue de resultados La siguiente figura muestra el formulario con el men principal barra de herramientas la p gina de entrada de datos visible las p ginas no visibles de resultados en forma tabular y la de la gr fica de la red La p gina de entrada muestra la tabla de actividades LINZ Decuments and Settings MARI WA documentos che Verts WersiseRostz VC omkSiuiz MICO 201 ct febo Ver D a 8 p Pai Pewasson Bico Minen Hortes Prscadentes Duraci n Si 6 1 3 5 Pubs lt irtros par rtrodude otra actividad En la figura aparece la lista de 12 actividades con su vector de precedentes La red se obtiene al oprimir el bot n rotulado Crear red y los resultados se presentan en forma tabular y de manera gr fica Las siguientes figuras muestran las dos panatallas de salida tabular y gr fica 20 SysPert Manual T cnico te Wersant Con VRulz Y P MUN 201 cpr Escumen
85. ord Nombre ShortString LVP word VP ShortString WVector i j word cApar byte cM3 byte cR word Ok byte boolean Index2 word end TRVcpm record Index word ij word Dur real word iPx tPx real integer iLx tLx real integer hTotal hLib hInter real integer end TRFic record 1 j word 114 SysPert Manual T cnico end TRC record Index 1 j word end TRLin6 array 0 6 of ShortString TRLin8 array 0 8 of ShortString TRLin9 array 0 9 of ShortString TStr4 string 4 TcParm array 1 5 of string TVP array 1 100 of word TGrupocarray 1 maxGpos of ShortString TRGpos record Cad TStr4 Si boolean end OneActiva ARRAY 1 1 OF TVActiva OneActivaPtr OneActiva AVector OBJECT Max VectorSize VSize WORD VecPtr OneActivaPtr VectorOpStatus BOOLEAN CONSTRUCTOR Init MaxElem WORD input DESTRUCTOR Done FUNCTION CurrentSize WORD PROCEDURE Store Index WORD input A TVActiva input PROCEDURE Recall Index WORD input VAR A TVActiva output end OneCPM array 1 1 of TRVcpm OneCPMPtr OneCPM TVcpm OBJECT MaxVectorSize VSize WORD VecPtr OneCPMPtr VectorOpStatus BOOLEAN 115 SysPert Manual T cnico CONSTRUCTOR Init MaxElem WORD input DESTRUCTOR Done FUNCTION CurrentSize WORD PROCEDURE Store Index WORD
86. ow TRUE ELSE IF ItemSize lt gt InfoSize THEN Status Object_ MisMatch TRUE ELSE BEGIN Last_Op_Ok TRUE NEW NewNodePtr NewNodePtr Init Item ItemSize NIL IF Size 0 THEN Top NewNodePtr ELSE Bottom SetNext fto NewNodePtr EndIf Bottom NewNodePtr INC Size END If END Queue EnQueue xdg pa a a a LE PROCEDURE Queue DeQueue VAR Item UNTYPED ItemSize WORD BEGIN Pop Item ItemSize IF Size 0 THEN Bottom NIL EndIf END Queue DeQueue J ERRE E EAEE AAE E E EAE EA EL LL CM o EEE ERE E PROCEDURE Queue Traverse Visit VisitProc VAR SaveTop POINTER BEGIN SaveTop Top WHILE Top lt gt NIL DO BEGIN Visit BYTE Top Info cheats to look at node Top Top Next END While Top SaveTop Status Reset 129 SysPert Manual T cnico Last_Op_Ok TRUE END Stack Clear 3K ole ae K K e e K e ole oe e ode 2K oe ole oe K ole e oe OO OO ole oe ole ole oe ole ole e ole ole ole ole ole ole ok LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL end 130
87. p 1 if not fIM2 then begin if fliCero then flP True fiFaltante ColaAP EnQueue aVP SizeOf word VActival Recall aVP Ap VActival Store Ap Index Ap end dec kAux until fIM2 or kAux 0 end if cVPA Is Empty end while nuevo c digo if not flDoneCaso2 then if fIP or fIM3 then M3 GrupoMj else MIoM2 end ParMas procedure Pares Ax TActiva var A1 TV Activa begin 76 SysPert Manual T cnico VActival Recall Ax Index A 1 if Al Ok 0 then if Al cApar 0 and A1 1 gt 0 then begin if not flJMax then begin inc JMax flJMax True end VActival Recall Ax Index A 1 A1 j JMax A1 Ok 1 VActival Store Al Index Al end else case Al LVP of 0 ParCero Ax 1 ParUno Ax else ParMas Ax end case tend j end Pares procedure ArmaRed var Ax TActiva Al Ap TVActiva begin fliP False flJMax False JMax 1 ColaFic Init SizeOf TR Fic 1000 if not Colal Is Empty then begin Colal DeQueue Ax SizeOf Ax VActival Recall Ax Index A1 repeat if Al cR gt 0 and A1 i gt 1 and A1 cApar gt 0 then begin VActival Recall A1 cR Ap Al i Ap i VActival Store Al Index Al if Colal Items In lt nT then begin if not flJMax then begin inc JMax 77 SysPert Manual T cnico flJMax True end VActival Recall Ax Index A 1 Al j JMax A1 Ok 1 VActival Store Al Index A 1 end end else Pares Ax VActival Recal
88. rCpm iPx Rows k Strings 4 Format 10 2f rCpm iPx FloatTostr rCpm iPx Rows k Strings 5 Format 10 2f rCpm tPx FloatTostr rCpm tPx Rows k Strings 6 Format 10 2f rCpm iLx FloatTostr rCpm iLx Rows k Strings 7 Format 10 2f rCpm tLx FloatTostr rCpm tLx Rows k Strings 8 Format 10 2f rCpm hTotal FloatTostr rCpm hTotal Rows k Strings 9 Format 10 2f rCpm hLib FloatTostr rCpm hLib Rows k Strings 10 Format 10 2f rCpm hInter FloatTostr rCpm hInter until k Vcpm VSize end with fmMain sgFic fmMain label2 Caption Duracion esperada del proyecto es Ti Format f DurPro FloatTostr DurPro fmMain labell Caption La varianza del proyecto es SY2 Format f Sigm fmMain labell Visible True fmMain label2 Visible True end ReCargaDatos 3 6 7 8 9 m m m A procedure TfmMain btAddActsClick Sender TObject A ade actividades a la lista begin sgActiviDatos Cells 0 sgActiviDatos RowCount IntToStr sgActiviDatos RowCount sgActiviDatos Cells 1 sgActiviDatos RowCount A sgActiviDatos Cells 4 sgActiviDatos RowCount IntToStr 0 sgActiviDatos Cells 5 sgActiviDatos RowCount IntToStr 0 sgActiviDatos Cells 7 sgActiviDatos RowCount IntToStr 0 sgActiviDatos RowCount sgActiviDatos RowCount 1 sgActiviDatos FixedRows 1 btCreaRed Enabled True 44 SysPert Manual T cnico end procedure TfmMain FormActivate Sender TOb
89. re TfmMain Abrirundocumentol Click Sender TObject Abre un archivo pregrabado con una lista de actividades var f file of TRLin6 k kl word Lin TRLin6 begin StatusBar1 SimpleText Pulse lt Intro gt para introducir otra actividad if OpenDialogl Execute then begin Resetear AssignFile f OpenDialogl FileName fmMain Caption Pert OpenDialog1 FileName 53 SysPert Manual T cnico Reset f with fmMain sgActiviDatos do begin k 1 RowCount 1 while not EOF f do begin Read f Lin Lin 0 Format 8d StrToInt Lin 0 Lin 3 Format 8d StrToInt Lin 3 Lin 4 Format 8d StrToInt Lin 4 Lin 5 Format 8d StrToInt Lin 5 RowCount RowCount 1 FixedRows 1 for kl 0 to 6 do Rows k Strings kl Lin kl inc k end while end with btCreaRed Enabled True Calcularl Enabled False end end LL A e Lac or rr ur LL LL or rr m procedure TfmMain GuardarundocumentolClick Sender TObject Graba en un archivo la lista de actividades actual var f file of TRLin6 k kl word Lin TRLin6 S string begin if SaveDialogl Execute then begin AssignFile f SaveDialogl FileName S SaveDialog1 FileName Rewrite f with fmMain sgActiviDatos do for k 1 to RowCount 1 do begin for kl 0 to 6 do Lin kl Rows k Strings kl Write f Lin end end if SaveDialogl Execute then end 54 SysPert Manual T cnico procedure TfmMain Precedentes1 Click Sender TObjec
90. re btAuxClick Sender TObject procedure btCreaRedClick Sender TObject procedure btGrabarClick Sender TObject procedure btRecuperarClick Sender TObject procedure Terminarl Click Sender TObject procedure btSalirClick Sender TObject procedure FormCreate Sender TObject procedure sgActiviDatosKeyPress Sender TObject var Key Char procedure Antesdel Click Sender TObject procedure TerminarelproyectoenelperiodolClick Sender TObject procedure AlrededordesuTP 1 Click Sender TObject procedure Exactamenteen1Click Sender TObject procedure Antesde2Click Sender TObject procedure Enelperiodo1 Click Sender TObject procedure Conprobabilidadl Click Sender TObject procedure Abrirundocumentol Click Sender TObject procedure Guardarundocumentol Click Sender TObject procedure Precedentes1 Click Sender TObject procedure Ficticiasl Click Sender TObject procedure probOcurrEvTPClick Sender TObject procedure CargarDatos2 35 SysPert Manual T cnico procedure FormClose Sender TObject var Action TCloseAction procedure VercomplementolClick Sender TObject procedure tbtNuevoClick Sender TObject private Private declarations public Public declarations end var fmMain TfmMain Grafica Aco implementation uses UDatos URed UCPM Upert R DFM procedure IniciaFormas Prepara las tablas de datos y resultados con encabezados y ancho de columnas begin with fmMain do begin
91. relice alrededor de T es Format f 1 ArZ 100 FloatToStr 1 ArZ 100 fmMain lbProbaCom Visible False end 3 begin fmMain lbProba Caption La probabilidad que se relice exactamente en T es Format f ArZ 100 FloatToStr ArZ 100 fmMain lbProbaCom Caption La probabilidad que no se relice exactamente en T es Format f 1 ArZ 100 FloatToStr 1 ArZ 100 end 4 begin fmMain lbProbaCom Caption La probabilidad que no se relice entre TP1 y TP2 es Format Yof 1 ArZ 100 FloatToStr 1 ArZ 100 fmMain lbProbaCom Visible True fmMain lbProba Visible False end end case 109 SysPert Manual T cnico ffmMain lbProbaCom Visible True end if TP2 lt TP1 else end CalcAreaZZ procedure CalZIzq Pro Mu Sigma real Op integer var rZ TP real begin rZ Kalcula Pro TP Mu rZ Sigma fmMain lbProba Caption El tiempo necesario para una FloatToStr Pro 100 es FloatToStr TP fmMain lbProba Visible True end CalZIzq end brobabilidad de 110 SysPert Manual T cnico unit UDatos interface const maxGpos 10 Type TRIndex record Index word i j word LenVP word Ok boolean end TEstima record Index word tOp tMe tPe DurMe Varianza real end OneInt ARRAY 1 1 OF word OnelntPtr OnelInt WVector OBJECT Max VectorSize VSize WORD VecPtr OneIntPtr
92. rocedure CreaGrupos Crea los grupos de actividades precedentes var Al Ap nlAp TV Activa GpoVP GpoVector aPiv aVP word k gk pk word mLVP nFin integer mLVP minimo LVP cVP32 cVPG Queue flg fl32 boolean gS gSS ShortString sVP ShortString begin CreaGrupos cVP32 Init SizeOf word maxGpos inicializa cola de actividades con cM32 nicamente Index s cVPG Init SizeOf word maxGpos inicializa cola con VP s para el vector de grupos for k 1 to VActival VSize do crea cola de actividades con VP cM3 2 begin flG False VActival Recall k A1 sVP pk 1 if Al LVP gt 1 then selecciona actividades con cM32 repeat if Al VP pk lt brinca las comas y convierte a n mero el elemento del VP then sVP sVP A1 VP pk else begin VActival Recall StrToInt s VP Ap fIG Ap cM3 2 verifica si el elemento del VP tiene cM32 sVP end inc pk until flG or pk gt Length A1 VP if A1 LVP gt 1 and not flG necesario para incluir en el an lisis a la ltima actividad de A1 VP then begin VActival Recall StrToInt sVP Ap flG Ap cM3 2 end if flG then cVP32 EnQueue A1 Index SizeOf A1 Index encola actividades Ap con cM32 end for k 1 crea cola de actividades con VP cM3 2 39 SysPert Manual T cnico if cVP32 Items In gt 0 then begin Filtrol elimina actividades que no empiecen Ap con cM32 sVP necesaria para el Filtrolj for k 1 to cVP32 Items
93. s TRUE END PROCEDURE TVEstima Fill FillValue TEstima input NumElem WORD input 120 SysPert Manual T cnico VAR I WORD BEGIN IF NumElem gt MaxVectorSize THEN NumElem MaxVectorSize VSize NumElem FOR I 1 TO NumElem DO VecPtr I FillValue VectorOpStatus TRUE END CONSTRUCTOR AVector Init MaxElem WORD input BEGIN Max VectorSize MaxElem VSize 0 GetMem VecPtr MaxElem SizeOf TV Activa VectorOpStatus TRUE END DESTRUCTOR AVector Done BEGIN MaxVectorSize 0 VSize 0 FreeMem VecPtr Max VectorSize SizeOf T V Activa VecPtr NIL VectorOpStatus TRUE END FUNCTION AVector CurrentSize WORD BEGIN VectorOpStatus TRUE CurrentSize VSize END PROCEDURE AVector Store Index WORD input A TVActiva input it BEGIN IF Index gt MaxVectorSize THEN BEGIN VectorOpStatus FALSE EXIT END VecPtr Index A IF Index gt VSize THEN VSize Index VectorOpStatus TRUE END 121 SysPert Manual T cnico PROCEDURE AVector Recall Index WORD input VARA TVActiva output BEGIN IF Index gt V Size THEN BEGIN VectorOpStatus FALSE A Nil Corregir a una actividad nula EXIT END A VecPtr Index VectorOpStatus TRUE END CONSTRUCTOR TVcpm Init MaxElem WORD input BEGIN MaxVectorSize MaxElem VSize 0 GetMem VecPtr MaxElem SizeOf TRVcpm VectorOpStatus TRUE
94. s rutas que conectan los trabajos de inicio con los intermedios y termina con las actividades finales del proyecto Una actividad en flecha i j debe tener en ambos extremos un nodo i i 1 2 de inicio y un nodo j j 1 2 terminal el par i j en donde i lt j identifica cada trabajo Es importante el dise o de una red proyecto pues puede ser dif cil de representar si se busca evitar cruces de l neas ubicar los nodos de inicio y terminaci n en la orilla de la red y usar s lo las necesarias actividades ficticias estas sirven para completar las precedencias entre trabajos reales Los siguientes esquemas son ejemplo para representar e interpretar la posible relaci n de precedencia entre actividades de cualquier red proyecto o o Nodo evento de inicio i Nodo evento terminal j A yore A JEU T Uca P cs Fi Fi E d Rd A Ejemplo de un trabajo ficticio F su efecto en una secuencia de trabajos reales en un proyecto A la izquierda de la figura se muestra que los trabajos B y C se inician hasta que su precedente A termina adem s seg n la flecha ficticia F tambi n deben esperar el fin de otras precedentes R y S el inicio de T s lo depende de R y S En la derecha de la misma figura se invierte la ficticia contin a la secuencia en B y C despu s de A pero T depende de las precedentes R S y A La regla para utilizar un trabajo ficticio es evitar que dos o m s actividades se identifiquen con un mismo par 1 j esto
95. t Marca la opci n ver precedentes begin Precedentes1 Checked not Precedentes1 Checked end procedure TfmMain FicticiaslClick Sender TObject Conmuta para hacer visibles o no las actividades ficticias begin Ficticiasl Checked not Ficticias1 Checked sgFic Visible Ficticiasl Checked end Probabilidad de ocurrencia de un evento dado en un tiempo programado procedure TfmMain probOcurrEvTPClick Sender TObject Calcula la probabilidad de que ocurra un determinado evento en un tiempo dado var Ok boolean nEv ik integer iPiv integer tPxPiv real rRC TRC rParm TcParm rCpm TRVcpm rEstima TEstima sEv sTP string begin TfmMain probOcurrEvTPClick if InPutQuery Probabilidad de ocurrencia de un evento dado Escriba el No del evento sEv then if InPutQuery Probabilidad de ocurrencia de un evento dado Escriba el TP sTP then begin Sigma 0 ik 0 Ok False nEv StrTolnt sEv repeat buscar en Vcpm el evento target para determinar la Mu actual inc ik Vcpm Recall ikrCpm if rCpm i nEv then begin Mu rCpm iPx tPxPiv rCpm tPx necesario para la b squeda de la ruta en el siguiente paso Ok True end until Ok or not Vepm VectorOpStatus repeat buscar en Vcpm la ruta hasta el evento inicial Ok False 55 SysPert Manual T cnico ik 0 iPiv nEv repeat inc ik Vcpm Recall ik rCpm if rCpm j iPiv and rCpm tPx tPxPiv then encontr el evento en la ruta begin VEstima
96. t 1 then CodApa ElemVp LJ 2 1 QUE SI NO VIENE SOLO OSEA ACOMPA ADO LE PONE UN 1 end if ElemVp I J lt gt 0 end for J 1 to High ElemVp I SE MANEJA POR FILA COLUMNA DONDE LA FILA SERA EL INDICE for K 1 to VActival MaxVectorSize do 94 SysPert Manual T cnico for L 1 to High CodApa K do begin VActival Recall K eso SOLO ACOMPANADO if CodApa K 1 0 and CodApalK 2 0 then eso cApar 0 NO APARECE else if CodApa K 1 1 and CodApa K 2 0 then eso cApar 1 APARECE SOLO else if CodApa K 1 1 and CodApa K 2 1 then eso cApar 2 APARECE SOLO Y ACOMPANADO else if CodApa K 1 0 and CodApa K 2 1 then eso cApar 3 APARECE ACOMPANADO VActival store K eso end for L 1 to High CodApa K end TCodigos CodAparicion SPEER SAA TE A E FEK E Re ee ee E E E AEAEE UE SE ERE ERE E LASTE a dd o ee ee E EEE Function TCodigos a X integer integer var esol TVActiva b string begin VActival Recall X esol b Esol vp result length esol vp end TCodigos a eae eer EE E E REDE Ree eR EE ctc a M LM E LL M D LL LLL MALI Ll o db eee function TCodigos GuardarDatos integer ME ALMACENA LOS DATOS EN EL ARREGLO DE LA CLASE var SI UNO SOBREPASA EL LIMITE RETORNA ERROR esol TVActiva k integer I J integer L M integer StrCola string 4 IntCola integer colaz Queue begin SetLength ElemVp 0 SetLength ElemVp VActival MaxVectorSiz
97. tiva var aPri aSeg TActiva Al APrimera ASegunda TV Activa MaxJ word begin cMi Dequeue aPri SizeOf aPri VActival Recall aPri Index A Primera if APrimera j 0 64 SysPert Manual T cnico then begin inc JMax APrimera j JMax end while not cMi Is Empty do begin cMi DeQueue aSeg SizeOf aSeg VActival Recall aSeg Index A Segunda if ASegunda j 0 then begin inc JMax ASegunda j JMax end if APrimera j lt ASegunda j then begin RFic i APrimera j MaxJ ASegunda APrimera Ok 1 VActival Store APrimera Index A Primera APrimera ASegunda end else begin RFic i ASegunda j MaxJ APrimera j ASegunda Ok 1 VActival Store ASegunda Index ASegunda end ColaIP EnQueue R Fic i SizeOf word end while RFic j MaxJ APrimera Ok 1 VActival Store APrimera Index A Primera repeat ColaIP DeQueue RFic i SizeOf word ColaFic EnQueue RFic SizeOf RFic until ColalP Is Empty end SolMi procedure M2 var k ki kJ word pivA TActiva begin k ColaVP Items In cMi Init SizeOf T Activa k cVPA Clear cVPA ColaVP 65 SysPert Manual T cnico while not cVPA Is Empty do begin cVPA DeQueue pivA SizeOf pivA VActival Recall pivA Index pivAp k cVPA Items In repeat cVPA DeQueue Ap Index SizeOf Ap Index revisar porque Ap VActival Recall Ap Index A1 revisar porque Ap con Al if pivAp i lt gt A1 i then cVPA EnQueue Ap SizeOf Ap else cMi
98. tos2 realiza la carga de datos en VEstima cuya estructura se muestra a continuaci n TEstima record Index word tOp tMe tPe DurMe Varianza real end La siguiente figura muestra los campos de la tabla de datos que se guardan en VActival los que se guardan en VEstima y el ndice en Colal Tambi n se muestra el m dulo Codigos produciendo los valores de cAp CM3 y Cr que se guardan en VActival 15 SysPert Manual T cnico PREPARACION Y CARGA Tabla de datos VActiva Ir ee El proceso principal es de carrusel Cola 1 contiene en formaci n secuencial a las actividades que formar n la red El ndice de cada actividad se saca de Colal para su proceso y dependiendo de sus actividades precedentes el proceso pudiera quedar incompleto o concluirse En el primer caso proceso inconcluso la actividad no queda totalmente definida y su ndice es regrasado al final de Colal hasta que se pueda completar su proceso Se considera el proceso concluido cuando se han definido los valores de i y de j que componen el par de eventos inicial y terminal de cada actividad El proceso encargado de generar los c digos para VActival y que ser n la base para crear la red se muestra a continuaci n 16 VD 0 JC Un d un rz SysPert Manual T cnico procedure preparardatos Prepara los datos para su proceso asignando c digos a las actividades begin MiCodigos Tcodigos Create with MiCodigos do begin VerifComas
99. ts and Settings VAR VA documentos ici De 50 50 2 50 120 120 160 160 160 130 Duraci n del proyecto 35 Salida tabular Documents and Settings MARIOM TB documentos cis erts Wersisefostz V ge VR ui OP MVC 1 DA c pr 5 aj amp DJ Red Poison Erico pen RR Salida gr fica 21 SysPert Manual T cnico SysPert Este programa crea una red a partir de la lista de actividades y sus precedentes utilizando el programa SysRed El modelo utilizado se denomina AOA actividades en los arcos Los m dulos que constituyen este programa son Principal UMain UDatos Ucode Ured Ucpm UValZ y UPert El m dulo Principal inicializa el proceso crea el formulario y corre la aplicaci n UMain es el m dulo b sico y opera pr cticamente toda la aplicaci n Contiene al formulario principal y es la interfaz gr fica del usuario se utiliza tanto para la captura de datos como para el despliegue de resultados La siguiente figura muestra el formulario con el men principal barra de herramientas la p gina de entrada de datos visible las p ginas no visibles de resultados en forma tabular y la de la gr fica de la red La p gina de entrada muestra la tabla de actividades Pen C Documents and Settings MARIOW Is documentos cis Perto alc UN f 03 pet tecto Cau Ver Groe D ER Ped L en sien Gica N mero Nombre Con estos datos al oprimir el bot n Crear Red se construye la red de activ
100. typed Info_Size WORD Next_Node StackNodePtr 112 SysPert Manual T cnico PROCEDURE Yield Info VAR Yielded Info untyped Info Size WORD PROCEDURE Clear Info Size WORD END Stack Object REPRESENTATION Top StackNodePtr Size WORD MaxSize WORD InfoSize WORD Last Op Ok BOOLEAN Status StatusType SPECIFICATION Constructor Methods PROCEDURE Init ItemSize WORD Maxltems WORD PROCEDURE Clear PROCEDURE Push VAR Item UNTYPED ItemSize WORD PROCEDURE Pop VAR Item UNTYPED ItemSize WORD Selector Methods FUNCTION Is Empty BOOLEAN FUNCTION Is Full BOOLEAN FUNCTION Is Status Ok BOOLEAN FUNCTION Items In WORD PROCEDURE Show Status VAR F TEXT END QueueNodePtr QueueNode QueueNode Object StackNode QueueNode is an extension of StackNode extended method PROCEDURE SetNext to Ptr QueueNodePtr END VisitProc PROCEDURE VAR Item Queue Object Stack Queue is an extension of Stack 113 SysPert Manual T cnico REPRESENTATION Bottom QueueNodePtr SPECIFICATION Constructors PROCEDURE Init ItemSize WORD Maxltems WORD PROCEDURE Clear PROCEDURE EnQueue VAR Item UNTYPED ItemSize WORD PROCEDURE DeQueue VAR Item UNTYPED ItemSize WORD Iterator PROCEDURE Traverse Visit VisitProc END TActiva record Index word end TVActiva record Index w
101. uena rEstima tMe StrToFloat sgActiviDatos Cells 4 rActiva Index2 rEstima tPe StrToFloat sgActiviDatos Cells 5 rActiva Index2 rEstima DurMe 0 16666666666666666666666666666667 rEstima tOp 4 rEstima tMe rEstima tPe rEstima Varianza Sqr 0 16666666666666666666666666666667 rEstima tOp rEstima tPe VEstima Store rActiva Index2 rEstima end end AA A ADOS SET 47 SysPert Manual T cnico procedure TfmMain btCreaRedClick Sender TObject Inicia los procesos de preparaci n de datos creaci n de la red c lculo tiempos y holguras calculo de probabilidades y exhibici n de resultados begin CargaDatos Preparardatos CargarDatos2 CreaGrupos ArmaRed Cpm Calcularl Enabled True ReCargaDatos TabSheet2 Visible True PageControll ActivePage TabSheet2 btCreaRed Enabled False MiGrafica Grafica Graficar PnGraficar end procedure TfmMain btSalirClick Sender TObject Cierra la aplicaci n var a array of array of integer begin Application Terminate end procedure TfmMain FormCreate Sender TObject Crea el formulario MiCodigos y Grafica begin MiCodigos Tcodigos Create Grafica aco create sgActiviDatos Visible True PageControll ActivePage TabSheetl end procedure TfmMain sgActiviDatosKeyPress Sender TObject var Key Char Crea una actividad vacia al oprimir lt Enter gt begin if Key 13 then begin sgActiviDatos RowCount sgActiv
102. var eso esol esoAux TV Activa VActiva2 VActiva3 A Vector L j k l integer A integer NuevoOrden array of integer C320 array of integer Nuevo array of array of integer begin SetLength NuevoOrden VActival MaxVectorSize 1 V Activa2 Init VActival MaxVectorSize VActiva3 Init VActival MaxVectorSize A 1 for I 1 to VActival MaxVectorSize do ME ACOMODA PRIMERO A LOS CEROS begin DEL LVP VActival Recall Leso if eso LVP 0 then begin VActiva2 Store A eso A AHl end if eso LVP 0 then end for I 1 to VActival MaxVectorSize for I 1 to A 2 do ME ACOMODA PRIMERO A LOS CEROS begin for J I 1 to A 1 do begin VActiva2 Recall I eso VActiva2 Recall J eso1 if eso cApar gt esol cApar then begin VActiva2 Store I eso1 carga ambos datos VActiva2 Store J eso end if eso cApar gt esol cApar then end for J I 1 to A 1 DEL LVP 85 SysPert Manual T cnico end for I 1 to A 2 for I 1 to VActival MaxVectorSize do ACOMODA A TODOS LOS QUE SU begin ILVP Y CAPA lt gt 0 VActival Recall Leso if eso LVP lt gt 0 and eso cApar lt gt 0 then begin VActiva2 Store A eso A A 1 end if eso LVP lt gt 0 and eso cApar lt gt 0 then end for I 1 to VActival MaxVectorSize for I 1 to VActival MaxVectorSize do begin VActival Recall Leso if eso LVP lt gt 0 and eso cApar 0 then ME ACOMODA ALOS CAP
Download Pdf Manuals
Related Search
Related Contents
Chapter 11 Jaguar 2002MY User's Manual Eltako BlueNet The Fitness Trampoline - FOLDING (INS-P-20487-00C La Vie à Bry - Bry-sur MANUALE DI METROLOGIA Manual - Thea Render Copyright © All rights reserved.
Failed to retrieve file