pntool-developers Mailing List for A Concurrency Tool Suite (Page 2)
Brought to you by:
compaqdrew,
miordache
You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(69) |
Jul
(86) |
Aug
(33) |
Sep
|
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2011 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
(3) |
Jun
(1) |
Jul
(10) |
Aug
(2) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
From: <com...@us...> - 2009-08-23 07:45:37
|
Revision: 240 http://pntool.svn.sourceforge.net/pntool/?rev=240&view=rev Author: compaqdrew Date: 2009-08-23 07:45:30 +0000 (Sun, 23 Aug 2009) Log Message: ----------- pipes description Modified Paths: -------------- codegen/supervisor_algorithm.txt Modified: codegen/supervisor_algorithm.txt =================================================================== --- codegen/supervisor_algorithm.txt 2009-08-23 07:45:26 UTC (rev 239) +++ codegen/supervisor_algorithm.txt 2009-08-23 07:45:30 UTC (rev 240) @@ -4,3 +4,11 @@ An array of plant names is serialized. The supervisor must know at run-time which plant executables to run. +RUN-TIME + +Four file descriptors are created for each child. There is a pipe (READ_END and WRITE-END files) *to* the child, and likewise *from* the child. The supervisor has READ_END for the "from" pipe and WRITE_END for the "to" pipe, while the child process has the opposite ends/file descriptors for the respective pipes. + +Since the processes are created with fork/exec, it's important to close file descriptors that are not needed by the process. For instance, on 491-499 of supervisor_static_include.h, the parent process closes the ends of the pipe that have been handed to the child. If the parent did not close these ends, the pipes would not flush properly. Likewise, the child must close its existing STDIN and STDOUT, as well as any pipe-ends it has inherited from the parent process during the exec. As a side note, file descriptor numbers are preserved across exec for posix platforms, so debug output from different processes should agree, which can assist in debugging pipe issues. + + + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2009-08-23 07:45:32
|
Revision: 239 http://pntool.svn.sourceforge.net/pntool/?rev=239&view=rev Author: compaqdrew Date: 2009-08-23 07:45:26 +0000 (Sun, 23 Aug 2009) Log Message: ----------- algorithm description Added Paths: ----------- codegen/supervisor_algorithm.txt Added: codegen/supervisor_algorithm.txt =================================================================== --- codegen/supervisor_algorithm.txt (rev 0) +++ codegen/supervisor_algorithm.txt 2009-08-23 07:45:26 UTC (rev 239) @@ -0,0 +1,6 @@ +COMPILATION + +At compile time, certain transitions are marked as "blocked", that is, they share a label with some plant transition. An array of boolean values is serialized representing the "blocked" status of each transition (supervisorCompiler.c, setupDataStructures). + +An array of plant names is serialized. The supervisor must know at run-time which plant executables to run. + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2009-08-23 07:45:31
|
Revision: 238 http://pntool.svn.sourceforge.net/pntool/?rev=238&view=rev Author: compaqdrew Date: 2009-08-23 07:45:21 +0000 (Sun, 23 Aug 2009) Log Message: ----------- Documentation improvements Modified Paths: -------------- codegen/src/codegen.xcodeproj/drew.mode1v3 codegen/src/codegen.xcodeproj/drew.pbxuser codegen/src/supervisor_static_include.h Modified: codegen/src/codegen.xcodeproj/drew.mode1v3 =================================================================== --- codegen/src/codegen.xcodeproj/drew.mode1v3 2009-08-23 07:45:14 UTC (rev 237) +++ codegen/src/codegen.xcodeproj/drew.mode1v3 2009-08-23 07:45:21 UTC (rev 238) @@ -216,10 +216,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>3ABC8C091039CC1A0092549A</string> + <string>3A9EB43610411E80000F1EE2</string> <key>history</key> <array> - <string>3AD43B42100600C3006F6A93</string> + <string>3ABC8C11103B24130092549A</string> </array> </dict> <key>SplitCount</key> @@ -377,7 +377,7 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>3ABC8C081039CC1A0092549A</string> + <string>3A9EB43310411E80000F1EE2</string> <key>history</key> <array> <string>3A7FCEED0FBC046D00EF8097</string> @@ -394,7 +394,6 @@ <string>3AF91D7F0FF708B2009F6B4F</string> <string>3A47543F0FF732C700EE18BA</string> <string>3AC8A55F0FF827A900DE2863</string> - <string>3AC8A5610FF827A900DE2863</string> <string>3AC8A57F0FF8282C00DE2863</string> <string>3AC8A5D30FF8312800DE2863</string> <string>3AC8A5D50FF8312800DE2863</string> @@ -405,7 +404,8 @@ <string>3AD43B32100600C3006F6A93</string> <string>3AD43B33100600C3006F6A93</string> <string>3ABC8C051039CC1A0092549A</string> - <string>3ABC8C061039CC1A0092549A</string> + <string>3ABC8C0A103B24130092549A</string> + <string>3ABC8C10103B24130092549A</string> </array> <key>prevStack</key> <array> @@ -435,7 +435,6 @@ <string>3A4754420FF732C700EE18BA</string> <string>3AC8A56B0FF827A900DE2863</string> <string>3AC8A5700FF827A900DE2863</string> - <string>3ABC8C071039CC1A0092549A</string> </array> </dict> <key>SplitCount</key> @@ -493,9 +492,9 @@ </array> <key>TableOfContents</key> <array> - <string>3ABC8BFC1039CB660092549A</string> + <string>3A9EB43410411E80000F1EE2</string> <string>1CE0B1FE06471DED0097A5F4</string> - <string>3ABC8BFD1039CB660092549A</string> + <string>3A9EB43510411E80000F1EE2</string> <string>1CE0B20306471E060097A5F4</string> <string>1CE0B20506471E060097A5F4</string> </array> @@ -833,13 +832,13 @@ <key>TableOfContents</key> <array> <string>1CD10A99069EF8BA00B06720</string> - <string>3ABC8BFF1039CB660092549A</string> + <string>3A9EB43710411E80000F1EE2</string> <string>1C162984064C10D400B95A72</string> - <string>3ABC8C001039CB660092549A</string> - <string>3ABC8C011039CB660092549A</string> - <string>3ABC8C021039CB660092549A</string> - <string>3ABC8C031039CB660092549A</string> - <string>3ABC8C041039CB660092549A</string> + <string>3A9EB43810411E80000F1EE2</string> + <string>3A9EB43910411E80000F1EE2</string> + <string>3A9EB43A10411E80000F1EE2</string> + <string>3A9EB43B10411E80000F1EE2</string> + <string>3A9EB43C10411E80000F1EE2</string> </array> <key>ToolbarConfiguration</key> <string>xcode.toolbar.config.debugV3</string> Modified: codegen/src/codegen.xcodeproj/drew.pbxuser =================================================================== --- codegen/src/codegen.xcodeproj/drew.pbxuser 2009-08-23 07:45:14 UTC (rev 237) +++ codegen/src/codegen.xcodeproj/drew.pbxuser 2009-08-23 07:45:21 UTC (rev 238) @@ -17,15 +17,15 @@ 3A3A77E70FC891BD00DB2D28 /* petriNetSerializer.c:33 */, 3A3A783D0FC894C600DB2D28 /* supervisorCompler.c:116 */, 3A13FC180FDA5F3C0051F833 /* supervisorCompler.c:176 */, - 3A13FC1E0FDA5F810051F833 /* supervisor_static_include.h:314 */, - 3A13FC220FDA5F970051F833 /* supervisor_static_include.h:307 */, + 3A13FC1E0FDA5F810051F833 /* supervisor_static_include.h:322 */, + 3A13FC220FDA5F970051F833 /* supervisor_static_include.h:315 */, 3A13FC250FDA5FBA0051F833 /* supervisorCompler.c:174 */, - 3A13FC660FDA62D90051F833 /* supervisor_static_include.h:330 */, - 3A13FC680FDA62DA0051F833 /* supervisor_static_include.h:305 */, - 3A13FC750FDA64190051F833 /* supervisor_static_include.h:343 */, - 3A13FC780FDA64220051F833 /* supervisor_static_include.h:336 */, - 3A13FC800FDA64DC0051F833 /* supervisor_static_include.h:345 */, - 3A13FC830FDA66170051F833 /* supervisor_static_include.h:338 */, + 3A13FC660FDA62D90051F833 /* supervisor_static_include.h:338 */, + 3A13FC680FDA62DA0051F833 /* supervisor_static_include.h:313 */, + 3A13FC750FDA64190051F833 /* supervisor_static_include.h:351 */, + 3A13FC780FDA64220051F833 /* supervisor_static_include.h:344 */, + 3A13FC800FDA64DC0051F833 /* supervisor_static_include.h:353 */, + 3A13FC830FDA66170051F833 /* supervisor_static_include.h:346 */, ); codeSenseManager = 3A232C630FB214E900A5C7C2 /* Code sense */; executables = ( @@ -76,8 +76,8 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 272223062; - PBXWorkspaceStateSaveDate = 272223062; + PBXPerProjectTemplateStateSaveDate = 272703098; + PBXWorkspaceStateSaveDate = 272703098; }; perUserProjectItems = { 3A09E2E70FED6EEA003FAB0D = 3A09E2E70FED6EEA003FAB0D /* PBXTextBookmark */; @@ -104,42 +104,28 @@ 3A99A6650FB8E3DC00B1F47C = 3A99A6650FB8E3DC00B1F47C /* PBXTextBookmark */; 3A99A6C60FB8E78600B1F47C = 3A99A6C60FB8E78600B1F47C /* PBXTextBookmark */; 3A99A7400FB8EC6800B1F47C = 3A99A7400FB8EC6800B1F47C /* PBXTextBookmark */; - 3ABC8BFB1039CB660092549A /* PBXTextBookmark */ = 3ABC8BFB1039CB660092549A /* PBXTextBookmark */; - 3ABC8BFE1039CB660092549A /* PBXTextBookmark */ = 3ABC8BFE1039CB660092549A /* PBXTextBookmark */; - 3ABC8C051039CC1A0092549A /* PBXTextBookmark */ = 3ABC8C051039CC1A0092549A /* PBXTextBookmark */; - 3ABC8C061039CC1A0092549A /* PBXTextBookmark */ = 3ABC8C061039CC1A0092549A /* PBXTextBookmark */; - 3ABC8C071039CC1A0092549A /* PBXTextBookmark */ = 3ABC8C071039CC1A0092549A /* PBXTextBookmark */; - 3ABC8C081039CC1A0092549A /* PBXTextBookmark */ = 3ABC8C081039CC1A0092549A /* PBXTextBookmark */; - 3ABC8C091039CC1A0092549A /* PBXTextBookmark */ = 3ABC8C091039CC1A0092549A /* PBXTextBookmark */; + 3A9EB43310411E80000F1EE2 /* PBXTextBookmark */ = 3A9EB43310411E80000F1EE2 /* PBXTextBookmark */; + 3A9EB43610411E80000F1EE2 /* PBXTextBookmark */ = 3A9EB43610411E80000F1EE2 /* PBXTextBookmark */; + 3ABC8C051039CC1A0092549A = 3ABC8C051039CC1A0092549A /* PBXTextBookmark */; + 3ABC8C071039CC1A0092549A = 3ABC8C071039CC1A0092549A /* PBXTextBookmark */; + 3ABC8C0A103B24130092549A = 3ABC8C0A103B24130092549A /* PBXTextBookmark */; + 3ABC8C0B103B24130092549A = 3ABC8C0B103B24130092549A /* PBXTextBookmark */; + 3ABC8C0C103B24130092549A = 3ABC8C0C103B24130092549A /* PBXTextBookmark */; + 3ABC8C0D103B24130092549A = 3ABC8C0D103B24130092549A /* PBXTextBookmark */; + 3ABC8C10103B24130092549A = 3ABC8C10103B24130092549A /* PBXTextBookmark */; + 3ABC8C11103B24130092549A = 3ABC8C11103B24130092549A /* PBXTextBookmark */; 3AC8A55F0FF827A900DE2863 = 3AC8A55F0FF827A900DE2863 /* PBXTextBookmark */; - 3AC8A5610FF827A900DE2863 = 3AC8A5610FF827A900DE2863 /* PBXTextBookmark */; 3AC8A56B0FF827A900DE2863 = 3AC8A56B0FF827A900DE2863 /* PBXTextBookmark */; 3AC8A5700FF827A900DE2863 = 3AC8A5700FF827A900DE2863 /* PBXTextBookmark */; 3AC8A57F0FF8282C00DE2863 = 3AC8A57F0FF8282C00DE2863 /* PBXTextBookmark */; 3AC8A5D30FF8312800DE2863 = 3AC8A5D30FF8312800DE2863 /* PBXTextBookmark */; 3AC8A5D50FF8312800DE2863 = 3AC8A5D50FF8312800DE2863 /* PBXTextBookmark */; 3AC8A5ED0FF831E800DE2863 = 3AC8A5ED0FF831E800DE2863 /* PBXTextBookmark */; - 3AC8A5F20FF836F800DE2863 = 3AC8A5F20FF836F800DE2863 /* PBXTextBookmark */; - 3AC8A5F60FF836F800DE2863 = 3AC8A5F60FF836F800DE2863 /* PBXTextBookmark */; 3AD43B091005F566006F6A93 = 3AD43B091005F566006F6A93 /* PBXTextBookmark */; - 3AD43B0B1005F566006F6A93 = 3AD43B0B1005F566006F6A93 /* PBXTextBookmark */; - 3AD43B2D1005F955006F6A93 = 3AD43B2D1005F955006F6A93 /* PBXBookmark */; 3AD43B2E100600C3006F6A93 = 3AD43B2E100600C3006F6A93 /* PBXTextBookmark */; - 3AD43B2F100600C3006F6A93 = 3AD43B2F100600C3006F6A93 /* PBXTextBookmark */; 3AD43B31100600C3006F6A93 = 3AD43B31100600C3006F6A93 /* PBXTextBookmark */; 3AD43B32100600C3006F6A93 = 3AD43B32100600C3006F6A93 /* PBXTextBookmark */; 3AD43B33100600C3006F6A93 = 3AD43B33100600C3006F6A93 /* PBXTextBookmark */; - 3AD43B34100600C3006F6A93 = 3AD43B34100600C3006F6A93 /* PBXTextBookmark */; - 3AD43B35100600C3006F6A93 = 3AD43B35100600C3006F6A93 /* PBXTextBookmark */; - 3AD43B36100600C3006F6A93 = 3AD43B36100600C3006F6A93 /* PBXTextBookmark */; - 3AD43B37100600C3006F6A93 = 3AD43B37100600C3006F6A93 /* PBXTextBookmark */; - 3AD43B38100600C3006F6A93 = 3AD43B38100600C3006F6A93 /* PBXTextBookmark */; - 3AD43B3A100600C3006F6A93 = 3AD43B3A100600C3006F6A93 /* PBXTextBookmark */; - 3AD43B3B100600C3006F6A93 = 3AD43B3B100600C3006F6A93 /* PBXTextBookmark */; - 3AD43B3C100600C3006F6A93 = 3AD43B3C100600C3006F6A93 /* PBXTextBookmark */; - 3AD43B3D100600C3006F6A93 = 3AD43B3D100600C3006F6A93 /* PBXTextBookmark */; - 3AD43B3E100600C3006F6A93 = 3AD43B3E100600C3006F6A93 /* PBXTextBookmark */; - 3AD43B41100600C3006F6A93 = 3AD43B41100600C3006F6A93 /* PBXTextBookmark */; 3AD43B42100600C3006F6A93 = 3AD43B42100600C3006F6A93 /* PBXTextBookmark */; 3AEAF9100FB2697C00D61E73 = 3AEAF9100FB2697C00D61E73 /* PBXTextBookmark */; 3AEAF9120FB2697C00D61E73 = 3AEAF9120FB2697C00D61E73 /* PBXTextBookmark */; @@ -194,7 +180,7 @@ modificationTime = 267922699.957455; state = 2; }; - 3A13FC1E0FDA5F810051F833 /* supervisor_static_include.h:314 */ = { + 3A13FC1E0FDA5F810051F833 /* supervisor_static_include.h:322 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -206,12 +192,12 @@ functionName = "do_new_contract(char* buffer, int plant, reservation_structure *r)"; hitCount = 0; ignoreCount = 0; - lineNumber = 314; + lineNumber = 322; location = codegen; modificationTime = 267922699.957462; state = 2; }; - 3A13FC220FDA5F970051F833 /* supervisor_static_include.h:307 */ = { + 3A13FC220FDA5F970051F833 /* supervisor_static_include.h:315 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -222,7 +208,7 @@ fileReference = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; hitCount = 0; ignoreCount = 0; - lineNumber = 307; + lineNumber = 315; location = codegen; modificationTime = 267922699.957612; state = 2; @@ -243,7 +229,7 @@ modificationTime = 267922699.957716; state = 2; }; - 3A13FC660FDA62D90051F833 /* supervisor_static_include.h:330 */ = { + 3A13FC660FDA62D90051F833 /* supervisor_static_include.h:338 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -255,12 +241,12 @@ functionName = "do_new_contract(char* buffer, int plant, reservation_structure *r)"; hitCount = 0; ignoreCount = 0; - lineNumber = 330; + lineNumber = 338; location = codegen; modificationTime = 267922699.957726; state = 2; }; - 3A13FC680FDA62DA0051F833 /* supervisor_static_include.h:305 */ = { + 3A13FC680FDA62DA0051F833 /* supervisor_static_include.h:313 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -271,12 +257,12 @@ fileReference = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; hitCount = 0; ignoreCount = 0; - lineNumber = 305; + lineNumber = 313; location = codegen; modificationTime = 267922699.957816; state = 2; }; - 3A13FC750FDA64190051F833 /* supervisor_static_include.h:343 */ = { + 3A13FC750FDA64190051F833 /* supervisor_static_include.h:351 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -288,12 +274,12 @@ functionName = "do_new_contract(char* buffer, int plant, reservation_structure *r)"; hitCount = 0; ignoreCount = 0; - lineNumber = 343; + lineNumber = 351; location = codegen; modificationTime = 267922699.957918; state = 2; }; - 3A13FC780FDA64220051F833 /* supervisor_static_include.h:336 */ = { + 3A13FC780FDA64220051F833 /* supervisor_static_include.h:344 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -305,12 +291,12 @@ functionName = "do_new_contract(char* buffer, int plant, reservation_structure *r)"; hitCount = 0; ignoreCount = 0; - lineNumber = 336; + lineNumber = 344; location = codegen; modificationTime = 267922699.958003; state = 2; }; - 3A13FC800FDA64DC0051F833 /* supervisor_static_include.h:345 */ = { + 3A13FC800FDA64DC0051F833 /* supervisor_static_include.h:353 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -322,12 +308,12 @@ functionName = "do_new_contract(char* buffer, int plant, reservation_structure *r)"; hitCount = 0; ignoreCount = 0; - lineNumber = 345; + lineNumber = 353; location = codegen; modificationTime = 267922699.958088; state = 2; }; - 3A13FC830FDA66170051F833 /* supervisor_static_include.h:338 */ = { + 3A13FC830FDA66170051F833 /* supervisor_static_include.h:346 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -339,7 +325,7 @@ functionName = "do_new_contract(char* buffer, int plant, reservation_structure *r)"; hitCount = 0; ignoreCount = 0; - lineNumber = 338; + lineNumber = 346; modificationTime = 267922700.446616; state = 0; }; @@ -496,9 +482,9 @@ }; 3A4754340FF732AB00EE18BA /* supervisorCompiler.c */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1011, 2702}}"; - sepNavSelRange = "{0, 0}"; - sepNavVisRange = "{2909, 1078}"; + sepNavIntBoundsRect = "{{0, 0}, {1011, 2716}}"; + sepNavSelRange = "{1973, 0}"; + sepNavVisRange = "{0, 1308}"; }; }; 3A47543F0FF732C700EE18BA /* PBXTextBookmark */ = { @@ -836,10 +822,10 @@ }; 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {968, 9282}}"; - sepNavSelRange = "{11646, 0}"; - sepNavVisRange = "{6559, 1036}"; - sepNavWindowFrame = "{{130, 4}, {1027, 774}}"; + sepNavIntBoundsRect = "{{0, 0}, {1332, 8960}}"; + sepNavSelRange = "{13114, 0}"; + sepNavVisRange = "{3312, 1698}"; + sepNavWindowFrame = "{{459, 284}, {1027, 774}}"; }; }; 3A99A6650FB8E3DC00B1F47C /* PBXTextBookmark */ = { @@ -847,7 +833,7 @@ fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; name = "supervisor_static_include.h: 15"; rLen = 0; - rLoc = 15456; + rLoc = 16183; rType = 0; vrLen = 292; vrLoc = 0; @@ -879,25 +865,25 @@ vrLen = 457; vrLoc = 0; }; - 3ABC8BFB1039CB660092549A /* PBXTextBookmark */ = { + 3A9EB43310411E80000F1EE2 /* PBXTextBookmark */ = { isa = PBXTextBookmark; - fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; - name = "plantCompiler.c: 1050"; - rLen = 0; - rLoc = 35996; + fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; + name = "supervisor_static_include.h: 146"; + rLen = 6; + rLoc = 4294; rType = 0; - vrLen = 916; - vrLoc = 544; + vrLen = 731; + vrLoc = 10697; }; - 3ABC8BFE1039CB660092549A /* PBXTextBookmark */ = { + 3A9EB43610411E80000F1EE2 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; - name = "supervisor_static_include.h: 471"; + name = "supervisor_static_include.h: 483"; rLen = 0; - rLoc = 12387; + rLoc = 13114; rType = 0; - vrLen = 1036; - vrLoc = 6557; + vrLen = 1698; + vrLoc = 3312; }; 3ABC8C051039CC1A0092549A /* PBXTextBookmark */ = { isa = PBXTextBookmark; @@ -909,16 +895,6 @@ vrLen = 916; vrLoc = 544; }; - 3ABC8C061039CC1A0092549A /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; - name = "supervisor_static_include.h: 26"; - rLen = 0; - rLoc = 671; - rType = 0; - vrLen = 809; - vrLoc = 326; - }; 3ABC8C071039CC1A0092549A /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; @@ -929,25 +905,62 @@ vrLen = 916; vrLoc = 544; }; - 3ABC8C081039CC1A0092549A /* PBXTextBookmark */ = { + 3ABC8C0A103B24130092549A /* PBXTextBookmark */ = { isa = PBXTextBookmark; + fRef = 3A4754340FF732AB00EE18BA /* supervisorCompiler.c */; + name = "supervisorCompiler.c: 56"; + rLen = 0; + rLoc = 1973; + rType = 0; + vrLen = 1308; + vrLoc = 0; + }; + 3ABC8C0B103B24130092549A /* PBXTextBookmark */ = { + isa = PBXTextBookmark; fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; - name = "supervisor_static_include.h: 231"; + rLen = 1; + rLoc = 144; + rType = 1; + }; + 3ABC8C0C103B24130092549A /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; + name = "supervisor_static_include.h: 140"; rLen = 0; - rLoc = 6240; + rLoc = 4159; rType = 0; - vrLen = 751; - vrLoc = 5032; + vrLen = 921; + vrLoc = 8120; }; - 3ABC8C091039CC1A0092549A /* PBXTextBookmark */ = { + 3ABC8C0D103B24130092549A /* PBXTextBookmark */ = { isa = PBXTextBookmark; + fRef = 3A4754340FF732AB00EE18BA /* supervisorCompiler.c */; + name = "supervisorCompiler.c: 56"; + rLen = 0; + rLoc = 1973; + rType = 0; + vrLen = 1308; + vrLoc = 0; + }; + 3ABC8C10103B24130092549A /* PBXTextBookmark */ = { + isa = PBXTextBookmark; fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; - name = "supervisor_static_include.h: 471"; + name = "supervisor_static_include.h: 146"; + rLen = 6; + rLoc = 4294; + rType = 0; + vrLen = 731; + vrLoc = 10697; + }; + 3ABC8C11103B24130092549A /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; + name = "supervisor_static_include.h: 483"; rLen = 0; - rLoc = 12387; + rLoc = 13114; rType = 0; - vrLen = 1036; - vrLoc = 6559; + vrLen = 1698; + vrLoc = 3312; }; 3AC8A5430FF81EE900DE2863 /* MakeGen.h */ = { uiCtxt = { @@ -973,16 +986,6 @@ vrLen = 218; vrLoc = 0; }; - 3AC8A5610FF827A900DE2863 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3A4754340FF732AB00EE18BA /* supervisorCompiler.c */; - name = "supervisorCompiler.c: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 1078; - vrLoc = 2909; - }; 3AC8A56B0FF827A900DE2863 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 3AC8A5430FF81EE900DE2863 /* MakeGen.h */; @@ -1043,26 +1046,6 @@ vrLen = 643; vrLoc = 0; }; - 3AC8A5F20FF836F800DE2863 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; - name = "supervisor_static_include.h: 26"; - rLen = 0; - rLoc = 671; - rType = 0; - vrLen = 1135; - vrLoc = 0; - }; - 3AC8A5F60FF836F800DE2863 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; - name = "supervisor_static_include.h: 471"; - rLen = 0; - rLoc = 12387; - rType = 0; - vrLen = 1249; - vrLoc = 6344; - }; 3AD43B091005F566006F6A93 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 3AC8A5440FF81EE900DE2863 /* MakeGen.c */; @@ -1073,20 +1056,6 @@ vrLen = 1056; vrLoc = 0; }; - 3AD43B0B1005F566006F6A93 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3AC8A5440FF81EE900DE2863 /* MakeGen.c */; - name = "MakeGen.c: 68"; - rLen = 0; - rLoc = 1837; - rType = 0; - vrLen = 1056; - vrLoc = 0; - }; - 3AD43B2D1005F955006F6A93 /* PBXBookmark */ = { - isa = PBXBookmark; - fRef = 3A752B7E0FE6A2B300091C76 /* pns.h */; - }; 3AD43B2E100600C3006F6A93 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 3A752B7E0FE6A2B300091C76 /* pns.h */; @@ -1097,23 +1066,6 @@ vrLen = 1325; vrLoc = 283; }; - 3AD43B2F100600C3006F6A93 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3AD43B30100600C3006F6A93 /* main_function.c */; - name = "main_function.c: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 922; - vrLoc = 3933; - }; - 3AD43B30100600C3006F6A93 /* main_function.c */ = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.c; - name = main_function.c; - path = /Users/drew/Dropbox/Code/pntool/pnheaders/main_function.c; - sourceTree = "<absolute>"; - }; 3AD43B31100600C3006F6A93 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 3A752B7D0FE6A2B300091C76 /* pns.c */; @@ -1144,129 +1096,12 @@ vrLen = 1052; vrLoc = 245; }; - 3AD43B34100600C3006F6A93 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; - name = "plantCompiler.c: 171"; - rLen = 0; - rLoc = 4261; - rType = 0; - vrLen = 1276; - vrLoc = 3447; - }; - 3AD43B35100600C3006F6A93 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; - name = "plantCompiler.c: 171"; - rLen = 0; - rLoc = 4261; - rType = 0; - vrLen = 1276; - vrLoc = 3447; - }; - 3AD43B36100600C3006F6A93 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3A752B7E0FE6A2B300091C76 /* pns.h */; - name = "pns.h: 249"; - rLen = 0; - rLoc = 10108; - rType = 0; - vrLen = 1325; - vrLoc = 283; - }; - 3AD43B37100600C3006F6A93 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3A752B7D0FE6A2B300091C76 /* pns.c */; - name = "pns.c: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 789; - vrLoc = 825; - }; - 3AD43B38100600C3006F6A93 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3AD43B39100600C3006F6A93 /* main_function.c */; - name = "main_function.c: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 922; - vrLoc = 3933; - }; - 3AD43B39100600C3006F6A93 /* main_function.c */ = { - isa = PBXFileReference; - lastKnownFileType = sourcecode.c.c; - name = main_function.c; - path = /Users/drew/Dropbox/Code/pntool/pnheaders/main_function.c; - sourceTree = "<absolute>"; - }; - 3AD43B3A100600C3006F6A93 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3A752B7D0FE6A2B300091C76 /* pns.c */; - name = "pns.c: 1"; - rLen = 0; - rLoc = 0; - rType = 0; - vrLen = 789; - vrLoc = 825; - }; - 3AD43B3B100600C3006F6A93 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3A232C830FB21E0600A5C7C2 /* codegen.c */; - name = "codegen.c: 36"; - rLen = 0; - rLoc = 913; - rType = 0; - vrLen = 897; - vrLoc = 241; - }; - 3AD43B3C100600C3006F6A93 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; - name = "plantCompiler.c: 171"; - rLen = 0; - rLoc = 4261; - rType = 0; - vrLen = 1276; - vrLoc = 3447; - }; - 3AD43B3D100600C3006F6A93 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3AEE0D6E0FB3AA4900248D5F /* plantCompiler.h */; - name = "plantCompiler.h: 19"; - rLen = 0; - rLoc = 248; - rType = 0; - vrLen = 1052; - vrLoc = 245; - }; - 3AD43B3E100600C3006F6A93 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; - name = "plantCompiler.c: 1050"; - rLen = 0; - rLoc = 35996; - rType = 0; - vrLen = 917; - vrLoc = 544; - }; - 3AD43B41100600C3006F6A93 /* PBXTextBookmark */ = { - isa = PBXTextBookmark; - fRef = 3A752B7E0FE6A2B300091C76 /* pns.h */; - name = "pns.h: 20"; - rLen = 4; - rLoc = 457; - rType = 0; - vrLen = 1119; - vrLoc = 207; - }; 3AD43B42100600C3006F6A93 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; name = "supervisor_static_include.h: 471"; rLen = 0; - rLoc = 12387; + rLoc = 13114; rType = 0; vrLen = 1036; vrLoc = 6557; Modified: codegen/src/supervisor_static_include.h =================================================================== --- codegen/src/supervisor_static_include.h 2009-08-23 07:45:14 UTC (rev 237) +++ codegen/src/supervisor_static_include.h 2009-08-23 07:45:21 UTC (rev 238) @@ -118,7 +118,7 @@ #endif if (can_transition_locally_fire(u->t, supervisor)) { - somebodys_firing_transition = u->t; + somebodys_firing_transition = u->t; //this gridlocks much of the supervisor; we don't want things getting in an inconsistent state in the middle of a synchronized transition send_fire_msg(u,id,pipe); return YES; @@ -136,7 +136,8 @@ if (attempt_fire_something(supervisor, how_many_plants, &r->u[i], r->id,pipe)) { - r->selected_fire_something = i; //indicates which element of the reservation we've elected to fire + r->selected_fire_something = i; //indicates which element of the reservation we've elected to fire; + //this lets us address the fire_something by its reservation id. r->sent = 1; //indicates that we've sent a firemsg and no further communication to the plant is necessary return; } @@ -185,6 +186,8 @@ } return -1; } +//determines if a transition can locally fire. Doesn't take into account plant states. +//will return NO if a synchronized transition is in progress. int can_transition_locally_fire(int t, pns* supervisor) { if (somebodys_firing_transition != -1) //todo: make this much more efficient @@ -213,7 +216,7 @@ return YES; } - +//Create and destroy the local tokens to represent the firing of some transition void fire_transition_local(int t, pns* supervisor,int how_many_plants) { printf("Firing %d\n",t); @@ -263,6 +266,7 @@ #endif*/ } +//checks to see if transition t can be fired, and if so, fires it void process_transition_at(int t, pns* supervisor, int how_many_plants) { printf("Entering transition %d\n",t); @@ -271,6 +275,8 @@ fire_transition_local(t,supervisor, how_many_plants); } } + +//placeholder to run diagnostics or other place-centered code void process_token_at(int node, pns* supervisor) { #ifdef NOISY_DEBUG @@ -278,6 +284,8 @@ #endif } + +//this does a local simulation pass (fires all transitions that have no external dependencies) void simulation_pass_local(pns* supervisor, int how_many_plants, int* blocked_transitions) { int i = 0; @@ -290,7 +298,7 @@ } for(i = 0; i < supervisor->tnum; i++) { - if (blocked_transitions[i] == NO) + if (blocked_transitions[i] == NO) //only fire transitions that have no remote dependencies { process_transition_at(i,supervisor, how_many_plants); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2009-08-23 07:45:20
|
Revision: 237 http://pntool.svn.sourceforge.net/pntool/?rev=237&view=rev Author: compaqdrew Date: 2009-08-23 07:45:14 +0000 (Sun, 23 Aug 2009) Log Message: ----------- better documentation Modified Paths: -------------- codegen/src/codegen.xcodeproj/drew.pbxuser codegen/src/supervisorCompiler.c codegen/src/supervisor_static_include.h Modified: codegen/src/codegen.xcodeproj/drew.pbxuser =================================================================== --- codegen/src/codegen.xcodeproj/drew.pbxuser 2009-08-23 07:44:51 UTC (rev 236) +++ codegen/src/codegen.xcodeproj/drew.pbxuser 2009-08-23 07:45:14 UTC (rev 237) @@ -17,15 +17,15 @@ 3A3A77E70FC891BD00DB2D28 /* petriNetSerializer.c:33 */, 3A3A783D0FC894C600DB2D28 /* supervisorCompler.c:116 */, 3A13FC180FDA5F3C0051F833 /* supervisorCompler.c:176 */, - 3A13FC1E0FDA5F810051F833 /* supervisor_static_include.h:310 */, - 3A13FC220FDA5F970051F833 /* supervisor_static_include.h:303 */, + 3A13FC1E0FDA5F810051F833 /* supervisor_static_include.h:314 */, + 3A13FC220FDA5F970051F833 /* supervisor_static_include.h:307 */, 3A13FC250FDA5FBA0051F833 /* supervisorCompler.c:174 */, - 3A13FC660FDA62D90051F833 /* supervisor_static_include.h:326 */, - 3A13FC680FDA62DA0051F833 /* supervisor_static_include.h:301 */, - 3A13FC750FDA64190051F833 /* supervisor_static_include.h:339 */, - 3A13FC780FDA64220051F833 /* supervisor_static_include.h:332 */, - 3A13FC800FDA64DC0051F833 /* supervisor_static_include.h:341 */, - 3A13FC830FDA66170051F833 /* supervisor_static_include.h:334 */, + 3A13FC660FDA62D90051F833 /* supervisor_static_include.h:330 */, + 3A13FC680FDA62DA0051F833 /* supervisor_static_include.h:305 */, + 3A13FC750FDA64190051F833 /* supervisor_static_include.h:343 */, + 3A13FC780FDA64220051F833 /* supervisor_static_include.h:336 */, + 3A13FC800FDA64DC0051F833 /* supervisor_static_include.h:345 */, + 3A13FC830FDA66170051F833 /* supervisor_static_include.h:338 */, ); codeSenseManager = 3A232C630FB214E900A5C7C2 /* Code sense */; executables = ( @@ -194,7 +194,7 @@ modificationTime = 267922699.957455; state = 2; }; - 3A13FC1E0FDA5F810051F833 /* supervisor_static_include.h:310 */ = { + 3A13FC1E0FDA5F810051F833 /* supervisor_static_include.h:314 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -206,12 +206,12 @@ functionName = "do_new_contract(char* buffer, int plant, reservation_structure *r)"; hitCount = 0; ignoreCount = 0; - lineNumber = 310; + lineNumber = 314; location = codegen; modificationTime = 267922699.957462; state = 2; }; - 3A13FC220FDA5F970051F833 /* supervisor_static_include.h:303 */ = { + 3A13FC220FDA5F970051F833 /* supervisor_static_include.h:307 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -222,7 +222,7 @@ fileReference = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; hitCount = 0; ignoreCount = 0; - lineNumber = 303; + lineNumber = 307; location = codegen; modificationTime = 267922699.957612; state = 2; @@ -243,7 +243,7 @@ modificationTime = 267922699.957716; state = 2; }; - 3A13FC660FDA62D90051F833 /* supervisor_static_include.h:326 */ = { + 3A13FC660FDA62D90051F833 /* supervisor_static_include.h:330 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -255,12 +255,12 @@ functionName = "do_new_contract(char* buffer, int plant, reservation_structure *r)"; hitCount = 0; ignoreCount = 0; - lineNumber = 326; + lineNumber = 330; location = codegen; modificationTime = 267922699.957726; state = 2; }; - 3A13FC680FDA62DA0051F833 /* supervisor_static_include.h:301 */ = { + 3A13FC680FDA62DA0051F833 /* supervisor_static_include.h:305 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -271,12 +271,12 @@ fileReference = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; hitCount = 0; ignoreCount = 0; - lineNumber = 301; + lineNumber = 305; location = codegen; modificationTime = 267922699.957816; state = 2; }; - 3A13FC750FDA64190051F833 /* supervisor_static_include.h:339 */ = { + 3A13FC750FDA64190051F833 /* supervisor_static_include.h:343 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -288,12 +288,12 @@ functionName = "do_new_contract(char* buffer, int plant, reservation_structure *r)"; hitCount = 0; ignoreCount = 0; - lineNumber = 339; + lineNumber = 343; location = codegen; modificationTime = 267922699.957918; state = 2; }; - 3A13FC780FDA64220051F833 /* supervisor_static_include.h:332 */ = { + 3A13FC780FDA64220051F833 /* supervisor_static_include.h:336 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -305,12 +305,12 @@ functionName = "do_new_contract(char* buffer, int plant, reservation_structure *r)"; hitCount = 0; ignoreCount = 0; - lineNumber = 332; + lineNumber = 336; location = codegen; modificationTime = 267922699.958003; state = 2; }; - 3A13FC800FDA64DC0051F833 /* supervisor_static_include.h:341 */ = { + 3A13FC800FDA64DC0051F833 /* supervisor_static_include.h:345 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -322,12 +322,12 @@ functionName = "do_new_contract(char* buffer, int plant, reservation_structure *r)"; hitCount = 0; ignoreCount = 0; - lineNumber = 341; + lineNumber = 345; location = codegen; modificationTime = 267922699.958088; state = 2; }; - 3A13FC830FDA66170051F833 /* supervisor_static_include.h:334 */ = { + 3A13FC830FDA66170051F833 /* supervisor_static_include.h:338 */ = { isa = PBXFileBreakpoint; actions = ( ); @@ -339,7 +339,7 @@ functionName = "do_new_contract(char* buffer, int plant, reservation_structure *r)"; hitCount = 0; ignoreCount = 0; - lineNumber = 334; + lineNumber = 338; modificationTime = 267922700.446616; state = 0; }; @@ -847,7 +847,7 @@ fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; name = "supervisor_static_include.h: 15"; rLen = 0; - rLoc = 14715; + rLoc = 15456; rType = 0; vrLen = 292; vrLoc = 0; @@ -894,7 +894,7 @@ fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; name = "supervisor_static_include.h: 471"; rLen = 0; - rLoc = 11646; + rLoc = 12387; rType = 0; vrLen = 1036; vrLoc = 6557; @@ -934,7 +934,7 @@ fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; name = "supervisor_static_include.h: 231"; rLen = 0; - rLoc = 5521; + rLoc = 6240; rType = 0; vrLen = 751; vrLoc = 5032; @@ -944,7 +944,7 @@ fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; name = "supervisor_static_include.h: 471"; rLen = 0; - rLoc = 11646; + rLoc = 12387; rType = 0; vrLen = 1036; vrLoc = 6559; @@ -1058,7 +1058,7 @@ fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; name = "supervisor_static_include.h: 471"; rLen = 0; - rLoc = 11646; + rLoc = 12387; rType = 0; vrLen = 1249; vrLoc = 6344; @@ -1266,7 +1266,7 @@ fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; name = "supervisor_static_include.h: 471"; rLen = 0; - rLoc = 11646; + rLoc = 12387; rType = 0; vrLen = 1036; vrLoc = 6557; Modified: codegen/src/supervisorCompiler.c =================================================================== --- codegen/src/supervisorCompiler.c 2009-08-23 07:44:51 UTC (rev 236) +++ codegen/src/supervisorCompiler.c 2009-08-23 07:45:14 UTC (rev 237) @@ -44,16 +44,16 @@ { blockedTransitions[i]=NO; } - for(plant = 0; plant < how_many_plants; plant++) + for(plant = 0; plant < how_many_plants; plant++) //for each plant { pns * petri = prarray[plant]->pn; - for(t = 0; t < petri->tnum; t++) + for(t = 0; t < petri->tnum; t++) //for each plant transition { - for(it = 0; it < supervisorPetrinet->tnum; it++) + for(it = 0; it < supervisorPetrinet->tnum; it++) //for each of our transitions { - if (petri->t[t].l == supervisorPetrinet->t[it].l) + if (petri->t[t].l == supervisorPetrinet->t[it].l) //if our transition has the same label as some plant transition { - blockedTransitions[it]=YES; + blockedTransitions[it]=YES; //block our transition (flag as non-local) } } } Modified: codegen/src/supervisor_static_include.h =================================================================== --- codegen/src/supervisor_static_include.h 2009-08-23 07:44:51 UTC (rev 236) +++ codegen/src/supervisor_static_include.h 2009-08-23 07:45:14 UTC (rev 237) @@ -94,6 +94,7 @@ ///////////////////////////////////////// */ +//informs a plant that it should fire a transition (that it has permission) void send_fire_msg(unique_identify_fire_something *u,int rid,int pipe) { char firemsg[BUFFER_SIZE]; sprintf(firemsg,"___Y%d:%d-%d\n",rid,u->label,u->t); @@ -101,6 +102,7 @@ write(pipe,firemsg,strlen(firemsg)); } +//attempts to fire type unique_identity_fire_something. If it was able to fire, it returns YES, if it was unable to fire, it returns NO char attempt_fire_something(pns* supervisor, int how_many_plants, unique_identify_fire_something *u, int id, int pipe) { int ourt = get_local_transition_by_label(supervisor, u->label); @@ -124,6 +126,8 @@ return NO; } } +//loop through each reservation and attempt to find a firemsg that can be sent. +//If the reservation can be resolved, sends the firemsg and updates the datastructures appropriately void attempt_close_reservation(pns* supervisor, int how_many_plants, reservation *r, int pipe) { int i; @@ -132,8 +136,8 @@ if (attempt_fire_something(supervisor, how_many_plants, &r->u[i], r->id,pipe)) { - r->selected_fire_something = i; - r->sent = 1; + r->selected_fire_something = i; //indicates which element of the reservation we've elected to fire + r->sent = 1; //indicates that we've sent a firemsg and no further communication to the plant is necessary return; } } @@ -141,14 +145,14 @@ void close_reservation_pass(pns* supervisor, int how_many_plants, reservation_structure *r, int pipe) { int p, i; - for(p = 0; p < how_many_plants; p++) + for(p = 0; p < how_many_plants; p++) //for each plant { - for(i = 0; i < HOW_MANY_RESERVATIONS; i++) + for(i = 0; i < HOW_MANY_RESERVATIONS; i++) //for each reservation { reservation *res = get_reservation_by_id(r, p, i); if (res!=NULL) //open reservation { - if (!res->sent) + if (!res->sent) //only attempt to close reservations that have not been sent a firemsg. Duplicate firemsgs cause unexpected plant behavior. { attempt_close_reservation(supervisor, how_many_plants, res, pipe); } @@ -373,7 +377,7 @@ break; } default: - printf("WTF? I've got nothing for you %d\n",buffer[3]); + printf("The supervisor received an unknown control character %d\n",buffer[3]); exit(1); break; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <com...@us...> - 2009-08-23 07:45:05
|
Revision: 236 http://pntool.svn.sourceforge.net/pntool/?rev=236&view=rev Author: compaqdrew Date: 2009-08-23 07:44:51 +0000 (Sun, 23 Aug 2009) Log Message: ----------- Fixing weight >=1 Modified Paths: -------------- ANTLR3_LICENSE.txt LICENSE.txt Makefile README.txt codegen/.gitignore codegen/README.txt codegen/demo.sh codegen/src/MakeGen.c codegen/src/MakeGen.h codegen/src/codegen.xcodeproj/drew.mode1v3 codegen/src/codegen.xcodeproj/drew.pbxuser codegen/src/supervisor_static_include.h pnheaders/Makefile pnheaders/README.txt pnheaders/main_function.c spnbox/Makefile spnbox/MemoryManager.c spnbox/MemoryManager.h spnbox/actn.c spnbox/chkcons.c spnbox/deallocation.c spnbox/ilpadm.c spnbox/ipslv.c spnbox/ipsolve.c spnbox/isadm.c spnbox/issiph.c spnbox/linenf.c spnbox/matrixmath.c spnbox/matrixmath.h spnbox/msplit.c spnbox/nltrans.c spnbox/pn2acpn.c spnbox/pn2eacpn.c spnbox/reduce.c spnbox/spnbox.h spnbox/supervis.c spnbox/tactn.c spnbox/tests/Makefile spnbox/tests/StructuredIO.c spnbox/tests/StructuredIO.h spnbox/tests/pnexample.c spnbox/tests/test-actn.c spnbox/tests/test-actn.txt spnbox/tests/test-ilpadm.c spnbox/tests/test-ilpadm.txt spnbox/tests/test-ipslv.c spnbox/tests/test-ipsolve.c spnbox/tests/test-ipsolve.txt spnbox/tests/test-isadm.c spnbox/tests/test-isadm.txt spnbox/tests/test-issiph.c spnbox/tests/test-issiph.txt spnbox/tests/test-linenf.c spnbox/tests/test-linenf.txt spnbox/tests/test-msplit.c spnbox/tests/test-msplit.txt spnbox/tests/test-nltrans.c spnbox/tests/test-nltrans.txt spnbox/tests/test-pn2acpn.c spnbox/tests/test-pn2acpn.txt spnbox/tests/test-pn2eacpn.c spnbox/tests/test-pn2eacpn.txt spnbox/tests/test-reduce.c spnbox/tests/test-reduce.txt spnbox/tests/test-supervis.c spnbox/tests/test-supervis.txt spnbox/tests/test-tactn.c spnbox/tests/test-tactn.txt spnbox/tests/test.c spnbox/tests/test.h third-party/ANTLR3_ctarget_3_1_3/AUTHORS third-party/ANTLR3_ctarget_3_1_3/C.sln third-party/ANTLR3_ctarget_3_1_3/C.vcproj third-party/ANTLR3_ctarget_3_1_3/C.vcproj.vspscc third-party/ANTLR3_ctarget_3_1_3/C.vssscc third-party/ANTLR3_ctarget_3_1_3/COPYING third-party/ANTLR3_ctarget_3_1_3/ChangeLog third-party/ANTLR3_ctarget_3_1_3/INSTALL third-party/ANTLR3_ctarget_3_1_3/Makefile.am third-party/ANTLR3_ctarget_3_1_3/Makefile.in third-party/ANTLR3_ctarget_3_1_3/NEWS third-party/ANTLR3_ctarget_3_1_3/README third-party/ANTLR3_ctarget_3_1_3/aclocal.m4 third-party/ANTLR3_ctarget_3_1_3/antlr3config.h.in third-party/ANTLR3_ctarget_3_1_3/configure.ac third-party/ANTLR3_ctarget_3_1_3/include/antlr3.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3baserecognizer.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3basetree.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3basetreeadaptor.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3bitset.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3collections.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3commontoken.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3commontree.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3commontreeadaptor.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3commontreenodestream.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3convertutf.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3cyclicdfa.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3debugeventlistener.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3defs.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3encodings.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3errors.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3exception.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3filestream.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3input.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3interfaces.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3intstream.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3lexer.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3memory.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3parser.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3parsetree.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3recognizersharedstate.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3rewritestreams.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3string.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3stringstream.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3tokenstream.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3treeparser.h third-party/ANTLR3_ctarget_3_1_3/ltmain.sh third-party/ANTLR3_ctarget_3_1_3/src/antlr3baserecognizer.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3basetree.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3basetreeadaptor.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3bitset.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3collections.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3commontoken.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3commontree.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3commontreeadaptor.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3commontreenodestream.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3convertutf.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3cyclicdfa.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3debughandlers.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3encodings.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3exception.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3filestream.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3inputstream.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3intstream.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3lexer.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3parser.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3rewritestreams.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3string.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3stringstream.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3tokenstream.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3treeparser.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3ucs2inputstream.c third-party/ANTLR3_ctarget_3_1_3/vsrulefiles/antlr3lexer.rules third-party/ANTLR3_ctarget_3_1_3/vsrulefiles/antlr3lexerandparser.rules third-party/ANTLR3_ctarget_3_1_3/vsrulefiles/antlr3parser.rules third-party/ANTLR3_ctarget_3_1_3/vsrulefiles/antlr3treeparser.rules third-party/lp_solve_5.5/Makefile third-party/lp_solve_5.5/Makefile.Linux third-party/lp_solve_5.5/Makefile.in third-party/lp_solve_5.5/Makefile.msc third-party/lp_solve_5.5/README.txt third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/LUSOL-overview.txt third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/LUSOL_LGPL.txt third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/LUSOL_Overview.txt third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/LUSOL_README.txt third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/Row-based L0.txt third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/Victoria1850.RUA third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/bfile3.txt third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/hbio.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/hbio.h third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol.h third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol1.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol2.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol6a.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol6l0.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol6u.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol7a.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol8a.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusolio.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusolio.h third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusolmain.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusolmain.h third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/mmio.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/mmio.h third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/myblas.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/myblas.h third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/sherman5.mtx third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/sherman5_rhs1.mtx third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/sparselib.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/sparselib.h third-party/lp_solve_5.5/bfp/bfp_LUSOL/bfp_LUSOL.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/bfp_LUSOL.h third-party/lp_solve_5.5/bfp/bfp_LUSOL/lp_LUSOL.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/lp_LUSOL.h third-party/lp_solve_5.5/bfp/lp_BFP.h third-party/lp_solve_5.5/bfp/lp_BFP1.c third-party/lp_solve_5.5/bfp/lp_BFP2.c third-party/lp_solve_5.5/colamd/colamd.c third-party/lp_solve_5.5/colamd/colamd.h third-party/lp_solve_5.5/configure third-party/lp_solve_5.5/configure.ac third-party/lp_solve_5.5/declare.h third-party/lp_solve_5.5/demo/cbcc32.bat third-party/lp_solve_5.5/demo/ccc third-party/lp_solve_5.5/demo/ccc.osx third-party/lp_solve_5.5/demo/cgcc.bat third-party/lp_solve_5.5/demo/cvc6.bat third-party/lp_solve_5.5/demo/cvc8.bat third-party/lp_solve_5.5/demo/demo.c third-party/lp_solve_5.5/demo/demo.sln third-party/lp_solve_5.5/demo/demo.vcproj third-party/lp_solve_5.5/demo/demolib.sln third-party/lp_solve_5.5/demo/demolib.vcproj third-party/lp_solve_5.5/demo/readme.txt third-party/lp_solve_5.5/doc/AMPL.htm third-party/lp_solve_5.5/doc/BFP.htm third-party/lp_solve_5.5/doc/Build.htm third-party/lp_solve_5.5/doc/CPLEX-format.htm third-party/lp_solve_5.5/doc/DIMACS_asn.htm third-party/lp_solve_5.5/doc/DIMACS_maxf.htm third-party/lp_solve_5.5/doc/DIMACS_mcf.htm third-party/lp_solve_5.5/doc/FAQ.htm third-party/lp_solve_5.5/doc/IDE/IDE1.gif third-party/lp_solve_5.5/doc/IDE/IDE2.gif third-party/lp_solve_5.5/doc/IDE/IDE3.gif third-party/lp_solve_5.5/doc/IDE/IDE4.gif third-party/lp_solve_5.5/doc/IDE.htm third-party/lp_solve_5.5/doc/Infeasible.htm third-party/lp_solve_5.5/doc/Intro.htm third-party/lp_solve_5.5/doc/Java/README.html third-party/lp_solve_5.5/doc/Java/docs/api/allclasses-frame.html third-party/lp_solve_5.5/doc/Java/docs/api/allclasses-noframe.html third-party/lp_solve_5.5/doc/Java/docs/api/constant-values.html third-party/lp_solve_5.5/doc/Java/docs/api/deprecated-list.html third-party/lp_solve_5.5/doc/Java/docs/api/help-doc.html third-party/lp_solve_5.5/doc/Java/docs/api/index-all.html third-party/lp_solve_5.5/doc/Java/docs/api/index.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/AbortListener.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/BbListener.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/LogListener.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/LpSolve.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/LpSolveException.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/MsgListener.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/VersionInfo.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/package-frame.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/package-summary.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/package-tree.html third-party/lp_solve_5.5/doc/Java/docs/api/overview-tree.html third-party/lp_solve_5.5/doc/Java/docs/api/package-list third-party/lp_solve_5.5/doc/Java/docs/api/packages.html third-party/lp_solve_5.5/doc/Java/docs/api/resources/inherit.gif third-party/lp_solve_5.5/doc/Java/docs/api/serialized-form.html third-party/lp_solve_5.5/doc/Java/docs/api/stylesheet.css third-party/lp_solve_5.5/doc/Java/docs/reference.html third-party/lp_solve_5.5/doc/Java.htm third-party/lp_solve_5.5/doc/LGPL.htm third-party/lp_solve_5.5/doc/LINDO-format.htm third-party/lp_solve_5.5/doc/LPBasics.htm third-party/lp_solve_5.5/doc/MATLAB.htm third-party/lp_solve_5.5/doc/MATLAB1.jpg third-party/lp_solve_5.5/doc/MATLAB2.jpg third-party/lp_solve_5.5/doc/MATLAB3.jpg third-party/lp_solve_5.5/doc/MathProg.htm third-party/lp_solve_5.5/doc/O-Matrix.htm third-party/lp_solve_5.5/doc/O-Matrix1.jpg third-party/lp_solve_5.5/doc/O-Matrix2.jpg third-party/lp_solve_5.5/doc/O-Matrix3.jpg third-party/lp_solve_5.5/doc/Octave.htm third-party/lp_solve_5.5/doc/Octave1.jpg third-party/lp_solve_5.5/doc/Octave2.jpg third-party/lp_solve_5.5/doc/Octave3.jpg third-party/lp_solve_5.5/doc/PHP.htm third-party/lp_solve_5.5/doc/Presolve.htm third-party/lp_solve_5.5/doc/Python.htm third-party/lp_solve_5.5/doc/R.htm third-party/lp_solve_5.5/doc/SOS.htm third-party/lp_solve_5.5/doc/Scilab.htm third-party/lp_solve_5.5/doc/Scilab1.jpg third-party/lp_solve_5.5/doc/Scilab2.jpg third-party/lp_solve_5.5/doc/Scilab3.jpg third-party/lp_solve_5.5/doc/Semi-ContinuousVariables_files/bsscdhtm.js third-party/lp_solve_5.5/doc/Semi-ContinuousVariables_files/img00340.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeOne_files/bsscdhtm.js third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeOne_files/img00341.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeOne_files/img00342.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeOne_files/img00343.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeOne_files/img00344.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeOne_files/img00345.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeOne_files/img00346.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeOne_files/img00347.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/bsscdhtm.js third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00348.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00349.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00350.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00351.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00352.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00353.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00354.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00355.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00356.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00357.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00358.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00359.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00360.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00361.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00362.gif third-party/lp_solve_5.5/doc/XLI.htm third-party/lp_solve_5.5/doc/Xpress-format.htm third-party/lp_solve_5.5/doc/Zimpl.htm third-party/lp_solve_5.5/doc/absolute.htm third-party/lp_solve_5.5/doc/add_SOS.htm third-party/lp_solve_5.5/doc/add_column.htm third-party/lp_solve_5.5/doc/add_constraint.htm third-party/lp_solve_5.5/doc/add_lag_con.htm third-party/lp_solve_5.5/doc/bas-format.htm third-party/lp_solve_5.5/doc/changes5.htm third-party/lp_solve_5.5/doc/changes55.htm third-party/lp_solve_5.5/doc/closed.gif third-party/lp_solve_5.5/doc/column_in_lp.htm third-party/lp_solve_5.5/doc/contents.htm third-party/lp_solve_5.5/doc/copy_lp.htm third-party/lp_solve_5.5/doc/default_basis.htm third-party/lp_solve_5.5/doc/del_column.htm third-party/lp_solve_5.5/doc/del_constraint.htm third-party/lp_solve_5.5/doc/delete_lp.htm third-party/lp_solve_5.5/doc/dimacs_asn.gif third-party/lp_solve_5.5/doc/dimacs_maxf.gif third-party/lp_solve_5.5/doc/dimacs_mcf.gif third-party/lp_solve_5.5/doc/distribution.htm third-party/lp_solve_5.5/doc/download.htm third-party/lp_solve_5.5/doc/dualize_lp.htm third-party/lp_solve_5.5/doc/fold.gif third-party/lp_solve_5.5/doc/formulate.htm third-party/lp_solve_5.5/doc/free.htm third-party/lp_solve_5.5/doc/free_lp.htm third-party/lp_solve_5.5/doc/get_Lrows.htm third-party/lp_solve_5.5/doc/get_Ncolumns.htm third-party/lp_solve_5.5/doc/get_Norig_columns.htm third-party/lp_solve_5.5/doc/get_Norig_rows.htm third-party/lp_solve_5.5/doc/get_Nrows.htm third-party/lp_solve_5.5/doc/get_anti_degen.htm third-party/lp_solve_5.5/doc/get_basis.htm third-party/lp_solve_5.5/doc/get_basiscrash.htm third-party/lp_solve_5.5/doc/get_bb_depthlimit.htm third-party/lp_solve_5.5/doc/get_bb_floorfirst.htm third-party/lp_solve_5.5/doc/get_bb_rule.htm third-party/lp_solve_5.5/doc/get_bounds_tighter.htm third-party/lp_solve_5.5/doc/get_break_at_value.htm third-party/lp_solve_5.5/doc/get_col_name.htm third-party/lp_solve_5.5/doc/get_column.htm third-party/lp_solve_5.5/doc/get_constr_type.htm third-party/lp_solve_5.5/doc/get_constr_value.htm third-party/lp_solve_5.5/doc/get_constraints.htm third-party/lp_solve_5.5/doc/get_epsb.htm third-party/lp_solve_5.5/doc/get_epsd.htm third-party/lp_solve_5.5/doc/get_epsel.htm third-party/lp_solve_5.5/doc/get_epsint.htm third-party/lp_solve_5.5/doc/get_epsperturb.htm third-party/lp_solve_5.5/doc/get_epspivot.htm third-party/lp_solve_5.5/doc/get_improve.htm third-party/lp_solve_5.5/doc/get_infinite.htm third-party/lp_solve_5.5/doc/get_lambda.htm third-party/lp_solve_5.5/doc/get_lowbo.htm third-party/lp_solve_5.5/doc/get_lp_index.htm third-party/lp_solve_5.5/doc/get_lp_name.htm third-party/lp_solve_5.5/doc/get_mat.htm third-party/lp_solve_5.5/doc/get_max_level.htm third-party/lp_solve_5.5/doc/get_maxpivot.htm third-party/lp_solve_5.5/doc/get_mip_gap.htm third-party/lp_solve_5.5/doc/get_nameindex.htm third-party/lp_solve_5.5/doc/get_negrange.htm third-party/lp_solve_5.5/doc/get_nonzeros.htm third-party/lp_solve_5.5/doc/get_obj_bound.htm third-party/lp_solve_5.5/doc/get_objective.htm third-party/lp_solve_5.5/doc/get_orig_index.htm third-party/lp_solve_5.5/doc/get_pivoting.htm third-party/lp_solve_5.5/doc/get_presolve.htm third-party/lp_solve_5.5/doc/get_presolveloops.htm third-party/lp_solve_5.5/doc/get_primal_solution.htm third-party/lp_solve_5.5/doc/get_print_sol.htm third-party/lp_solve_5.5/doc/get_rh.htm third-party/lp_solve_5.5/doc/get_rh_range.htm third-party/lp_solve_5.5/doc/get_row.htm third-party/lp_solve_5.5/doc/get_row_name.htm third-party/lp_solve_5.5/doc/get_scalelimit.htm third-party/lp_solve_5.5/doc/get_scaling.htm third-party/lp_solve_5.5/doc/get_sensitivity_obj.htm third-party/lp_solve_5.5/doc/get_sensitivity_rhs.htm third-party/lp_solve_5.5/doc/get_simplextype.htm third-party/lp_solve_5.5/doc/get_solutioncount.htm third-party/lp_solve_5.5/doc/get_solutionlimit.htm third-party/lp_solve_5.5/doc/get_status.htm third-party/lp_solve_5.5/doc/get_statustext.htm third-party/lp_solve_5.5/doc/get_timeout.htm third-party/lp_solve_5.5/doc/get_total_iter.htm third-party/lp_solve_5.5/doc/get_total_nodes.htm third-party/lp_solve_5.5/doc/get_upbo.htm third-party/lp_solve_5.5/doc/get_var_branch.htm third-party/lp_solve_5.5/doc/get_var_priority.htm third-party/lp_solve_5.5/doc/get_variables.htm third-party/lp_solve_5.5/doc/get_verbose.htm third-party/lp_solve_5.5/doc/get_working_objective.htm third-party/lp_solve_5.5/doc/guess_basis.htm third-party/lp_solve_5.5/doc/has_BFP.htm third-party/lp_solve_5.5/doc/has_XLI.htm third-party/lp_solve_5.5/doc/index.htm third-party/lp_solve_5.5/doc/index.html third-party/lp_solve_5.5/doc/integer.htm third-party/lp_solve_5.5/doc/is_SOS_var.htm third-party/lp_solve_5.5/doc/is_add_rowmode.htm third-party/lp_solve_5.5/doc/is_anti_degen.htm third-party/lp_solve_5.5/doc/is_binary.htm third-party/lp_solve_5.5/doc/is_break_at_first.htm third-party/lp_solve_5.5/doc/is_constr_type.htm third-party/lp_solve_5.5/doc/is_debug.htm third-party/lp_solve_5.5/doc/is_feasible.htm third-party/lp_solve_5.5/doc/is_infinite.htm third-party/lp_solve_5.5/doc/is_int.htm third-party/lp_solve_5.5/doc/is_integerscaling.htm third-party/lp_solve_5.5/doc/is_lag_trace.htm third-party/lp_solve_5.5/doc/is_maxim.htm third-party/lp_solve_5.5/doc/is_nativeBFP.htm third-party/lp_solve_5.5/doc/is_nativeXLI.htm third-party/lp_solve_5.5/doc/is_negative.htm third-party/lp_solve_5.5/doc/is_obj_in_basis.htm third-party/lp_solve_5.5/doc/is_piv_mode.htm third-party/lp_solve_5.5/doc/is_piv_rule.htm third-party/lp_solve_5.5/doc/is_presolve.htm third-party/lp_solve_5.5/doc/is_scalemode.htm third-party/lp_solve_5.5/doc/is_scaletype.htm third-party/lp_solve_5.5/doc/is_semicont.htm third-party/lp_solve_5.5/doc/is_trace.htm third-party/lp_solve_5.5/doc/is_unbounded.htm third-party/lp_solve_5.5/doc/is_use_names.htm third-party/lp_solve_5.5/doc/lag_solve.htm third-party/lp_solve_5.5/doc/links.htm third-party/lp_solve_5.5/doc/list.gif third-party/lp_solve_5.5/doc/lp-format.htm third-party/lp_solve_5.5/doc/lp_solve.htm third-party/lp_solve_5.5/doc/lp_solveAPIreference.htm third-party/lp_solve_5.5/doc/lp_solve_5.5.0.12.chw third-party/lp_solve_5.5/doc/lp_solve_5.5.0.13.chw third-party/lp_solve_5.5/doc/lp_solve_5.5.0.14.chw third-party/lp_solve_5.5/doc/lp_solve_5.5.0.14_doc.tar third-party/lp_solve_5.5/doc/lp_solve_version.htm third-party/lp_solve_5.5/doc/make_lp.htm third-party/lp_solve_5.5/doc/mps-format.htm third-party/lp_solve_5.5/doc/open.gif third-party/lp_solve_5.5/doc/print_constraints.htm third-party/lp_solve_5.5/doc/print_debugdump.htm third-party/lp_solve_5.5/doc/print_duals.htm third-party/lp_solve_5.5/doc/print_lp.htm third-party/lp_solve_5.5/doc/print_objective.htm third-party/lp_solve_5.5/doc/print_scales.htm third-party/lp_solve_5.5/doc/print_solution.htm third-party/lp_solve_5.5/doc/print_str.htm third-party/lp_solve_5.5/doc/print_tableau.htm third-party/lp_solve_5.5/doc/put_abortfunc.htm third-party/lp_solve_5.5/doc/put_bb_branchfunc.htm third-party/lp_solve_5.5/doc/put_bb_nodefunc.htm third-party/lp_solve_5.5/doc/put_logfunc.htm third-party/lp_solve_5.5/doc/put_msgfunc.htm third-party/lp_solve_5.5/doc/quickstart.htm third-party/lp_solve_5.5/doc/ratio.htm third-party/lp_solve_5.5/doc/read_XLI.htm third-party/lp_solve_5.5/doc/read_basis.htm third-party/lp_solve_5.5/doc/read_lp.htm third-party/lp_solve_5.5/doc/read_mps.htm third-party/lp_solve_5.5/doc/read_params.htm third-party/lp_solve_5.5/doc/reset_basis.htm third-party/lp_solve_5.5/doc/reset_params.htm third-party/lp_solve_5.5/doc/resize_lp.htm third-party/lp_solve_5.5/doc/scaling.htm third-party/lp_solve_5.5/doc/search.htm third-party/lp_solve_5.5/doc/semi-cont.htm third-party/lp_solve_5.5/doc/sensitivity.htm third-party/lp_solve_5.5/doc/set_BFP.htm third-party/lp_solve_5.5/doc/set_XLI.htm third-party/lp_solve_5.5/doc/set_add_rowmode.htm third-party/lp_solve_5.5/doc/set_anti_degen.htm third-party/lp_solve_5.5/doc/set_basis.htm third-party/lp_solve_5.5/doc/set_basiscrash.htm third-party/lp_solve_5.5/doc/set_basisvar.htm third-party/lp_solve_5.5/doc/set_bb_depthlimit.htm third-party/lp_solve_5.5/doc/set_bb_floorfirst.htm third-party/lp_solve_5.5/doc/set_bb_rule.htm third-party/lp_solve_5.5/doc/set_binary.htm third-party/lp_solve_5.5/doc/set_bounds.htm third-party/lp_solve_5.5/doc/set_bounds_tighter.htm third-party/lp_solve_5.5/doc/set_break_at_first.htm third-party/lp_solve_5.5/doc/set_break_at_value.htm third-party/lp_solve_5.5/doc/set_col_name.htm third-party/lp_solve_5.5/doc/set_column.htm third-party/lp_solve_5.5/doc/set_constr_type.htm third-party/lp_solve_5.5/doc/set_debug.htm third-party/lp_solve_5.5/doc/set_epsb.htm third-party/lp_solve_5.5/doc/set_epsd.htm third-party/lp_solve_5.5/doc/set_epsel.htm third-party/lp_solve_5.5/doc/set_epsint.htm third-party/lp_solve_5.5/doc/set_epslevel.htm third-party/lp_solve_5.5/doc/set_epsperturb.htm third-party/lp_solve_5.5/doc/set_epspivot.htm third-party/lp_solve_5.5/doc/set_improve.htm third-party/lp_solve_5.5/doc/set_infinite.htm third-party/lp_solve_5.5/doc/set_int.htm third-party/lp_solve_5.5/doc/set_lag_trace.htm third-party/lp_solve_5.5/doc/set_lowbo.htm third-party/lp_solve_5.5/doc/set_lp_name.htm third-party/lp_solve_5.5/doc/set_mat.htm third-party/lp_solve_5.5/doc/set_maxim.htm third-party/lp_solve_5.5/doc/set_maxpivot.htm third-party/lp_solve_5.5/doc/set_minim.htm third-party/lp_solve_5.5/doc/set_mip_gap.htm third-party/lp_solve_5.5/doc/set_negrange.htm third-party/lp_solve_5.5/doc/set_obj_bound.htm third-party/lp_solve_5.5/doc/set_obj_fn.htm third-party/lp_solve_5.5/doc/set_obj_in_basis.htm third-party/lp_solve_5.5/doc/set_output.htm third-party/lp_solve_5.5/doc/set_pivoting.htm third-party/lp_solve_5.5/doc/set_preferdual.htm third-party/lp_solve_5.5/doc/set_presolve.htm third-party/lp_solve_5.5/doc/set_print_sol.htm third-party/lp_solve_5.5/doc/set_rh.htm third-party/lp_solve_5.5/doc/set_rh_range.htm third-party/lp_solve_5.5/doc/set_rh_vec.htm third-party/lp_solve_5.5/doc/set_row.htm third-party/lp_solve_5.5/doc/set_row_name.htm third-party/lp_solve_5.5/doc/set_scalelimit.htm third-party/lp_solve_5.5/doc/set_scaling.htm third-party/lp_solve_5.5/doc/set_semicont.htm third-party/lp_solve_5.5/doc/set_sense.htm third-party/lp_solve_5.5/doc/set_simplextype.htm third-party/lp_solve_5.5/doc/set_solutionlimit.htm third-party/lp_solve_5.5/doc/set_timeout.htm third-party/lp_solve_5.5/doc/set_trace.htm third-party/lp_solve_5.5/doc/set_unbounded.htm third-party/lp_solve_5.5/doc/set_upbo.htm third-party/lp_solve_5.5/doc/set_use_names.htm third-party/lp_solve_5.5/doc/set_var_branch.htm third-party/lp_solve_5.5/doc/set_var_weights.htm third-party/lp_solve_5.5/doc/set_verbose.htm third-party/lp_solve_5.5/doc/simpletree.css third-party/lp_solve_5.5/doc/simpletreemenu.js third-party/lp_solve_5.5/doc/solve.htm third-party/lp_solve_5.5/doc/time_elapsed.htm third-party/lp_solve_5.5/doc/unscale.htm third-party/lp_solve_5.5/doc/write_XLI.htm third-party/lp_solve_5.5/doc/write_basis.htm third-party/lp_solve_5.5/doc/write_lp.htm third-party/lp_solve_5.5/doc/write_mps.htm third-party/lp_solve_5.5/doc/write_params.htm third-party/lp_solve_5.5/fortify.c third-party/lp_solve_5.5/fortify.h third-party/lp_solve_5.5/ini.c third-party/lp_solve_5.5/ini.h third-party/lp_solve_5.5/lp_Hash.c third-party/lp_solve_5.5/lp_Hash.h third-party/lp_solve_5.5/lp_MDO.c third-party/lp_solve_5.5/lp_MDO.h third-party/lp_solve_5.5/lp_MPS.c third-party/lp_solve_5.5/lp_MPS.h third-party/lp_solve_5.5/lp_SOS.c third-party/lp_solve_5.5/lp_SOS.h third-party/lp_solve_5.5/lp_crash.c third-party/lp_solve_5.5/lp_crash.h third-party/lp_solve_5.5/lp_explicit.h third-party/lp_solve_5.5/lp_fortify.h third-party/lp_solve_5.5/lp_lib.c third-party/lp_solve_5.5/lp_lib.h third-party/lp_solve_5.5/lp_matrix.c third-party/lp_solve_5.5/lp_matrix.h third-party/lp_solve_5.5/lp_mipbb.c third-party/lp_solve_5.5/lp_mipbb.h third-party/lp_solve_5.5/lp_params.c third-party/lp_solve_5.5/lp_presolve.c third-party/lp_solve_5.5/lp_presolve.h third-party/lp_solve_5.5/lp_price.c third-party/lp_solve_5.5/lp_price.h third-party/lp_solve_5.5/lp_pricePSE.c third-party/lp_solve_5.5/lp_pricePSE.h third-party/lp_solve_5.5/lp_report.c third-party/lp_solve_5.5/lp_report.h third-party/lp_solve_5.5/lp_rlp.bat third-party/lp_solve_5.5/lp_rlp.c third-party/lp_solve_5.5/lp_rlp.h third-party/lp_solve_5.5/lp_rlp.l third-party/lp_solve_5.5/lp_rlp.y third-party/lp_solve_5.5/lp_scale.c third-party/lp_solve_5.5/lp_scale.h third-party/lp_solve_5.5/lp_simplex.c third-party/lp_solve_5.5/lp_simplex.h third-party/lp_solve_5.5/lp_solve/Makefile.msc third-party/lp_solve_5.5/lp_solve/cbcc32.bat third-party/lp_solve_5.5/lp_solve/ccc third-party/lp_solve_5.5/lp_solve/ccc.osx third-party/lp_solve_5.5/lp_solve/cgcc.bat third-party/lp_solve_5.5/lp_solve/cvc6.bat third-party/lp_solve_5.5/lp_solve/cvc6d.bat third-party/lp_solve_5.5/lp_solve/cvc8.bat third-party/lp_solve_5.5/lp_solve/lp_solve.c third-party/lp_solve_5.5/lp_solve/lp_solve.sln third-party/lp_solve_5.5/lp_solve/lp_solve.vcproj third-party/lp_solve_5.5/lp_solve/readme.txt third-party/lp_solve_5.5/lp_solve.def third-party/lp_solve_5.5/lp_solveDLL.c third-party/lp_solve_5.5/lp_solveDLL.h third-party/lp_solve_5.5/lp_types.h third-party/lp_solve_5.5/lp_utils.c third-party/lp_solve_5.5/lp_utils.h third-party/lp_solve_5.5/lp_wlp.c third-party/lp_solve_5.5/lp_wlp.h third-party/lp_solve_5.5/lpkit.h third-party/lp_solve_5.5/lpsolve.h third-party/lp_solve_5.5/lpsolve55/ccc third-party/lp_solve_5.5/lpsolve55/ccc.aix third-party/lp_solve_5.5/lpsolve55/ccc.hp-ux third-party/lp_solve_5.5/lpsolve55/ccc.osx third-party/lp_solve_5.5/lpsolve55/cccLUSOL.osx third-party/lp_solve_5.5/lpsolve55/cg++.bat third-party/lp_solve_5.5/lpsolve55/cgcc.bat third-party/lp_solve_5.5/lpsolve55/cvc6.bat third-party/lp_solve_5.5/lpsolve55/cvc8NOmsvcrt.bat third-party/lp_solve_5.5/lpsolve55/cvc8msvcrt.bat third-party/lp_solve_5.5/lpsolve55/dll.sln third-party/lp_solve_5.5/lpsolve55/dll.vcproj third-party/lp_solve_5.5/lpsolve55/lib.sln third-party/lp_solve_5.5/lpsolve55/lib.vcproj third-party/lp_solve_5.5/lpsolve55/lpsolve.rc third-party/lp_solve_5.5/lpsolve55/readme.txt third-party/lp_solve_5.5/lpsolve55/resource.h third-party/lp_solve_5.5/shared/commonlib.c third-party/lp_solve_5.5/shared/commonlib.h third-party/lp_solve_5.5/shared/mmio.c third-party/lp_solve_5.5/shared/mmio.h third-party/lp_solve_5.5/shared/myblas.c third-party/lp_solve_5.5/shared/myblas.h third-party/lp_solve_5.5/ufortify.h third-party/lp_solve_5.5/yacc_read.c third-party/lp_solve_5.5/yacc_read.h translator/Makefile translator/README.txt translator/clibs.patch translator/compactor.patch translator/dataStructures.c translator/dataStructures.h translator/docs/distributive.jpg translator/docs/notes.txt translator/generator.patch translator/input/complete.txt translator/main.c translator/parser.patch translator/pncompactor.c translator/pncompactor.g translator/pncompactor.h translator/pncompactor.tokens translator/pngenerator.c translator/pngenerator.g translator/pngenerator.h translator/pngenerator.tokens translator/pnscript.tokens translator/pnscriptLexer.c translator/pnscriptLexer.h translator/pnscriptParser.c translator/pnscriptParser.h translator/pnscript_java_compat.g translator/pnscript_java_compat.tokens translator/tree.php Property Changed: ---------------- ANTLR3_LICENSE.txt LICENSE.txt Makefile README.txt codegen/.gitignore codegen/README.txt codegen/demo.sh codegen/src/MakeGen.c codegen/src/MakeGen.h codegen/src/codegen.xcodeproj/drew.mode1v3 codegen/src/codegen.xcodeproj/drew.pbxuser pnheaders/Makefile pnheaders/README.txt pnheaders/main_function.c spnbox/Makefile spnbox/MemoryManager.c spnbox/MemoryManager.h spnbox/actn.c spnbox/chkcons.c spnbox/deallocation.c spnbox/ilpadm.c spnbox/ipslv.c spnbox/ipsolve.c spnbox/isadm.c spnbox/issiph.c spnbox/linenf.c spnbox/matrixmath.c spnbox/matrixmath.h spnbox/msplit.c spnbox/nltrans.c spnbox/pn2acpn.c spnbox/pn2eacpn.c spnbox/reduce.c spnbox/spnbox.h spnbox/supervis.c spnbox/tactn.c spnbox/tests/Makefile spnbox/tests/StructuredIO.c spnbox/tests/StructuredIO.h spnbox/tests/pnexample.c spnbox/tests/test-actn.c spnbox/tests/test-actn.txt spnbox/tests/test-ilpadm.c spnbox/tests/test-ilpadm.txt spnbox/tests/test-ipslv.c spnbox/tests/test-ipsolve.c spnbox/tests/test-ipsolve.txt spnbox/tests/test-isadm.c spnbox/tests/test-isadm.txt spnbox/tests/test-issiph.c spnbox/tests/test-issiph.txt spnbox/tests/test-linenf.c spnbox/tests/test-linenf.txt spnbox/tests/test-msplit.c spnbox/tests/test-msplit.txt spnbox/tests/test-nltrans.c spnbox/tests/test-nltrans.txt spnbox/tests/test-pn2acpn.c spnbox/tests/test-pn2acpn.txt spnbox/tests/test-pn2eacpn.c spnbox/tests/test-pn2eacpn.txt spnbox/tests/test-reduce.c spnbox/tests/test-reduce.txt spnbox/tests/test-supervis.c spnbox/tests/test-supervis.txt spnbox/tests/test-tactn.c spnbox/tests/test-tactn.txt spnbox/tests/test.c spnbox/tests/test.h third-party/ANTLR3_ctarget_3_1_3/AUTHORS third-party/ANTLR3_ctarget_3_1_3/C.sln third-party/ANTLR3_ctarget_3_1_3/C.vcproj third-party/ANTLR3_ctarget_3_1_3/C.vcproj.vspscc third-party/ANTLR3_ctarget_3_1_3/C.vssscc third-party/ANTLR3_ctarget_3_1_3/COPYING third-party/ANTLR3_ctarget_3_1_3/ChangeLog third-party/ANTLR3_ctarget_3_1_3/INSTALL third-party/ANTLR3_ctarget_3_1_3/Makefile.am third-party/ANTLR3_ctarget_3_1_3/Makefile.in third-party/ANTLR3_ctarget_3_1_3/NEWS third-party/ANTLR3_ctarget_3_1_3/README third-party/ANTLR3_ctarget_3_1_3/aclocal.m4 third-party/ANTLR3_ctarget_3_1_3/antlr3config.h.in third-party/ANTLR3_ctarget_3_1_3/configure.ac third-party/ANTLR3_ctarget_3_1_3/include/antlr3.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3baserecognizer.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3basetree.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3basetreeadaptor.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3bitset.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3collections.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3commontoken.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3commontree.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3commontreeadaptor.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3commontreenodestream.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3convertutf.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3cyclicdfa.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3debugeventlistener.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3defs.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3encodings.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3errors.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3exception.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3filestream.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3input.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3interfaces.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3intstream.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3lexer.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3memory.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3parser.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3parsetree.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3recognizersharedstate.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3rewritestreams.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3string.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3stringstream.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3tokenstream.h third-party/ANTLR3_ctarget_3_1_3/include/antlr3treeparser.h third-party/ANTLR3_ctarget_3_1_3/ltmain.sh third-party/ANTLR3_ctarget_3_1_3/src/antlr3baserecognizer.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3basetree.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3basetreeadaptor.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3bitset.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3collections.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3commontoken.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3commontree.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3commontreeadaptor.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3commontreenodestream.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3convertutf.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3cyclicdfa.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3debughandlers.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3encodings.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3exception.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3filestream.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3inputstream.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3intstream.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3lexer.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3parser.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3rewritestreams.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3string.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3stringstream.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3tokenstream.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3treeparser.c third-party/ANTLR3_ctarget_3_1_3/src/antlr3ucs2inputstream.c third-party/ANTLR3_ctarget_3_1_3/vsrulefiles/antlr3lexer.rules third-party/ANTLR3_ctarget_3_1_3/vsrulefiles/antlr3lexerandparser.rules third-party/ANTLR3_ctarget_3_1_3/vsrulefiles/antlr3parser.rules third-party/ANTLR3_ctarget_3_1_3/vsrulefiles/antlr3treeparser.rules third-party/lp_solve_5.5/Makefile third-party/lp_solve_5.5/Makefile.Linux third-party/lp_solve_5.5/Makefile.in third-party/lp_solve_5.5/Makefile.msc third-party/lp_solve_5.5/README.txt third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/LUSOL-overview.txt third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/LUSOL_LGPL.txt third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/LUSOL_Overview.txt third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/LUSOL_README.txt third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/Row-based L0.txt third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/Victoria1850.RUA third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/bfile3.txt third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/hbio.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/hbio.h third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol.h third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol1.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol2.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol6a.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol6l0.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol6u.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol7a.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusol8a.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusolio.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusolio.h third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusolmain.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/lusolmain.h third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/mmio.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/mmio.h third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/myblas.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/myblas.h third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/sherman5.mtx third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/sherman5_rhs1.mtx third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/sparselib.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/LUSOL/sparselib.h third-party/lp_solve_5.5/bfp/bfp_LUSOL/bfp_LUSOL.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/bfp_LUSOL.h third-party/lp_solve_5.5/bfp/bfp_LUSOL/lp_LUSOL.c third-party/lp_solve_5.5/bfp/bfp_LUSOL/lp_LUSOL.h third-party/lp_solve_5.5/bfp/lp_BFP.h third-party/lp_solve_5.5/bfp/lp_BFP1.c third-party/lp_solve_5.5/bfp/lp_BFP2.c third-party/lp_solve_5.5/colamd/colamd.c third-party/lp_solve_5.5/colamd/colamd.h third-party/lp_solve_5.5/configure third-party/lp_solve_5.5/configure.ac third-party/lp_solve_5.5/declare.h third-party/lp_solve_5.5/demo/cbcc32.bat third-party/lp_solve_5.5/demo/ccc third-party/lp_solve_5.5/demo/ccc.osx third-party/lp_solve_5.5/demo/cgcc.bat third-party/lp_solve_5.5/demo/cvc6.bat third-party/lp_solve_5.5/demo/cvc8.bat third-party/lp_solve_5.5/demo/demo.c third-party/lp_solve_5.5/demo/demo.sln third-party/lp_solve_5.5/demo/demo.vcproj third-party/lp_solve_5.5/demo/demolib.sln third-party/lp_solve_5.5/demo/demolib.vcproj third-party/lp_solve_5.5/demo/readme.txt third-party/lp_solve_5.5/doc/AMPL.htm third-party/lp_solve_5.5/doc/BFP.htm third-party/lp_solve_5.5/doc/Build.htm third-party/lp_solve_5.5/doc/CPLEX-format.htm third-party/lp_solve_5.5/doc/DIMACS_asn.htm third-party/lp_solve_5.5/doc/DIMACS_maxf.htm third-party/lp_solve_5.5/doc/DIMACS_mcf.htm third-party/lp_solve_5.5/doc/FAQ.htm third-party/lp_solve_5.5/doc/IDE/IDE1.gif third-party/lp_solve_5.5/doc/IDE/IDE2.gif third-party/lp_solve_5.5/doc/IDE/IDE3.gif third-party/lp_solve_5.5/doc/IDE/IDE4.gif third-party/lp_solve_5.5/doc/IDE.htm third-party/lp_solve_5.5/doc/Infeasible.htm third-party/lp_solve_5.5/doc/Intro.htm third-party/lp_solve_5.5/doc/Java/README.html third-party/lp_solve_5.5/doc/Java/docs/api/allclasses-frame.html third-party/lp_solve_5.5/doc/Java/docs/api/allclasses-noframe.html third-party/lp_solve_5.5/doc/Java/docs/api/constant-values.html third-party/lp_solve_5.5/doc/Java/docs/api/deprecated-list.html third-party/lp_solve_5.5/doc/Java/docs/api/help-doc.html third-party/lp_solve_5.5/doc/Java/docs/api/index-all.html third-party/lp_solve_5.5/doc/Java/docs/api/index.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/AbortListener.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/BbListener.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/LogListener.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/LpSolve.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/LpSolveException.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/MsgListener.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/VersionInfo.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/package-frame.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/package-summary.html third-party/lp_solve_5.5/doc/Java/docs/api/lpsolve/package-tree.html third-party/lp_solve_5.5/doc/Java/docs/api/overview-tree.html third-party/lp_solve_5.5/doc/Java/docs/api/package-list third-party/lp_solve_5.5/doc/Java/docs/api/packages.html third-party/lp_solve_5.5/doc/Java/docs/api/resources/inherit.gif third-party/lp_solve_5.5/doc/Java/docs/api/serialized-form.html third-party/lp_solve_5.5/doc/Java/docs/api/stylesheet.css third-party/lp_solve_5.5/doc/Java/docs/reference.html third-party/lp_solve_5.5/doc/Java.htm third-party/lp_solve_5.5/doc/LGPL.htm third-party/lp_solve_5.5/doc/LINDO-format.htm third-party/lp_solve_5.5/doc/LPBasics.htm third-party/lp_solve_5.5/doc/MATLAB.htm third-party/lp_solve_5.5/doc/MATLAB1.jpg third-party/lp_solve_5.5/doc/MATLAB2.jpg third-party/lp_solve_5.5/doc/MATLAB3.jpg third-party/lp_solve_5.5/doc/MathProg.htm third-party/lp_solve_5.5/doc/O-Matrix.htm third-party/lp_solve_5.5/doc/O-Matrix1.jpg third-party/lp_solve_5.5/doc/O-Matrix2.jpg third-party/lp_solve_5.5/doc/O-Matrix3.jpg third-party/lp_solve_5.5/doc/Octave.htm third-party/lp_solve_5.5/doc/Octave1.jpg third-party/lp_solve_5.5/doc/Octave2.jpg third-party/lp_solve_5.5/doc/Octave3.jpg third-party/lp_solve_5.5/doc/PHP.htm third-party/lp_solve_5.5/doc/Presolve.htm third-party/lp_solve_5.5/doc/Python.htm third-party/lp_solve_5.5/doc/R.htm third-party/lp_solve_5.5/doc/SOS.htm third-party/lp_solve_5.5/doc/Scilab.htm third-party/lp_solve_5.5/doc/Scilab1.jpg third-party/lp_solve_5.5/doc/Scilab2.jpg third-party/lp_solve_5.5/doc/Scilab3.jpg third-party/lp_solve_5.5/doc/Semi-ContinuousVariables_files/bsscdhtm.js third-party/lp_solve_5.5/doc/Semi-ContinuousVariables_files/img00340.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeOne_files/bsscdhtm.js third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeOne_files/img00341.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeOne_files/img00342.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeOne_files/img00343.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeOne_files/img00344.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeOne_files/img00345.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeOne_files/img00346.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeOne_files/img00347.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/bsscdhtm.js third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00348.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00349.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00350.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00351.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00352.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00353.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00354.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00355.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00356.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00357.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00358.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00359.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00360.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00361.gif third-party/lp_solve_5.5/doc/SpecialOrderedSetsOfTypeTwo_files/img00362.gif third-party/lp_solve_5.5/doc/XLI.htm third-party/lp_solve_5.5/doc/Xpress-format.htm third-party/lp_solve_5.5/doc/Zimpl.htm third-party/lp_solve_5.5/doc/absolute.htm third-party/lp_solve_5.5/doc/add_SOS.htm third-party/lp_solve_5.5/doc/add_column.htm third-party/lp_solve_5.5/doc/add_constraint.htm third-party/lp_solve_5.5/doc/add_lag_con.htm third-party/lp_solve_5.5/doc/bas-format.htm third-party/lp_solve_5.5/doc/changes5.htm third-party/lp_solve_5.5/doc/changes55.htm third-party/lp_solve_5.5/doc/closed.gif third-party/lp_solve_5.5/doc/column_in_lp.htm third-party/lp_solve_5.5/doc/contents.htm third-party/lp_solve_5.5/doc/copy_lp.htm third-party/lp_solve_5.5/doc/default_basis.htm third-party/lp_solve_5.5/doc/del_column.htm third-party/lp_solve_5.5/doc/del_constraint.htm third-party/lp_solve_5.5/doc/delete_lp.htm third-party/lp_solve_5.5/doc/dimacs_asn.gif third-party/lp_solve_5.5/doc/dimacs_maxf.gif third-party/lp_solve_5.5/doc/dimacs_mcf.gif third-party/lp_solve_5.5/doc/distribution.htm third-party/lp_solve_5.5/doc/download.htm third-party/lp_solve_5.5/doc/dualize_lp.htm third-party/lp_solve_5.5/doc/fold.gif third-party/lp_solve_5.5/doc/formulate.htm third-party/lp_solve_5.5/doc/free.htm third-party/lp_solve_5.5/doc/free_lp.htm third-party/lp_solve_5.5/doc/get_Lrows.htm third-party/lp_solve_5.5/doc/get_Ncolumns.htm third-party/lp_solve_5.5/doc/get_Norig_columns.htm third-party/lp_solve_5.5/doc/get_Norig_rows.htm third-party/lp_solve_5.5/doc/get_Nrows.htm third-party/lp_solve_5.5/doc/get_anti_degen.htm third-party/lp_solve_5.5/doc/get_basis.htm third-party/lp_solve_5.5/doc/get_basiscrash.htm third-party/lp_solve_5.5/doc/get_bb_depthlimit.htm third-party/lp_solve_5.5/doc/get_bb_floorfirst.htm third-party/lp_solve_5.5/doc/get_bb_rule.htm third-party/lp_solve_5.5/doc/get_bounds_tighter.htm third-party/lp_solve_5.5/doc/get_break_at_value.htm third-party/lp_solve_5.5/doc/get_col_name.htm third-party/lp_solve_5.5/doc/get_column.htm third-party/lp_solve_5.5/doc/get_constr_type.htm third-party/lp_solve_5.5/doc/get_constr_value.htm third-party/lp_solve_5.5/doc/get_constraints.htm third-party/lp_solve_5.5/doc/get_epsb.htm third-party/lp_solve_5.5/doc/get_epsd.htm third-party/lp_solve_5.5/doc/get_epsel.htm third-party/lp_solve_5.5/doc/get_epsint.htm third-party/lp_solve_5.5/doc/get_epsperturb.htm third-party/lp_solve_5.5/doc/get_epspivot.htm third-party/lp_solve_5.5/doc/get_improve.htm third-party/lp_solve_5.5/doc/get_infinite.htm third-party/lp_solve_5.5/doc/get_lambda.htm third-party/lp_solve_5.5/doc/get_lowbo.htm third-party/lp_solve_5.5/doc/get_lp_index.htm third-party/lp_solve_5.5/doc/get_lp_name.htm third-party/lp_solve_5.5/doc/get_mat.htm third-party/lp_solve_5.5/doc/get_max_level.htm third-party/lp_solve_5.5/doc/get_maxpivot.htm third-party/lp_solve_5.5/doc/get_mip_gap.htm third-party/lp_solve_5.5/doc/get_nameindex.htm third-party/lp_solve_5.5/doc/get_negrange.htm third-party/lp_solve_5.5/doc/get_nonzeros.htm third-party/lp_solve_5.5/doc/get_obj_bound.htm third-party/lp_solve_5.5/doc/get_objective.htm third-party/lp_solve_5.5/doc/get_orig_index.htm third-party/lp_solve_5.5/doc/get_pivoting.htm third-party/lp_solve_5.5/doc/get_presolve.htm third-party/lp_solve_5.5/doc/get_presolveloops.htm third-party/lp_solve_5.5/doc/get_primal_solution.htm third-party/lp_solve_5.5/doc/get_print_sol.htm third-party/lp_solve_5.5/doc/get_rh.htm third-party/lp_solve_5.5/doc/get_rh_range.htm third-party/lp_solve_5.5/doc/get_row.htm third-party/lp_solve_5.5/doc/get_row_name.htm third-party/lp_solve_5.5/doc/get_scalelimit.htm third-party/lp_solve_5.5/doc/get_scaling.htm third-party/lp_solve_5.5/doc/get_sensitivity_obj.htm third-party/lp_solve_5.5/doc/get_sensitivity_rhs.htm third-party/lp_solve_5.5/doc/get_simplextype.htm third-party/lp_solve_5.5/doc/get_solutioncount.htm third-party/lp_solve_5.5/doc/get_solutionlimit.htm third-party/lp_solve_5.5/doc/get_status.htm third-party/lp_solve_5.5/doc/get_statustext.htm third-party/lp_solve_5.5/doc/get_timeout.htm third-party/lp_solve_5.5/doc/get_total_iter.htm third-party/lp_solve_5.5/doc/get_total_nodes.htm third-party/lp_solve_5.5/doc/get_upbo.htm third-party/lp_solve_5.5/doc/get_var_branch.htm third-party/lp_solve_5.5/doc/get_var_priority.htm third-party/lp_solve_5.5/doc/get_variables.htm third-party/lp_solve_5.5/doc/get_verbose.htm third-party/lp_solve_5.5/doc/get_working_objective.htm third-party/lp_solve_5.5/doc/guess_basis.htm third-party/lp_solve_5.5/doc/has_BFP.htm third-party/lp_solve_5.5/doc/has_XLI.htm third-party/lp_solve_5.5/doc/index.htm third-party/lp_solve_5.5/doc/index.html third-party/lp_solve_5.5/doc/integer.htm third-party/lp_solve_5.5/doc/is_SOS_var.htm third-party/lp_solve_5.5/doc/is_add_rowmode.htm third-party/lp_solve_5.5/doc/is_anti_degen.htm third-party/lp_solve_5.5/doc/is_binary.htm third-party/lp_solve_5.5/doc/is_break_at_first.htm third-party/lp_solve_5.5/doc/is_constr_type.htm third-party/lp_solve_5.5/doc/is_debug.htm third-party/lp_solve_5.5/doc/is_feasible.htm third-party/lp_solve_5.5/doc/is_infinite.htm third-party/lp_solve_5.5/doc/is_int.htm third-party/lp_solve_5.5/doc/is_integerscaling.htm third-party/lp_solve_5.5/doc/is_lag_trace.htm third-party/lp_solve_5.5/doc/is_maxim.htm third-party/lp_solve_5.5/doc/is_nativeBFP.htm third-party/lp_solve_5.5/doc/is_nativeXLI.htm third-party/lp_solve_5.5/doc/is_negative.htm third-party/lp_solve_5.5/doc/is_obj_in_basis.htm third-party/lp_solve_5.5/doc/is_piv_mode.htm third-party/lp_solve_5.5/doc/is_piv_rule.htm third-party/lp_solve_5.5/doc/is_presolve.htm third-party/lp_solve_5.5/doc/is_scalemode.htm third-party/lp_solve_5.5/doc/is_scaletype.htm third-party/lp_solve_5.5/doc/is_semicont.htm third-party/lp_solve_5.5/doc/is_trace.htm third-party/lp_solve_5.5/doc/is_unbounded.htm third-party/lp_solve_5.5/doc/is_use_names.htm third-party/lp_solve_5.5/doc/lag_solve.htm third-party/lp_solve_5.5/doc/links.htm third-party/lp_solve_5.5/doc/list.gif third-party/lp_solve_5.5/doc/lp-format.htm third-party/lp_solve_5.5/doc/lp_solve.htm third-party/lp_solve_5.5/doc/lp_solveAPIreference.htm third-party/lp_solve_5.5/doc/lp_solve_5.5.0.12.chw third-party/lp_solve_5.5/doc/lp_solve_5.5.0.13.chw third-party/lp_solve_5.5/doc/lp_solve_5.5.0.14.chw third-party/lp_solve_5.5/doc/lp_solve_5.5.0.14_doc.tar third-party/lp_solve_5.5/doc/lp_solve_version.htm third-party/lp_solve_5.5/doc/make_lp.htm third-party/lp_solve_5.5/doc/mps-format.htm third-party/lp_solve_5.5/doc/open.gif third-party/lp_solve_5.5/doc/print_constraints.htm third-party/lp_solve_5.5/doc/print_debugdump.htm third-party/lp_solve_5.5/doc/print_duals.htm third-party/lp_solve_5.5/doc/print_lp.htm third-party/lp_solve_5.5/doc/print_objective.htm third-party/lp_solve_5.5/doc/print_scales.htm third-party/lp_solve_5.5/doc/print_solution.htm third-party/lp_solve_5.5/doc/print_str.htm third-party/lp_solve_5.5/doc/print_tableau.htm third-party/lp_solve_5.5/doc/put_abortfunc.htm third-party/lp_solve_5.5/doc/put_bb_branchfunc.htm third-party/lp_solve_5.5/doc/put_bb_nodefunc.htm third-party/lp_solve_5.5/doc/put_logfunc.htm third-party/lp_solve_5.5/doc/put_msgfunc.htm third-party/lp_solve_5.5/doc/quickstart.htm third-party/lp_solve_5.5/doc/ratio.htm third-party/lp_solve_5.5/doc/read_XLI.htm third-party/lp_solve_5.5/doc/read_basis.htm third-party/lp_solve_5.5/doc/read_lp.htm third-party/lp_solve_5.5/doc/read_mps.htm third-party/lp_solve_5.5/doc/read_params.htm third-party/lp_solve_5.5/doc/reset_basis.htm third-party/lp_solve_5.5/doc/reset_params.htm third-party/lp_solve_5.5/doc/resize_lp.htm third-party/lp_solve_5.5/doc/scaling.htm third-party/lp_solve_5.5/doc/search.htm third-party/lp_solve_5.5/doc/semi-cont.htm third-party/lp_solve_5.5/doc/sensitivity.htm third-party/lp_solve_5.5/doc/set_BFP.htm third-party/lp_solve_5.5/doc/set_XLI.htm third-party/lp_solve_5.5/doc/set_add_rowmode.htm third-party/lp_solve_5.5/doc/set_anti_degen.htm third-party/lp_solve_5.5/doc/set_basis.htm third-party/lp_solve_5.5/doc/set_basiscrash.htm third-party/lp_solve_5.5/doc/set_basisvar.htm third-party/lp_solve_5.5/doc/set_bb_depthlimit.htm third-party/lp_solve_5.5/doc/set_bb_floorfirst.htm third-party/lp_solve_5.5/doc/set_bb_rule.htm third-party/lp_solve_5.5/doc/set_binary.htm third-party/lp_solve_5.5/doc/set_bounds.htm third-party/lp_solve_5.5/doc/set_bounds_tighter.htm third-party/lp_solve_5.5/doc/set_break_at_first.htm third-party/lp_solve_5.5/doc/set_break_at_value.htm third-party/lp_solve_5.5/doc/set_col_name.htm third-party/lp_solve_5.5/doc/set_column.htm third-party/lp_solve_5.5/doc/set_constr_type.htm third-party/lp_solve_5.5/doc/set_debug.htm third-party/lp_solve_5.5/doc/set_epsb.htm third-party/lp_solve_5.5/doc/set_epsd.htm third-party/lp_solve_5.5/doc/set_epsel.htm third-party/lp_solve_5.5/doc/set_epsint.htm third-party/lp_solve_5.5/doc/set_epslevel.htm third-party/lp_solve_5.5/doc/set_epsperturb.htm third-party/lp_solve_5.5/doc/set_epspivot.htm third-party/lp_solve_5.5/doc/set_improve.htm third-party/lp_solve_5.5/doc/set_infinite.htm third-party/lp_solve_5.5/doc/set_int.htm third-party/lp_solve_5.5/doc/set_lag_trace.htm third-party/lp_solve_5.5/doc/set_lowbo.htm third-party/lp_solve_5.5/doc/set_lp_name.htm third-party/lp_solve_5.5/doc/set_mat.htm third-party/lp_solve_5.5/doc/set_maxim.htm third-party/lp_solve_5.5/doc/set_maxpivot.htm third-party/lp_solve_5.5/doc/set_minim.htm third-party/lp_solve_5.5/doc/set_mip_gap.htm third-party/lp_solve_5.5/doc/set_negrange.htm third-party/lp_solve_5.5/doc/set_obj_bound.htm third-party/lp_solve_5.5/doc/set_obj_fn.htm third-party/lp_solve_5.5/doc/set_obj_in_basis.htm third-party/lp_solve_5.5/doc/set_output.htm third-party/lp_solve_5.5/doc/set_pivoting.htm third-party/lp_solve_5.5/doc/set_preferdual.htm third-party/lp_solve_5.5/doc/set_presolve.htm third-party/lp_solve_5.5/doc/set_print_sol.htm third-party/lp_solve_5.5/doc/set_rh.htm third-party/lp_solve_5.5/doc/set_rh_range.htm third-party/lp_solve_5.5/doc/set_rh_vec.htm third-party/lp_solve_5.5/doc/set_row.htm third-party/lp_solve_5.5/doc/set_row_name.htm third-party/lp_solve_5.5/doc/set_scalelimit.htm third-party/lp_solve_5.5/doc/set_scaling.htm third-party/lp_solve_5.5/doc/set_semicont.htm third-party/lp_solve_5.5/doc/set_sense.htm third-party/lp_solve_5.5/doc/set_simplextype.htm third-party/lp_solve_5.5/doc/set_solutionlimit.htm third-party/lp_solve_5.5/doc/set_timeout.htm third-party/lp_solve_5.5/doc/set_trace.htm third-party/lp_solve_5.5/doc/set_unbounded.htm third-party/lp_solve_5.5/doc/set_upbo.htm third-party/lp_solve_5.5/doc/set_use_names.htm third-party/lp_solve_5.5/doc/set_var_branch.htm third-party/lp_solve_5.5/doc/set_var_weights.htm third-party/lp_solve_5.5/doc/set_verbose.htm third-party/lp_solve_5.5/doc/simpletree.css third-party/lp_solve_5.5/doc/simpletreemenu.js third-party/lp_solve_5.5/doc/solve.htm third-party/lp_solve_5.5/doc/time_elapsed.htm third-party/lp_solve_5.5/doc/unscale.htm third-party/lp_solve_5.5/doc/write_XLI.htm third-party/lp_solve_5.5/doc/write_basis.htm third-party/lp_solve_5.5/doc/write_lp.htm third-party/lp_solve_5.5/doc/write_mps.htm third-party/lp_solve_5.5/doc/write_params.htm third-party/lp_solve_5.5/fortify.c third-party/lp_solve_5.5/fortify.h third-party/lp_solve_5.5/ini.c third-party/lp_solve_5.5/ini.h third-party/lp_solve_5.5/lp_Hash.c third-party/lp_solve_5.5/lp_Hash.h third-party/lp_solve_5.5/lp_MDO.c third-party/lp_solve_5.5/lp_MDO.h third-party/lp_solve_5.5/lp_MPS.c third-party/lp_solve_5.5/lp_MPS.h third-party/lp_solve_5.5/lp_SOS.c third-party/lp_solve_5.5/lp_SOS.h third-party/lp_solve_5.5/lp_crash.c third-party/lp_solve_5.5/lp_crash.h third-party/lp_solve_5.5/lp_explicit.h third-party/lp_solve_5.5/lp_fortify.h third-party/lp_solve_5.5/lp_lib.c third-party/lp_solve_5.5/lp_lib.h third-party/lp_solve_5.5/lp_matrix.c third-party/lp_solve_5.5/lp_matrix.h third-party/lp_solve_5.5/lp_mipbb.c third-party/lp_solve_5.5/lp_mipbb.h third-party/lp_solve_5.5/lp_params.c third-party/lp_solve_5.5/lp_presolve.c third-party/lp_solve_5.5/lp_presolve.h third-party/lp_solve_5.5/lp_price.c third-party/lp_solve_5.5/lp_price.h third-party/lp_solve_5.5/lp_pricePSE.c third-party/lp_solve_5.5/lp_pricePSE.h third-party/lp_solve_5.5/lp_report.c third-party/lp_solve_5.5/lp_report.h third-party/lp_solve_5.5/lp_rlp.bat third-party/lp_solve_5.5/lp_rlp.c third-party/lp_solve_5.5/lp_rlp.h third... [truncated message content] |
From: <com...@us...> - 2009-08-23 07:35:06
|
Revision: 235 http://pntool.svn.sourceforge.net/pntool/?rev=235&view=rev Author: compaqdrew Date: 2009-08-23 07:34:58 +0000 (Sun, 23 Aug 2009) Log Message: ----------- We should probably be using -g... Modified Paths: -------------- codegen/Makefile codegen/src/codegen.xcodeproj/drew.mode1v3 codegen/src/codegen.xcodeproj/drew.pbxuser Modified: codegen/Makefile =================================================================== --- codegen/Makefile 2009-08-23 03:54:50 UTC (rev 234) +++ codegen/Makefile 2009-08-23 07:34:58 UTC (rev 235) @@ -1,6 +1,6 @@ #codegen makefile -COMPILER=gcc +COMPILER=gcc -g PNHEADERS = ../pnheaders/general.o ../pnheaders/matrix.o ../pnheaders/pns.o STANDALONE = src/main.o Modified: codegen/src/codegen.xcodeproj/drew.mode1v3 =================================================================== --- codegen/src/codegen.xcodeproj/drew.mode1v3 2009-08-23 03:54:50 UTC (rev 234) +++ codegen/src/codegen.xcodeproj/drew.mode1v3 2009-08-23 07:34:58 UTC (rev 235) @@ -216,10 +216,10 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>3AC8A5F60FF836F800DE2863</string> + <string>3AD43B2B1005F744006F6A93</string> <key>history</key> <array> - <string>3AC8A5B90FF82D8100DE2863</string> + <string>3AC8A5F60FF836F800DE2863</string> </array> </dict> <key>SplitCount</key> @@ -231,11 +231,11 @@ <key>Geometry</key> <dict> <key>Frame</key> - <string>{{0, 20}, {1027, 814}}</string> + <string>{{0, 20}, {1027, 677}}</string> <key>PBXModuleWindowStatusBarHidden2</key> <false/> <key>RubberWindowFrame</key> - <string>130 147 1027 855 0 0 1280 1002 </string> + <string>130 60 1027 718 0 0 1280 778 </string> </dict> </dict> </array> @@ -249,17 +249,15 @@ <dict> <key>ChosenToolbarItems</key> <array> - <string>active-target-popup</string> - <string>action</string> <string>active-buildstyle-popup</string> - <string>active-combo-popup</string> + <string>active-platform-popup</string> + <string>action</string> <string>NSToolbarFlexibleSpaceItem</string> - <string>buildOrClean</string> - <string>build-and-goOrGo</string> + <string>clean</string> + <string>build-and-go</string> <string>com.apple.ide.PBXToolbarStopButton</string> <string>get-info</string> - <string>toggle-editor</string> - <string>go-debug</string> + <string>servicesModuledebug</string> <string>NSToolbarFlexibleSpaceItem</string> <string>com.apple.pbx.toolbar.searchfield</string> </array> @@ -320,13 +318,13 @@ <key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key> <array> <array> - <integer>5</integer> + <integer>19</integer> <integer>3</integer> <integer>0</integer> </array> </array> <key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key> - <string>{{0, 0}, {186, 797}}</string> + <string>{{0, 0}, {186, 660}}</string> </dict> <key>PBXTopSmartGroupGIDs</key> <array/> @@ -338,14 +336,14 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {203, 815}}</string> + <string>{{0, 0}, {203, 678}}</string> <key>GroupTreeTableConfiguration</key> <array> <string>MainColumn</string> <real>186</real> </array> <key>RubberWindowFrame</key> - <string>-4 146 1280 856 0 0 1280 1002 </string> + <string>-4 59 1280 719 0 0 1280 778 </string> </dict> <key>Module</key> <string>PBXSmartGroupTreeModule</string> @@ -363,7 +361,7 @@ <key>PBXProjectModuleGUID</key> <string>1CE0B20306471E060097A5F4</string> <key>PBXProjectModuleLabel</key> - <string>MakeGen.c</string> + <string>plantCompiler.c</string> <key>PBXSplitModuleInNavigatorKey</key> <dict> <key>Split0</key> @@ -371,11 +369,11 @@ <key>PBXProjectModuleGUID</key> <string>1CE0B20406471E060097A5F4</string> <key>PBXProjectModuleLabel</key> - <string>MakeGen.c</string> + <string>plantCompiler.c</string> <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>3AC8A5F50FF836F800DE2863</string> + <string>3AD43B2A1005F744006F6A93</string> <key>history</key> <array> <string>3A7FCEED0FBC046D00EF8097</string> @@ -398,13 +396,12 @@ <string>3AC8A5650FF827A900DE2863</string> <string>3AC8A57F0FF8282C00DE2863</string> <string>3AC8A5A50FF82D0E00DE2863</string> - <string>3AC8A5D10FF8312800DE2863</string> - <string>3AC8A5D20FF8312800DE2863</string> <string>3AC8A5D30FF8312800DE2863</string> <string>3AC8A5D50FF8312800DE2863</string> <string>3AC8A5ED0FF831E800DE2863</string> <string>3AC8A5F20FF836F800DE2863</string> - <string>3AC8A5F30FF836F800DE2863</string> + <string>3AD43B091005F566006F6A93</string> + <string>3AD43B0A1005F566006F6A93</string> </array> <key>prevStack</key> <array> @@ -434,16 +431,7 @@ <string>3A4754420FF732C700EE18BA</string> <string>3AC8A56B0FF827A900DE2863</string> <string>3AC8A5700FF827A900DE2863</string> - <string>3AC8A5AA0FF82D0E00DE2863</string> - <string>3AC8A5D60FF8312800DE2863</string> - <string>3AC8A5D70FF8312800DE2863</string> - <string>3AC8A5D80FF8312800DE2863</string> - <string>3AC8A5D90FF8312800DE2863</string> - <string>3AC8A5DA0FF8312800DE2863</string> - <string>3AC8A5E70FF831C500DE2863</string> - <string>3AC8A5EE0FF831E800DE2863</string> - <string>3AC8A5EF0FF831E800DE2863</string> - <string>3AC8A5F40FF836F800DE2863</string> + <string>3AD43B0B1005F566006F6A93</string> </array> </dict> <key>SplitCount</key> @@ -455,14 +443,14 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {1072, 658}}</string> + <string>{{0, 0}, {1072, 547}}</string> <key>RubberWindowFrame</key> - <string>-4 146 1280 856 0 0 1280 1002 </string> + <string>-4 59 1280 719 0 0 1280 778 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>658pt</string> + <string>547pt</string> </dict> <dict> <key>ContentConfiguration</key> @@ -475,14 +463,14 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 663}, {1072, 152}}</string> + <string>{{0, 552}, {1072, 126}}</string> <key>RubberWindowFrame</key> - <string>-4 146 1280 856 0 0 1280 1002 </string> + <string>-4 59 1280 719 0 0 1280 778 </string> </dict> <key>Module</key> <string>XCDetailModule</string> <key>Proportion</key> - <string>152pt</string> + <string>126pt</string> </dict> </array> <key>Proportion</key> @@ -501,9 +489,9 @@ </array> <key>TableOfContents</key> <array> - <string>3AC8A5DC0FF8312800DE2863</string> + <string>3AD43B0D1005F566006F6A93</string> <string>1CE0B1FE06471DED0097A5F4</string> - <string>3AC8A5DD0FF8312800DE2863</string> + <string>3AD43B0E1005F566006F6A93</string> <string>1CE0B20306471E060097A5F4</string> <string>1CE0B20506471E060097A5F4</string> </array> @@ -642,7 +630,7 @@ <string>/Users/drew/Dropbox/Code/pntool/codegen/src/codegen.xcodeproj</string> </array> <key>WindowString</key> - <string>-4 146 1280 856 0 0 1280 1002 </string> + <string>-4 59 1280 719 0 0 1280 778 </string> <key>WindowToolsV3</key> <array> <dict> @@ -815,10 +803,10 @@ <key>Frame</key> <string>{{456, 0}, {544, 297}}</string> <key>RubberWindowFrame</key> - <string>173 384 1000 597 0 0 1280 1002 </string> + <string>173 173 1000 597 0 0 1280 778 </string> </dict> <key>RubberWindowFrame</key> - <string>173 384 1000 597 0 0 1280 1002 </string> + <string>173 173 1000 597 0 0 1280 778 </string> </dict> <key>Module</key> <string>PBXDebugSessionModule</string> @@ -841,18 +829,18 @@ <key>TableOfContents</key> <array> <string>1CD10A99069EF8BA00B06720</string> - <string>3AC8A5DF0FF8312800DE2863</string> + <string>3AD43B101005F566006F6A93</string> <string>1C162984064C10D400B95A72</string> - <string>3AC8A5E00FF8312800DE2863</string> - <string>3AC8A5E10FF8312800DE2863</string> - <string>3AC8A5E20FF8312800DE2863</string> - <string>3AC8A5E30FF8312800DE2863</string> - <string>3AC8A5E40FF8312800DE2863</string> + <string>3AD43B111005F566006F6A93</string> + <string>3AD43B121005F566006F6A93</string> + <string>3AD43B131005F566006F6A93</string> + <string>3AD43B141005F566006F6A93</string> + <string>3AD43B151005F566006F6A93</string> </array> <key>ToolbarConfiguration</key> <string>xcode.toolbar.config.debugV3</string> <key>WindowString</key> - <string>173 384 1000 597 0 0 1280 1002 </string> + <string>173 173 1000 597 0 0 1280 778 </string> <key>WindowToolGUID</key> <string>1CD10A99069EF8BA00B06720</string> <key>WindowToolIsVisible</key> Modified: codegen/src/codegen.xcodeproj/drew.pbxuser =================================================================== --- codegen/src/codegen.xcodeproj/drew.pbxuser 2009-08-23 03:54:50 UTC (rev 234) +++ codegen/src/codegen.xcodeproj/drew.pbxuser 2009-08-23 07:34:58 UTC (rev 235) @@ -76,8 +76,8 @@ PBXFileDataSource_Warnings_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 267922835; - PBXWorkspaceStateSaveDate = 267922835; + PBXPerProjectTemplateStateSaveDate = 268825927; + PBXWorkspaceStateSaveDate = 268825927; }; perUserProjectItems = { 3A09E2E20FED6EEA003FAB0D = 3A09E2E20FED6EEA003FAB0D /* PBXTextBookmark */; @@ -150,36 +150,63 @@ 3AC8A5B60FF82D8100DE2863 = 3AC8A5B60FF82D8100DE2863 /* PBXTextBookmark */; 3AC8A5B70FF82D8100DE2863 = 3AC8A5B70FF82D8100DE2863 /* PBXTextBookmark */; 3AC8A5B90FF82D8100DE2863 = 3AC8A5B90FF82D8100DE2863 /* PBXTextBookmark */; - 3AC8A5D10FF8312800DE2863 /* PBXTextBookmark */ = 3AC8A5D10FF8312800DE2863 /* PBXTextBookmark */; - 3AC8A5D20FF8312800DE2863 /* PBXTextBookmark */ = 3AC8A5D20FF8312800DE2863 /* PBXTextBookmark */; - 3AC8A5D30FF8312800DE2863 /* PBXTextBookmark */ = 3AC8A5D30FF8312800DE2863 /* PBXTextBookmark */; - 3AC8A5D40FF8312800DE2863 /* PBXTextBookmark */ = 3AC8A5D40FF8312800DE2863 /* PBXTextBookmark */; - 3AC8A5D50FF8312800DE2863 /* PBXTextBookmark */ = 3AC8A5D50FF8312800DE2863 /* PBXTextBookmark */; - 3AC8A5D60FF8312800DE2863 /* PBXTextBookmark */ = 3AC8A5D60FF8312800DE2863 /* PBXTextBookmark */; - 3AC8A5D70FF8312800DE2863 /* PBXTextBookmark */ = 3AC8A5D70FF8312800DE2863 /* PBXTextBookmark */; - 3AC8A5D80FF8312800DE2863 /* PBXTextBookmark */ = 3AC8A5D80FF8312800DE2863 /* PBXTextBookmark */; - 3AC8A5D90FF8312800DE2863 /* PBXTextBookmark */ = 3AC8A5D90FF8312800DE2863 /* PBXTextBookmark */; - 3AC8A5DA0FF8312800DE2863 /* PBXTextBookmark */ = 3AC8A5DA0FF8312800DE2863 /* PBXTextBookmark */; - 3AC8A5DB0FF8312800DE2863 /* PBXTextBookmark */ = 3AC8A5DB0FF8312800DE2863 /* PBXTextBookmark */; - 3AC8A5DE0FF8312800DE2863 /* PBXTextBookmark */ = 3AC8A5DE0FF8312800DE2863 /* PBXTextBookmark */; - 3AC8A5E50FF831C500DE2863 /* PBXTextBookmark */ = 3AC8A5E50FF831C500DE2863 /* PBXTextBookmark */; - 3AC8A5E60FF831C500DE2863 /* PBXTextBookmark */ = 3AC8A5E60FF831C500DE2863 /* PBXTextBookmark */; - 3AC8A5E70FF831C500DE2863 /* PBXTextBookmark */ = 3AC8A5E70FF831C500DE2863 /* PBXTextBookmark */; - 3AC8A5E80FF831C500DE2863 /* PBXTextBookmark */ = 3AC8A5E80FF831C500DE2863 /* PBXTextBookmark */; - 3AC8A5E90FF831C500DE2863 /* PBXTextBookmark */ = 3AC8A5E90FF831C500DE2863 /* PBXTextBookmark */; - 3AC8A5EA0FF831D300DE2863 /* PBXTextBookmark */ = 3AC8A5EA0FF831D300DE2863 /* PBXTextBookmark */; - 3AC8A5EB0FF831D300DE2863 /* PBXTextBookmark */ = 3AC8A5EB0FF831D300DE2863 /* PBXTextBookmark */; - 3AC8A5EC0FF831E800DE2863 /* PBXTextBookmark */ = 3AC8A5EC0FF831E800DE2863 /* PBXTextBookmark */; - 3AC8A5ED0FF831E800DE2863 /* PBXTextBookmark */ = 3AC8A5ED0FF831E800DE2863 /* PBXTextBookmark */; - 3AC8A5EE0FF831E800DE2863 /* PBXTextBookmark */ = 3AC8A5EE0FF831E800DE2863 /* PBXTextBookmark */; - 3AC8A5EF0FF831E800DE2863 /* PBXTextBookmark */ = 3AC8A5EF0FF831E800DE2863 /* PBXTextBookmark */; - 3AC8A5F00FF831E800DE2863 /* PBXTextBookmark */ = 3AC8A5F00FF831E800DE2863 /* PBXTextBookmark */; - 3AC8A5F10FF831E800DE2863 /* PBXTextBookmark */ = 3AC8A5F10FF831E800DE2863 /* PBXTextBookmark */; - 3AC8A5F20FF836F800DE2863 /* PBXTextBookmark */ = 3AC8A5F20FF836F800DE2863 /* PBXTextBookmark */; - 3AC8A5F30FF836F800DE2863 /* PBXTextBookmark */ = 3AC8A5F30FF836F800DE2863 /* PBXTextBookmark */; - 3AC8A5F40FF836F800DE2863 /* PBXTextBookmark */ = 3AC8A5F40FF836F800DE2863 /* PBXTextBookmark */; - 3AC8A5F50FF836F800DE2863 /* PBXTextBookmark */ = 3AC8A5F50FF836F800DE2863 /* PBXTextBookmark */; - 3AC8A5F60FF836F800DE2863 /* PBXTextBookmark */ = 3AC8A5F60FF836F800DE2863 /* PBXTextBookmark */; + 3AC8A5D10FF8312800DE2863 = 3AC8A5D10FF8312800DE2863 /* PBXTextBookmark */; + 3AC8A5D20FF8312800DE2863 = 3AC8A5D20FF8312800DE2863 /* PBXTextBookmark */; + 3AC8A5D30FF8312800DE2863 = 3AC8A5D30FF8312800DE2863 /* PBXTextBookmark */; + 3AC8A5D40FF8312800DE2863 = 3AC8A5D40FF8312800DE2863 /* PBXTextBookmark */; + 3AC8A5D50FF8312800DE2863 = 3AC8A5D50FF8312800DE2863 /* PBXTextBookmark */; + 3AC8A5D60FF8312800DE2863 = 3AC8A5D60FF8312800DE2863 /* PBXTextBookmark */; + 3AC8A5D70FF8312800DE2863 = 3AC8A5D70FF8312800DE2863 /* PBXTextBookmark */; + 3AC8A5D80FF8312800DE2863 = 3AC8A5D80FF8312800DE2863 /* PBXTextBookmark */; + 3AC8A5D90FF8312800DE2863 = 3AC8A5D90FF8312800DE2863 /* PBXTextBookmark */; + 3AC8A5DA0FF8312800DE2863 = 3AC8A5DA0FF8312800DE2863 /* PBXTextBookmark */; + 3AC8A5DB0FF8312800DE2863 = 3AC8A5DB0FF8312800DE2863 /* PBXTextBookmark */; + 3AC8A5DE0FF8312800DE2863 = 3AC8A5DE0FF8312800DE2863 /* PBXTextBookmark */; + 3AC8A5E50FF831C500DE2863 = 3AC8A5E50FF831C500DE2863 /* PBXTextBookmark */; + 3AC8A5E60FF831C500DE2863 = 3AC8A5E60FF831C500DE2863 /* PBXTextBookmark */; + 3AC8A5E70FF831C500DE2863 = 3AC8A5E70FF831C500DE2863 /* PBXTextBookmark */; + 3AC8A5E80FF831C500DE2863 = 3AC8A5E80FF831C500DE2863 /* PBXTextBookmark */; + 3AC8A5E90FF831C500DE2863 = 3AC8A5E90FF831C500DE2863 /* PBXTextBookmark */; + 3AC8A5EA0FF831D300DE2863 = 3AC8A5EA0FF831D300DE2863 /* PBXTextBookmark */; + 3AC8A5EB0FF831D300DE2863 = 3AC8A5EB0FF831D300DE2863 /* PBXTextBookmark */; + 3AC8A5EC0FF831E800DE2863 = 3AC8A5EC0FF831E800DE2863 /* PBXTextBookmark */; + 3AC8A5ED0FF831E800DE2863 = 3AC8A5ED0FF831E800DE2863 /* PBXTextBookmark */; + 3AC8A5EE0FF831E800DE2863 = 3AC8A5EE0FF831E800DE2863 /* PBXTextBookmark */; + 3AC8A5EF0FF831E800DE2863 = 3AC8A5EF0FF831E800DE2863 /* PBXTextBookmark */; + 3AC8A5F00FF831E800DE2863 = 3AC8A5F00FF831E800DE2863 /* PBXTextBookmark */; + 3AC8A5F10FF831E800DE2863 = 3AC8A5F10FF831E800DE2863 /* PBXTextBookmark */; + 3AC8A5F20FF836F800DE2863 = 3AC8A5F20FF836F800DE2863 /* PBXTextBookmark */; + 3AC8A5F30FF836F800DE2863 = 3AC8A5F30FF836F800DE2863 /* PBXTextBookmark */; + 3AC8A5F40FF836F800DE2863 = 3AC8A5F40FF836F800DE2863 /* PBXTextBookmark */; + 3AC8A5F50FF836F800DE2863 = 3AC8A5F50FF836F800DE2863 /* PBXTextBookmark */; + 3AC8A5F60FF836F800DE2863 = 3AC8A5F60FF836F800DE2863 /* PBXTextBookmark */; + 3AD43B091005F566006F6A93 /* PBXTextBookmark */ = 3AD43B091005F566006F6A93 /* PBXTextBookmark */; + 3AD43B0A1005F566006F6A93 /* PBXTextBookmark */ = 3AD43B0A1005F566006F6A93 /* PBXTextBookmark */; + 3AD43B0B1005F566006F6A93 /* PBXTextBookmark */ = 3AD43B0B1005F566006F6A93 /* PBXTextBookmark */; + 3AD43B0C1005F566006F6A93 /* PBXTextBookmark */ = 3AD43B0C1005F566006F6A93 /* PBXTextBookmark */; + 3AD43B0F1005F566006F6A93 /* PBXTextBookmark */ = 3AD43B0F1005F566006F6A93 /* PBXTextBookmark */; + 3AD43B161005F574006F6A93 /* PBXTextBookmark */ = 3AD43B161005F574006F6A93 /* PBXTextBookmark */; + 3AD43B171005F574006F6A93 /* PBXTextBookmark */ = 3AD43B171005F574006F6A93 /* PBXTextBookmark */; + 3AD43B181005F5A5006F6A93 /* PBXTextBookmark */ = 3AD43B181005F5A5006F6A93 /* PBXTextBookmark */; + 3AD43B191005F5A5006F6A93 /* PBXTextBookmark */ = 3AD43B191005F5A5006F6A93 /* PBXTextBookmark */; + 3AD43B1A1005F5B0006F6A93 /* PBXTextBookmark */ = 3AD43B1A1005F5B0006F6A93 /* PBXTextBookmark */; + 3AD43B1B1005F5B0006F6A93 /* PBXTextBookmark */ = 3AD43B1B1005F5B0006F6A93 /* PBXTextBookmark */; + 3AD43B1C1005F5BF006F6A93 /* PBXTextBookmark */ = 3AD43B1C1005F5BF006F6A93 /* PBXTextBookmark */; + 3AD43B1D1005F5BF006F6A93 /* PBXTextBookmark */ = 3AD43B1D1005F5BF006F6A93 /* PBXTextBookmark */; + 3AD43B1E1005F5C7006F6A93 /* PBXTextBookmark */ = 3AD43B1E1005F5C7006F6A93 /* PBXTextBookmark */; + 3AD43B1F1005F5C7006F6A93 /* PBXTextBookmark */ = 3AD43B1F1005F5C7006F6A93 /* PBXTextBookmark */; + 3AD43B201005F5CE006F6A93 /* PBXTextBookmark */ = 3AD43B201005F5CE006F6A93 /* PBXTextBookmark */; + 3AD43B211005F5CE006F6A93 /* PBXTextBookmark */ = 3AD43B211005F5CE006F6A93 /* PBXTextBookmark */; + 3AD43B221005F5D4006F6A93 /* PBXTextBookmark */ = 3AD43B221005F5D4006F6A93 /* PBXTextBookmark */; + 3AD43B231005F5D4006F6A93 /* PBXTextBookmark */ = 3AD43B231005F5D4006F6A93 /* PBXTextBookmark */; + 3AD43B241005F608006F6A93 /* PBXTextBookmark */ = 3AD43B241005F608006F6A93 /* PBXTextBookmark */; + 3AD43B251005F608006F6A93 /* PBXTextBookmark */ = 3AD43B251005F608006F6A93 /* PBXTextBookmark */; + 3AD43B261005F620006F6A93 /* PBXTextBookmark */ = 3AD43B261005F620006F6A93 /* PBXTextBookmark */; + 3AD43B271005F620006F6A93 /* PBXTextBookmark */ = 3AD43B271005F620006F6A93 /* PBXTextBookmark */; + 3AD43B281005F718006F6A93 /* PBXTextBookmark */ = 3AD43B281005F718006F6A93 /* PBXTextBookmark */; + 3AD43B291005F718006F6A93 /* PBXTextBookmark */ = 3AD43B291005F718006F6A93 /* PBXTextBookmark */; + 3AD43B2A1005F744006F6A93 /* PBXTextBookmark */ = 3AD43B2A1005F744006F6A93 /* PBXTextBookmark */; + 3AD43B2B1005F744006F6A93 /* PBXTextBookmark */ = 3AD43B2B1005F744006F6A93 /* PBXTextBookmark */; 3AEAF9100FB2697C00D61E73 = 3AEAF9100FB2697C00D61E73 /* PBXTextBookmark */; 3AEAF9120FB2697C00D61E73 = 3AEAF9120FB2697C00D61E73 /* PBXTextBookmark */; 3AEAF9130FB2697C00D61E73 = 3AEAF9130FB2697C00D61E73 /* PBXTextBookmark */; @@ -903,9 +930,9 @@ }; 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1332, 9058}}"; + sepNavIntBoundsRect = "{{0, 0}, {1332, 9100}}"; sepNavSelRange = "{11644, 0}"; - sepNavVisRange = "{6344, 1249}"; + sepNavVisRange = "{6557, 1036}"; sepNavWindowFrame = "{{130, 91}, {1027, 911}}"; }; }; @@ -957,7 +984,7 @@ uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1011, 1330}}"; sepNavSelRange = "{1837, 0}"; - sepNavVisRange = "{927, 1136}"; + sepNavVisRange = "{0, 1056}"; }; }; 3AC8A55F0FF827A900DE2863 /* PBXTextBookmark */ = { @@ -1407,11 +1434,6 @@ name = "plant-1.c"; path = "/Users/drew/Dropbox/Code/pntool/codegen/plant-1.c"; sourceTree = "<absolute>"; - uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {1182, 7308}}"; - sepNavSelRange = "{3892, 0}"; - sepNavVisRange = "{5674, 1047}"; - }; }; 3AC8A5B90FF82D8100DE2863 /* PBXTextBookmark */ = { isa = PBXTextBookmark; @@ -1438,7 +1460,7 @@ fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; name = "plantCompiler.c: 182"; rLen = 67; - rLoc = 4561; + rLoc = 4592; rType = 0; vrLen = 1486; vrLoc = 3398; @@ -1488,7 +1510,7 @@ fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; name = "plantCompiler.c: 182"; rLen = 67; - rLoc = 4561; + rLoc = 4592; rType = 0; vrLen = 1486; vrLoc = 3398; @@ -1723,6 +1745,276 @@ vrLen = 1249; vrLoc = 6344; }; + 3AD43B091005F566006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3AC8A5440FF81EE900DE2863 /* MakeGen.c */; + name = "MakeGen.c: 68"; + rLen = 0; + rLoc = 1837; + rType = 0; + vrLen = 1056; + vrLoc = 0; + }; + 3AD43B0A1005F566006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; + name = "plantCompiler.c: 182"; + rLen = 67; + rLoc = 4592; + rType = 0; + vrLen = 1139; + vrLoc = 3744; + }; + 3AD43B0B1005F566006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3AC8A5440FF81EE900DE2863 /* MakeGen.c */; + name = "MakeGen.c: 68"; + rLen = 0; + rLoc = 1837; + rType = 0; + vrLen = 1056; + vrLoc = 0; + }; + 3AD43B0C1005F566006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; + name = "plantCompiler.c: 46"; + rLen = 0; + rLoc = 1082; + rType = 0; + vrLen = 990; + vrLoc = 589; + }; + 3AD43B0F1005F566006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; + name = "supervisor_static_include.h: 471"; + rLen = 0; + rLoc = 11644; + rType = 0; + vrLen = 1036; + vrLoc = 6557; + }; + 3AD43B161005F574006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; + name = "plantCompiler.c: 44"; + rLen = 0; + rLoc = 1014; + rType = 0; + vrLen = 990; + vrLoc = 589; + }; + 3AD43B171005F574006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; + name = "supervisor_static_include.h: 471"; + rLen = 0; + rLoc = 11644; + rType = 0; + vrLen = 1036; + vrLoc = 6557; + }; + 3AD43B181005F5A5006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; + name = "plantCompiler.c: 89"; + rLen = 0; + rLoc = 2032; + rType = 0; + vrLen = 929; + vrLoc = 1384; + }; + 3AD43B191005F5A5006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; + name = "supervisor_static_include.h: 471"; + rLen = 0; + rLoc = 11644; + rType = 0; + vrLen = 1036; + vrLoc = 6557; + }; + 3AD43B1A1005F5B0006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; + name = "plantCompiler.c: 93"; + rLen = 0; + rLoc = 2203; + rType = 0; + vrLen = 931; + vrLoc = 1384; + }; + 3AD43B1B1005F5B0006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; + name = "supervisor_static_include.h: 471"; + rLen = 0; + rLoc = 11644; + rType = 0; + vrLen = 1036; + vrLoc = 6557; + }; + 3AD43B1C1005F5BF006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; + name = "plantCompiler.c: 75"; + rLen = 0; + rLoc = 1736; + rType = 0; + vrLen = 933; + vrLoc = 1384; + }; + 3AD43B1D1005F5BF006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; + name = "supervisor_static_include.h: 471"; + rLen = 0; + rLoc = 11644; + rType = 0; + vrLen = 1036; + vrLoc = 6557; + }; + 3AD43B1E1005F5C7006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; + name = "plantCompiler.c: 69"; + rLen = 0; + rLoc = 1631; + rType = 0; + vrLen = 939; + vrLoc = 1384; + }; + 3AD43B1F1005F5C7006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; + name = "supervisor_static_include.h: 471"; + rLen = 0; + rLoc = 11644; + rType = 0; + vrLen = 1036; + vrLoc = 6557; + }; + 3AD43B201005F5CE006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; + name = "plantCompiler.c: 67"; + rLen = 0; + rLoc = 1584; + rType = 0; + vrLen = 941; + vrLoc = 1384; + }; + 3AD43B211005F5CE006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; + name = "supervisor_static_include.h: 471"; + rLen = 0; + rLoc = 11644; + rType = 0; + vrLen = 1036; + vrLoc = 6557; + }; + 3AD43B221005F5D4006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; + name = "plantCompiler.c: 65"; + rLen = 0; + rLoc = 1538; + rType = 0; + vrLen = 943; + vrLoc = 1384; + }; + 3AD43B231005F5D4006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; + name = "supervisor_static_include.h: 471"; + rLen = 0; + rLoc = 11644; + rType = 0; + vrLen = 1036; + vrLoc = 6557; + }; + 3AD43B241005F608006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; + name = "plantCompiler.c: 145"; + rLen = 0; + rLoc = 3360; + rType = 0; + vrLen = 1130; + vrLoc = 3160; + }; + 3AD43B251005F608006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; + name = "supervisor_static_include.h: 471"; + rLen = 0; + rLoc = 11644; + rType = 0; + vrLen = 1036; + vrLoc = 6557; + }; + 3AD43B261005F620006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; + name = "plantCompiler.c: 145"; + rLen = 0; + rLoc = 3360; + rType = 0; + vrLen = 1091; + vrLoc = 3795; + }; + 3AD43B271005F620006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; + name = "supervisor_static_include.h: 471"; + rLen = 0; + rLoc = 11644; + rType = 0; + vrLen = 1036; + vrLoc = 6557; + }; + 3AD43B281005F718006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; + name = "plantCompiler.c: 173"; + rLen = 0; + rLoc = 4325; + rType = 0; + vrLen = 1133; + vrLoc = 3984; + }; + 3AD43B291005F718006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; + name = "supervisor_static_include.h: 471"; + rLen = 0; + rLoc = 11644; + rType = 0; + vrLen = 1036; + vrLoc = 6557; + }; + 3AD43B2A1005F744006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */; + name = "plantCompiler.c: 171"; + rLen = 0; + rLoc = 4261; + rType = 0; + vrLen = 1073; + vrLoc = 3844; + }; + 3AD43B2B1005F744006F6A93 /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = 3A99A6500FB8E06100B1F47C /* supervisor_static_include.h */; + name = "supervisor_static_include.h: 471"; + rLen = 0; + rLoc = 11644; + rType = 0; + vrLen = 1036; + vrLoc = 6557; + }; 3AEAF9040FB2696400D61E73 /* supervisorCompiler.h */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1011, 626}}"; @@ -1789,8 +2081,8 @@ 3AEE0D6D0FB3AA4900248D5F /* plantCompiler.c */ = { uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {1011, 15526}}"; - sepNavSelRange = "{4561, 67}"; - sepNavVisRange = "{3398, 1486}"; + sepNavSelRange = "{4261, 0}"; + sepNavVisRange = "{3844, 1073}"; sepNavWindowFrame = "{{-1116, 294}, {981, 639}}"; }; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ste...@us...> - 2009-08-23 03:54:58
|
Revision: 234 http://pntool.svn.sourceforge.net/pntool/?rev=234&view=rev Author: StephenCamp Date: 2009-08-23 03:54:50 +0000 (Sun, 23 Aug 2009) Log Message: ----------- spnbox documentation added. Added Paths: ----------- spnbox/doc/ spnbox/doc/README.txt spnbox/doc/functions.html spnbox/doc/index.html spnbox/doc/isis-2002-003.pdf spnbox/doc/support.html spnbox/doc/test.html Removed Paths: ------------- spnbox/README.txt Deleted: spnbox/README.txt =================================================================== --- spnbox/README.txt 2009-08-21 22:43:53 UTC (rev 233) +++ spnbox/README.txt 2009-08-23 03:54:50 UTC (rev 234) @@ -1,119 +0,0 @@ -#ABOUT -SPNBOX implements the Petri net supervisory control functions originally developed -for Matlab by Dr. Marian V. Iordache. - -The functions were converted to C for use with the ACTS tool by Stephen Camp. - -#COMPILING -To generate object files for the entire SPNBOX toolset, run "make" from the -pntool/spnbox directory. - -Note that SPNBOX makes use of the LPSOLVE MILP solver API found in the -pntool/third-party directory. The makefile will attempt to copy the compiled -library liblpsolve55.a from the LPSOLVE directories into the pntool/spnbox -directory if it is not already present. If the LPSOLVE library is not present in -its own directory, the SPNBOX makefile will invoke LPSOLVE's linux-targeted -makefile to build the lpsolve library. - -#TESTING -The subdirectory "tests" contains test files for the SPNBOX functions. There are -source files for a test program for each function except chkcons, which is used -as a subroutine of other functions and so tested implicitly. -The makefile within the directory will make any of the test programs. To generate -the test program for a particular function, use a command of the form: -make <functionname> -This will generate an executable called <functionname>.exe. -Note that the makefile can be configured to include a set of debugging routines -from the third-party library memwatch that will aid in debugging memory errors. -See MEMORY DEBUGGING later in this file for more information. To include this -library, the "USEMEMWATCH" variable in the test makefile should be set to "yes". -If it is set to anything else the memory debugging routines will not be included. - -make all will generate test executables for all spnbox functions. - -To test the various functions in the matrixmath.c file, use make matrixmath. To -test the functions in the extendedmatrix.c file, use make extendedmatrix. - -For all with such test programs except that ipslv, the test program is implemented -as a program that will read from an input stream containing text in a human- -readable format, interpret the text as parameters to the function, make a function -call, and display the results. For format specifications, see the comments in -StructuredIO.c/h. - -The programs may be invoked with a single command line argument, which will be -taken as the name of a text file from which to read the input. If no command line -argument is used the test programs will take input from the console. - -Pre-formatted test scripts with problems to test each part of a function have -been provided. These are named in the form test-<functionname>.txt. There is no -test script for admcon.c as the admcon function is thoroughly tested by its use -within the dp function. - -Thus, to test ipsolve with the default test script the following command sequence -might be issued: - -cd ~/pntool/spnbox/tests -make ipsolve -./ipsolve test-ipsolve.txt - -#MEMORY DEBUGGING -The test makefile can compile and link the spnbox files so that their test -routines will make use of the "memwatch" memory debugger. Memwatch is a set of -routines, declared in memwatch.h in the pntool/third-party/memwatch-2.71/ -directory, that overrides the standard memory allocation and deallocation -functions with its own wrappers. - -Memwatch keeps track of allocations and deallocations through its routines. It -can detect some but not all array overwrites, underwrites, wild pointer writes, -deallocations of invalid pointers, and various other potential errors related to -dynamically allocated memory. - -When a program that contains the Memwatch routines runs it will create a text -file in the current directory, titled memwatch.log by default, that lists any -errors or anomalies detected by the memwatch routines. - -Note that the memwatch routines slow memory-related operations drastically. - -See pntool/third-party/memwatch-2.71/USING for more information. -memwatch is licensed under the GNU public license, present in the file -pntool/third-party/memwatch-2.71/gpl.txt. - -#FILES -Main directory: -- spnbox.h: This is the header file containing the definitions for all the SPNBOX - functions, as well as various constant definitions. -- matrixmath.h & matrixmath.c: These implement various matrix arithmetic operations - used by other SPNBOX functions. -- extendedmatrix.h & extendedmatrix.c: These implement operations to insert or - remove rows and columns from matrices. Note that these functions employ when - possible optimizations that rely heavily on the internal details of matrix - implementation, and so if the matrix implementation is ever changed these - files will need to be modified accordingly. -- deallocation.c: This implements functions to deallocate the structures returned - by SPNBOX functions. -- Makefile: This is the main makefile. When used without a target it builds - object files that implement all SPNBOX functionality. - Use "make clean" to remove all object files, all library (*.a) files, and - execute the clean command for the lpsolve library in the third-party/lp_solve_5.5 - directory. - Use "make clean-partial" to remove all object files. -- Each of the other files corresponds to a single SPNBOX function. - -tests subdirectory: -- test.c & test.h: These define and implement a few subroutines used by many of - the test programs as well as implemented the pntool "is_verbose" function to - ensure maximum verbosity during testing. The header file also includes header - files common to all the test programs. -- StructuredIO.c & StructuredIO.h: These define and implement a pair of functions, - ParseStructure and DisplayStructure. ParseStructure is used used to parse human- - readable text from a stream as described in a format string and with it fill - an arbitrary number of variables. It is an analogue of sprintf with support - for more complex data structures such as arrays and matrices. - DisplayStructure is used to display such data structures in a human-readable - format as described by a similar format string. For usage and format string - information see the comments in the files. These functions are used by nearly - all the test programs to make the collection of input easier. -- Makefile: This is the test makefile. It is responsible for building various - test routines and takes targets as described above in #TESTING. -- All other files are the source files for the test executables for various - functions or the test scripts intended to be used with various text executables. Added: spnbox/doc/README.txt =================================================================== --- spnbox/doc/README.txt (rev 0) +++ spnbox/doc/README.txt 2009-08-23 03:54:50 UTC (rev 234) @@ -0,0 +1,119 @@ +#ABOUT +SPNBOX implements the Petri net supervisory control functions originally developed +for Matlab by Dr. Marian V. Iordache. + +The functions were converted to C for use with the ACTS tool by Stephen Camp. + +#COMPILING +To generate object files for the entire SPNBOX toolset, run "make" from the +pntool/spnbox directory. + +Note that SPNBOX makes use of the LPSOLVE MILP solver API found in the +pntool/third-party directory. The makefile will attempt to copy the compiled +library liblpsolve55.a from the LPSOLVE directories into the pntool/spnbox +directory if it is not already present. If the LPSOLVE library is not present in +its own directory, the SPNBOX makefile will invoke LPSOLVE's linux-targeted +makefile to build the lpsolve library. + +#TESTING +The subdirectory "tests" contains test files for the SPNBOX functions. There are +source files for a test program for each function except chkcons, which is used +as a subroutine of other functions and so tested implicitly. +The makefile within the directory will make any of the test programs. To generate +the test program for a particular function, use a command of the form: +make <functionname> +This will generate an executable called <functionname>.exe. +Note that the makefile can be configured to include a set of debugging routines +from the third-party library memwatch that will aid in debugging memory errors. +See MEMORY DEBUGGING later in this file for more information. To include this +library, the "USEMEMWATCH" variable in the test makefile should be set to "yes". +If it is set to anything else the memory debugging routines will not be included. + +make all will generate test executables for all spnbox functions. + +To test the various functions in the matrixmath.c file, use make matrixmath. To +test the functions in the extendedmatrix.c file, use make extendedmatrix. + +For all with such test programs except that ipslv, the test program is implemented +as a program that will read from an input stream containing text in a human- +readable format, interpret the text as parameters to the function, make a function +call, and display the results. For format specifications, see the comments in +StructuredIO.c/h. + +The programs may be invoked with a single command line argument, which will be +taken as the name of a text file from which to read the input. If no command line +argument is used the test programs will take input from the console. + +Pre-formatted test scripts with problems to test each part of a function have +been provided. These are named in the form test-<functionname>.txt. There is no +test script for admcon.c as the admcon function is thoroughly tested by its use +within the dp function. + +Thus, to test ipsolve with the default test script the following command sequence +might be issued: + +cd ~/pntool/spnbox/tests +make ipsolve +./ipsolve test-ipsolve.txt + +#MEMORY DEBUGGING +The test makefile can compile and link the spnbox files so that their test +routines will make use of the "memwatch" memory debugger. Memwatch is a set of +routines, declared in memwatch.h in the pntool/third-party/memwatch-2.71/ +directory, that overrides the standard memory allocation and deallocation +functions with its own wrappers. + +Memwatch keeps track of allocations and deallocations through its routines. It +can detect some but not all array overwrites, underwrites, wild pointer writes, +deallocations of invalid pointers, and various other potential errors related to +dynamically allocated memory. + +When a program that contains the Memwatch routines runs it will create a text +file in the current directory, titled memwatch.log by default, that lists any +errors or anomalies detected by the memwatch routines. + +Note that the memwatch routines slow memory-related operations drastically. + +See pntool/third-party/memwatch-2.71/USING for more information. +memwatch is licensed under the GNU public license, present in the file +pntool/third-party/memwatch-2.71/gpl.txt. + +#FILES +Main directory: +- spnbox.h: This is the header file containing the definitions for all the SPNBOX + functions, as well as various constant definitions. +- matrixmath.h & matrixmath.c: These implement various matrix arithmetic operations + used by other SPNBOX functions. +- extendedmatrix.h & extendedmatrix.c: These implement operations to insert or + remove rows and columns from matrices. Note that these functions employ when + possible optimizations that rely heavily on the internal details of matrix + implementation, and so if the matrix implementation is ever changed these + files will need to be modified accordingly. +- deallocation.c: This implements functions to deallocate the structures returned + by SPNBOX functions. +- Makefile: This is the main makefile. When used without a target it builds + object files that implement all SPNBOX functionality. + Use "make clean" to remove all object files, all library (*.a) files, and + execute the clean command for the lpsolve library in the third-party/lp_solve_5.5 + directory. + Use "make clean-partial" to remove all object files. +- Each of the other files corresponds to a single SPNBOX function. + +tests subdirectory: +- test.c & test.h: These define and implement a few subroutines used by many of + the test programs as well as implemented the pntool "is_verbose" function to + ensure maximum verbosity during testing. The header file also includes header + files common to all the test programs. +- StructuredIO.c & StructuredIO.h: These define and implement a pair of functions, + ParseStructure and DisplayStructure. ParseStructure is used used to parse human- + readable text from a stream as described in a format string and with it fill + an arbitrary number of variables. It is an analogue of sprintf with support + for more complex data structures such as arrays and matrices. + DisplayStructure is used to display such data structures in a human-readable + format as described by a similar format string. For usage and format string + information see the comments in the files. These functions are used by nearly + all the test programs to make the collection of input easier. +- Makefile: This is the test makefile. It is responsible for building various + test routines and takes targets as described above in #TESTING. +- All other files are the source files for the test executables for various + functions or the test scripts intended to be used with various text executables. Added: spnbox/doc/functions.html =================================================================== --- spnbox/doc/functions.html (rev 0) +++ spnbox/doc/functions.html 2009-08-23 03:54:50 UTC (rev 234) @@ -0,0 +1,25 @@ +<html> +<head> +<title>SPNBOX Functions</title> +</head> +<body> +<center><h3>SPNBOX Functions</h3></center> +<a name="general"><b>General Information and Coding Conventions</b></a> +<p>The SPNBOX functions are used for supervisory control. For descriptions of the purpose of individual functions see the <a href="isis-2002-003.pdf">original Matlab manual</a>. For descriptions of the C interfaces, see the <a href="../spnbox.h">spnbox header file</a>.</p> +<p>There are common patterns in the way parameters are used. In general, matrices as defined in <a href="../../pnheaders/matrix.h">matrix.h</a> in the pntool directory are used to represent Petri net matrices, marking and other types of constraint matrices, and some vectors and are passed to SPNBOX functions by pointer. In general, vectors are represented as integer arrays and are passed to SPNBOX functions as pointers to ints. The size of an array is sometimes determined by context, as from the number of rows in matrix, and sometimes explicitly via an integer parameter.</p> +<p>Return types use similar patterns. Matrices and vectors are represented in similar manners. In addition, some functions returns strings as status indications. The various status messages are defined in <a href="../spnbox.h">spnbox.h</a>. These messages are the same ones used in the original Matlab code.</p> +<p>There are a few coding conventions used in the SPNBOX function implementations.</p> +<ul> + <li>Most functions have been divided into subroutines, even where the functionality is only used once, to improve the readability of the code. In most files the subroutine division is a fairly natural division of the functionlity, but in a few places the Matlab functions did not lend themselves to obvious logical division. Here, the division into subroutines are somewhat arbitrary.</li> + <li>Almost every function has at least one subroutine, CheckParams, which checks the function parameters for validity and sometimes sets up defaults. It is typically this function that is responsible for raising an error (via merror defined in <a href="../../pnheaders/general.h">pnheaders/general.h</a>) and terminating.</li> + <li>The functions use a great deal of dynamic memory. Where numerous allocations or an unpredictable number of allocations are made, <a href="support.html#memorymanager">dynamic memory management routines</a> defined in the support files are used to record the allocations as they are made and free them all at the end of the function. Sometimes, however, the number of allocations is small enough that the management functions are not used.</li> + <li>All allocation is done via the safe wrappers tcalloc and tmalloc defined in <a href="../../pnheaders/general.h">general.h</a>.</li> +</ul> +<p>Some functions can print status messages to stdout during execution. How many of these messages will be printed is determined by a function int is_verbose(), declared but not implemented in <a href="../../pnheaders/general.h">general.h</a>. Verbosity is set by a custom implementation of the is_verbose() fuction. The integer returned by the function is the verbosity level. A higher level indicates a request to print more detail. The minimum, 0, means no message except those absolutely necessary should be printed. The maximum is 10. In the SPNBOX functions, each function has a verbosity threshold. It will print its messages only if the verbosity is at its threshold. Thresholds are defined in the main header file. Functions that are called by other functions should have a higher verbosity threshold so that their messages are displayed less readily.</p> +<p><a href="../spnbox.h">spnbox.h</a> is the primary header file for the SPNBOX functions. It defines all the SPNBOX functions and all the necessary option macros, message strings, return type structures, and a few specialized parameter structures.</p> +<br> +<a name="building"><b>Building SPNBOX</b></a> +<p>To build SPNBOX for use with ACTS, move to the pntool/spnbox/ directory and run make with the default target. This will build all object files for all the SPNBOX functions, as well as the support files used by them.</p> +<p>Note that this will also check to make sure that the support file liblpsolve55.a, the compiled linear programming library, is present. If it is not, the makefile will change directories to the third-party directory where the lpsolve files reside and run its linux-targeted makefile.</p> +</body> +</html> Added: spnbox/doc/index.html =================================================================== --- spnbox/doc/index.html (rev 0) +++ spnbox/doc/index.html 2009-08-23 03:54:50 UTC (rev 234) @@ -0,0 +1,39 @@ +<html> +<head> +<title>SPNBOX for C</title> +</head> +<body> +<center><h3>SPNBOX for C</h3></center> +<p>SPNBOX is the suite of functions for supervisory control under ACTS, A Concurrency Tool Suite (see the <a href="http://pntool.sourceforge.net/">SourceForge project</a>). SPNBOX was originally developed by <a href="mailto:mar...@le...">Dr. Marian V. Iordache</a> for Matlab. SPNBOX for C is a conversion of the original Matlab functions into C, designed for use with the rest of ACTS. It was converted by <a href="mailto:ste...@le...">Stephen Camp</a>.</p> +<p>The SPNBOX files are of three kinds: support files, functions used by the rest of the SPNBOX tools; the SPNBOX functions themselves, those which actually perform supervisory control; test files, used for creating demonstration executables, and the scripts that provide them with problems.</p> +<p>In addition, the SPNBOX tools make use of the third-party LPSOLVE Linear Programming library. SPNBOX's use of LPSOLVE is discussed in detail in this documentation. LPSOLVE itself has its own <a href="../../third-party/lp_solve_5.5/doc/index.htm">here</a>.</p> +<p>This documentation provides information about the files and functions primarily from a developer's perspective.</p> +<center><h4>Index</h4></center> +<ul> +<li><b>SPNBOX Functions</b> + <ul> + <li><a href="functions.html#general">General Information and Coding Conventions</a></li> + <li><a href="functions.html#building">Building SPNBOX</a></li> + <li><a href="isis-2002-003.pdf">Original SPNBOX for Matlab Manual</a></li> + </ul> +<li><b>Support Files</b> + <ul> + <li><a href="support.html#deallocation">Deallocation Functions (deallocation.c)</a></li> + <li><a href="support.html#extendedmatrix">Extended Matrix Manipulation (extendedmatrix.c)</a></li> + <li><a href="support.html#liblpsolve55">LP Solve Library (liblpsolve55.a)</a></li> + <li><a href="support.html#matrixmath">Matrix Arithmetic (matrixmath.c)</a></li> + <li><a href="support.html#memorymanager">Dynamic Memory Management (MemoryManager.c)</a></li> + </ul> +</li> +<li><b>Test Files</b> + <ul> + <li><a href="test.html#general">General Information and Coding Conventions</a></li> + <li><a href="test.html#building">Building Test Routines</a></li> + <li><a href="test.html#structuredio">High-Level I/O Routines (StructuredIO.c)</a></li> + <li><a href="test.html#memwatch">Third-Party Memory Debugging Library (memwatch.c)</a></li> + </li> + </ul> +</li> +</body> +</html> + Added: spnbox/doc/isis-2002-003.pdf =================================================================== (Binary files differ) Property changes on: spnbox/doc/isis-2002-003.pdf ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Added: spnbox/doc/support.html =================================================================== --- spnbox/doc/support.html (rev 0) +++ spnbox/doc/support.html 2009-08-23 03:54:50 UTC (rev 234) @@ -0,0 +1,22 @@ +<html> +<head> +<title>SPNBOX Support Files</title> +</head> +<body> +<center><h3>SPNBOX Support Files</h3></center> +<a name="deallocation"><b>Deallocation Functions (deallocation.c)</b></a> +<p>deallocation.c implements a series of functions the purpose of which is to deallocate the various structures returned by the SPNBOX functions. It has been made as safe as possible - that is, it checks before attempting to free arrays to ensure that the array pointers are not null and before attempting to deallocate matrices to make sure that they have been allocated. This last check is implemented by examing the matrix type - a nonzero type is taken to be an indicator of a valid matrix. Thus, result structures should always be zeroed after they are created so that, if the structure should be passed to a deallocation function before it is filled by an SPNBOX function, the deallocation function will not attempt free some random piece of memory.</p> +<a name="extendedmatrix"><b>Extended Matrix Manipulation (extendedmatrix.c)</b></a> +<p>The extended matrix manipulation functions provide functionality above and beyond that of mere matrix arithmatic. The general parameter format is to take pointers to the operand matrices followed by any row and column numbers, possibly followed by an integer describing the mode. Most of the functions are such that their return value is a single matrix. The mode integer changes the behavior of the functions. Modes between 1 and 3 request that the returned matrix be a newly-allocated matrix of the given type and that the operands be left unaltered. A mode of 0 requests that the returned matrix be a newly-allocated matrix of the default type assigned by AllocateMatrix and the operands be left unaltered. A negative mode requests that the operand matrix (or the primary operand if there are several) be altered by the function and returned.</p> +</p>Some of the functions, when in a negative mode, attempt to employ an optimization based on the internal nature of the matrix type. When the operation involves the addition, movement, or deletion of rows or columns, a type-2 matrix is of particular interest. The type-2 matrix stores its data as an array of arrays, that is, a pointer to an array of pointers, each of which is a pointer to an array of matrix elements. For an untransposed matrix (trans = 0), the sub-arrays are rows. For a transposed matrix (trans = 1) the sub-arrays are columns. Thus, if the operation in question deals with rows and the operand matrix or matrices are type-2 untransposed, the pointers to arrays can be manipulated rather than having to copy or reallocate areas of memory. Simililarly, if the operation deals with columns and the matrices are type-2 transposed, the pointers to arrays can be manipulated rather than having to reallocate or copy areas of memory. Note that these attempts at optimization are carried out internally and should be totally transparent to the calling function except where speed is concerned.</p> +<p>For specific function descriptions see the header file, <a href="../extendedmatrix.h">extendedmatrix.h</a>.</p> +<a name="liblpsolve55"><b>LP Solve Library (liblpsolve55.a)</b></a> +<p>This is a third-party mixed integer linear programming solver used by SPNBOX. The SPNBOX functions all interface to it via <a href="../ipsolve.c">ipsolve.c</a>, which itself interfaces to the MILP library via <a href="../ipslv.c">ipslv.c</a>. This library file is the result of the linux-targeted <a href="../../third-party/lp_solve_5.5/Makefile.Linux">makefile</a> in the third-party/lp_solve_5.5 directory. The makefile is called by the SPNBOX makefile, which then copies the final library file liblpsolve55.a from its default location in the directory /third-party/lp_solve_5.5/lpsolve55/ to the /spnbox directory.</p> +<a name="matrixmath"><b>Matrix Arithmetic (matrixmath.c)</b></a> +<p>The matrix arithmetic functions, as well as a few utility functions such as transposition and a friendly display function, are contained in the <a href="../matrixmath.h">matrixmath.h</a> and .c files. The general format of these functions is to take as parameters pointers to the operand matrices, any integer operands, and finally a pointer to a matrix in which the result will be stored. The result is assumed to have already been allocated. The result matrix will typically also be returned by the arithmetic function. However, if the pointer to the destination matrix is replaced by an integer between 0 and 3, a new matrix of the correct size will be allocated, filled with the result, and returned. If the integer is set to 0 the default allocation type will be used. Otherwise the specified type will be used.</p> +<a name="memorymanager"><b>Dynamic Memory Management (memorymanager.c)</b></a> +<p>The memory management files define two structures as aids in memory management and the functions to work with them. <a href="../MemoryManager.h">MemoryManager.h</a> maintains a self-growing list of memory allocations and matrix allocations so that all the memory can be freed at once. Its accompanying functions are wrappers for the allocation functions, mcalloc and MAllocateMatrixType, which take as their first argument a pointer to a MemoryManager struct. They will allocate the new memory or matrix as requested and add a pointer to it to the appropriate lists. MemoryManagers hold separate lists, one for matrices and one for ordinary memory. The other functions are ManageMatrix and ManageMemory, which add to the lists matrices or pieces of memory that were not created through the wrapper functions but should be deallocated with the rest of the memory in the manager's lists. FreeMemory takes a pointer to a memory manager and will free all the memory and all the matrices. Note that, internally, it frees matrices first and then normal memory. MemoryManager keeps its lists in dynamically-allocated memory, which is reallocated in blocks and not reallocated again until the next entire block has been filled. The block size for the memory and matrix lists can be set separately via the function that creates Memory Managers, but if the relevant parameters are less than some minimum it will raise them to the minimum, which is blocks of 5.</p> +<p>The other structure provided by MemoryManager.h is a MemoryGrower. This keeps track of a fixed number of pieces of memory, the number determined during creation by a parameter passed to CreateMemoryGrower. It allows these pieces of memory to be increased in size efficiently by allocating them in multiples of some block size, also determined during creation, and not actually reallocating until some amount of memory greater than the current actual capacity is requested. It does this by wrapping the allocation functions with its own, growMalloc and growCalloc, that take one additional parameter, a pointer to the MemoryGrower structure. They are used like variants of realloc, in that if the memory had been previously allocated they ensure that the previous contents remain. +Note that MemoryGrower keeps track of capacity based on the value of the pointer associated with the memory. Thus an external change to this pointer value will cause a fatal error when MemoryGrower is unable to locate the new pointer in its record of managed pointers.</p> +</body> +</html> Added: spnbox/doc/test.html =================================================================== --- spnbox/doc/test.html (rev 0) +++ spnbox/doc/test.html 2009-08-23 03:54:50 UTC (rev 234) @@ -0,0 +1,31 @@ +<html> +<head> +<title>SPNBOX Test Files</title> +</head> +<body> +<h3><center>SPNBOX Test Files</center></h3> +<a name="general"><b>General Information and Coding Conventions</b></a> +<p>The SPNBOX functions come with a set of test files used during debugging. The files are contained all contained in the /spnbox/tests/ directory. There are source files to produce one executable for each SPNBOX function. The executables take input from the console or from a file, specified as a single command-line argument.</p> +<p>The input should be formatted to be interpreted by a special set of IO routines, discussed <a href="#structuredio">later</a>. Input should describe a single problem, that is, all the parameters for a call to the function the executable tests. When a particular keyword is given, each program displays a summary of the data it was given, makes a test call to the function it tests with the given parameters, and displays the result.</p> +<p>The test programs typically use a single header file, <a href="../tests/test.h">test.h</a>, that includes all the header files that are typically used by a test program. This file also defines a few functions, implemented in <a href="../tests/test.c">test.c</a>, that are useful in many of the test programs.</p> +<p>The first such function is <code>FILE* ParseCmdLine(int argc, char* argv[])</code>, which takes as parameters the same parameters used by an executable to retrieve its command-line arguments and returns a pointer to the stream which should be used for input. ParseCmdLine examines the arguments to the program. If there are any arguments the first is interpreted as a filename. ParseCmdLine attempts to open the file for input and return a pointer to it. If the open fails ParseCmdLine returns a null pointer. If there are no arguments, ParseCmdLine displays a message informing the user they may type "help" for information about commands and returns a pointer to stdin.</p> +<p>Another such is FillDmDp. This function is useful in the context of the I/O routines because they make parameters optional and return an integer flag array to indicate which ones have been filled in. In order to allow users to enter either complete incidence matrices (more convenient since it contains the data in Dm and Dp in one matrix) or separate input and output matrices if the Petri net contains self-loops, the programs typically allow the user all three options and let them enter what they choose. FillDmDp examines three flags in an integer array, assuming that the flags represent the filled state of D, Dm, and Dp, and if D has been given will use the pns functions to fill Dm and Dp with the appropriate matrices.</p> +<p>Finally, test.h defines <code>is_verbose()</code> to return the value of a global integer from <a href="../tests/test.c">test.c</a>. This integer can be set with a call to <code>void setverbose(int)</code>, defined in test.h & c.</p> +<p>The general structure of a typical test program is to use <code>ParseCmdLine()</code> to retrieve a pointer to the input file. Then, an description of what variables are needed for that particular function type is placed in a string (character array). This description is in a format used internally by the specialized IO routines. Miscellaneous problem variables are defined here as well. The core of the program is a loop that continues until the function <code>ParseStructure()</code>, which uses the text description to read in variables for a single function call, returns 0, indicating that a keyword was found in the input stream requesting program termination. In the body of the loop, the variables filled by the <code>ParseStructure()</code> are displayed (written to stdout) and then formatted as necessary to prepare them for use in a call to the function being tested. The function call is made and the results are displayed. Memory allocated by the <code>ParseStructure()</code> call and in the function return value is freed. Then the loop returns to its beginning and <code>ParseStructure</code> is called again. At the end of the program any residual memory is freed.</p> +<p>Note that there are a few routines for which the test program is different, and a few for which there is no test program because they are used subroutines of other thoroughly tested programs.</p> +<p>In addition, test scripts have been provided for the test programs. These contain text in the correct format to test all the functionality of a given function. The naming convention is test-functionname.txt.<p> +<a name="building"><b>Building Test Routines</b></a> +<p>The makefile in the tests folder can make each of the executables to test each of the programs. Each executable is a single target, and each one has the name of the function being tested. Thus, to test ipsolve, one would use the following sequence of commands (beginning from the pntool root directory).</p> +<code> +cd spnbox/tests<br> +make ipsolve<br> +./ipsolve test-ipsolve.txt<br> +</code> +<p>Note that the makefile can, as an option, link in a third-party memory debugging library located in the /third-party/memwatch-2.71/ directory. This library wraps the memory allocation and deallocation functions and keeps track of allocations and frees. It also attempts to catch wild pointer writes and other memory-related errors. See the later section on memwatch for more information. The inclusion of this library in the test routines slows them down by orders of magnitude, so its inclusion is optional, set by the setting of the "USEMEMWATCH" variable which is defined in the first few lines of the test makefile. When this variable is set to "yes", the memwatch libraries will be included. When it is set to any other value they will be left out.</p> +<a name="structuredio"><b>High Level I/O Routines (StructuredIO.c)</b></a> +<p><a href="../tests/StructuredIO.h">StructuredIO.h</a> and .c define a pair of routines intended to read and display complex data such as matrices and vectors in a human-readable format. There are two functions.<p> +<p><code>int ParseStructure(FILE *file, char* DataDescription, int** FilledMask, MemoryManager* Memory, ...)</code> is for reading in data. The first parameter is a file pointer to the stream from which input is to be taken. This can be stdin. DataDescription is a null-terminated string containing a description of the variables that define a single problem. This includes names, the keywords that will be used to indicate that a particular variable follows when they are encountered in the input stream, and the type of variable. For more information about the format of this string, see the comments in <a href="../tests/StructuredIO.h">StructuredIO.h</a>. The next parameter, FilledMask, is a pointer to an integer pointer that will be filled with an array allocated by <code>ParseStructure()</code>. There will be one element for each variable that is to possibly be filled, set to 0 if that variable was not found in the input stream before the end-of-problem keyword was encountered, and set to nonzero if the keyword was found and the variable was filled. The MemoryManager pointer points to a MemoryManager structure (which should have been previously initialized) which is used to record all the allocations made by the call to <code>ParseStructure()</code>. This is followed by optional parameters, pointers to variables corresponding to those defined in the DataDescription. The function reads the input stream looking for keywords, after which are assumed to come the values of the variables associated with those keywords. The data is read and put into the variables pointed to by the optional parameters. There are also several predefined keywords which cause <code>ParseStructure()</code> to perform other tasks. When the "echo" keyword is encountered the remainder of the line is read and printed to stdout. When "rem" is encountered the rest of the line is ignored. When "help" is encountered a message describing basic usage and whatever keywords have been set up by the DataDescription is printed - "help 'keyword'" returns help on a specific predefined keyword. "done" ends the current problem, causing <code>ParseStructure()</code> to return a nonzero value. "quit" is interpreted as a request to terminate the program, causeing <code>ParseStructure</code> to return zero. For more information about keywords and data formats see the <a href="../tests/StructuredIO.h">StructuredIO.h</a> header file.</p> +<p>The second function, <code>void DisplayStructure(char* DataDescription, int* Mask, ...)</code> is used to display the same kinds of data as that read by <code>ParseStructure</code> in a friendly format. Similar parameters have similar meanings. For more information on how the data is displayed, see the <a href="../tests/StructuredIO.h">StructuredIO.h</a> header file.</p> +<a name="memwatch"><b>Third-Party Member Debugging Library (memwatch.c)</b></a> +<p>The memwatch library is a third-party library intended to help fing memory-related bugs such as wild frees, wild pointer writes, overwrites, and underwrites. It functions by wrapping C's memory functions with its own, which log allocations and deallocations, allocate buffers around allocated pieces of memory to detect overwrites and underwrites, and implements several other algorithms to help detect memory errors. Each time a program the libraries have been included in executes, memwatch creates (or appends to if it already exists) a log file, memwatch.log. This log file will include notes of any errors or anomolies the memwatch routines detect. Because the routines slow down any memory-related operations by orders of magnitude, their inclusion in the test routines is optional and can be enabled or disabled as described in the <a href="#building">"Building Test Routines"</a> section.</p> +<p>More information on the memwatch routines can be found in several files, <a href="../../third-party/memwatch-2.71/README">/third-party/memwatch-2.71/README</a>, <a href="../../third-party/memwatch-2.71/USING">/third-party/memwatch-2.71/USING</a>, and in the primary header file, <a href="../../third-party/memwatch-2.71/memwatch.h">/third-party/memwatch-2.71/memwatch.h</a>.</p> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ste...@us...> - 2009-08-21 22:43:59
|
Revision: 233 http://pntool.svn.sourceforge.net/pntool/?rev=233&view=rev Author: StephenCamp Date: 2009-08-21 22:43:53 +0000 (Fri, 21 Aug 2009) Log Message: ----------- Corrected an error in mroadm.c Modified Paths: -------------- spnbox/mroadm.c Modified: spnbox/mroadm.c =================================================================== --- spnbox/mroadm.c 2009-08-21 22:11:11 UTC (rev 232) +++ spnbox/mroadm.c 2009-08-21 22:43:53 UTC (rev 233) @@ -297,7 +297,7 @@ int educ(mroadm_d* d) { int success = 1, i, j, upperlimit; - upperlimit = d->places; + upperlimit = d->places < d->TucCount ? d->places : d->TucCount; for (i = 0; i < upperlimit; i++) { /*See if there are any elements below the main diagonal less than 0.*/ @@ -354,7 +354,7 @@ void zduo(mroadm_d* d) { int success = 1, i, j, k, upperlimit; - upperlimit = d->places; + upperlimit = d->places < d->TucCount + d->TuoCount ? d->places : d->TucCount + d->TuoCount; for (i = 0; i < upperlimit; i++) { /*See if there are any elements below the main diagonal less than 0.*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ste...@us...> - 2009-08-21 22:11:17
|
Revision: 232 http://pntool.svn.sourceforge.net/pntool/?rev=232&view=rev Author: StephenCamp Date: 2009-08-21 22:11:11 +0000 (Fri, 21 Aug 2009) Log Message: ----------- Fixed a bug (abs was taking place after magnitude comparison) in gcdv. Made minor cosmetic changes to pn2acpn. Made a change to speed supervis up slightly in the event it is passed a non-type-2 constraint matrix. Modified Paths: -------------- spnbox/gcdv.c spnbox/pn2acpn.c spnbox/supervis.c Modified: spnbox/gcdv.c =================================================================== --- spnbox/gcdv.c 2009-08-21 19:39:34 UTC (rev 231) +++ spnbox/gcdv.c 2009-08-21 22:11:11 UTC (rev 232) @@ -74,6 +74,9 @@ int gcd(int a, int b) { int c; + /*Make sure both are positive.*/ + if (a < 0) a = -a; + if (b < 0) b = -b; /*Make sure a is greater than b by swapping if necessary.*/ if (a < b) { @@ -81,9 +84,6 @@ a = b; b = c; } - /*Make sure both are positive.*/ - if (a < 0) a = -a; - if (b < 0) b = -b; /*Division-based Euclidian gcd algorithm.*/ while (b) { Modified: spnbox/pn2acpn.c =================================================================== --- spnbox/pn2acpn.c 2009-08-21 19:39:34 UTC (rev 231) +++ spnbox/pn2acpn.c 2009-08-21 22:11:11 UTC (rev 232) @@ -49,8 +49,7 @@ Transition has been set to -1 by either of the functions responsible for finding the next transition to be processed.*/ while (Transition >= 0) - { - + { cardbtx[Transition] = 0; /*Get U, a 2xn matrix each column of which contains a pair of place indices for which a particular relationship holds.*/ Modified: spnbox/supervis.c =================================================================== --- spnbox/supervis.c 2009-08-21 19:39:34 UTC (rev 231) +++ spnbox/supervis.c 2009-08-21 22:11:11 UTC (rev 232) @@ -55,22 +55,9 @@ } else { - //We need to make sure that L is a type-2 matrix for optimization purposes. - if (L->type == 2) - { - //If l is already type 2, just duplicate the pointer. - constraints = L; - } - else - { - //If not, then allocate a new type-2 matrix and copy it. - constraints = tmalloc(sizeof(matrix)); - AllocateMatrixType(2, constraints, k, m); - CopyMatrix(L, constraints); - } + constraints = L; } - /*Now, constraints contains a constraint matrix of proper dimensions, stored - as a type-2.*/ + /*Now, constraints contains a constraint matrix of proper dimensions.*/ /*Get the incidence matrix corresponding to the input/output matrices of the plant. The result should be stored in a type-2 matrix.*/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ste...@us...> - 2009-08-21 19:39:41
|
Revision: 231 http://pntool.svn.sourceforge.net/pntool/?rev=231&view=rev Author: StephenCamp Date: 2009-08-21 19:39:34 +0000 (Fri, 21 Aug 2009) Log Message: ----------- Modified actn.c to use the optimized row/column swaps during the uniqueness test. Modified Paths: -------------- spnbox/actn.c spnbox/tests/Makefile Modified: spnbox/actn.c =================================================================== --- spnbox/actn.c 2009-08-21 19:18:18 UTC (rev 230) +++ spnbox/actn.c 2009-08-21 19:39:34 UTC (rev 231) @@ -1,6 +1,7 @@ #include <stdlib.h> #include "../pnheaders/matrix.h" #include "matrixmath.h" +#include "extendedmatrix.h" #include "MemoryManager.h" #include "spnbox.h" @@ -101,9 +102,8 @@ int* UnraisableT; double* B; short int *IntList; - ipsolve_r result; + ipsolve_r result; - //If no transitions are being evaluated, return true. if ((Transitions = NumberOfColumns(*D) - XCount) <= 0) return 1; /*Build a flag array of the columns whose indices are in X.*/ @@ -112,8 +112,10 @@ { UnraisableT[X[i]] = 1; } - /*Build Dx. It should include only columns of D whose indices are not in X.*/ - AllocateMatrixType(2, &Dx, NumberOfRows(*D) + 1, Transitions); + /*Build Dx. It should include only columns of D whose indices are not in X. + It should be optimized for column ops.*/ + AllocateMatrixType(2, &Dx, Transitions, NumberOfRows(*D) + 1); + TransposeMatrix(&Dx); j = 0; for (i = 0; i < NumberOfColumns(*D); i++) { @@ -129,8 +131,9 @@ free(UnraisableT); /*Allocate space to record the values of the current column while it is - zeroed.*/ - AllocateMatrixType(1, &dx, NumberOfRows(*D) + 1, 1); + zeroed. Make it a type-2 transpose to optimize the column-swap operation.*/ + AllocateMatrixType(1, &dx, 1, NumberOfRows(*D) + 1); + TransposeMatrix(&dx); /*Build B. It is all zeroes except for a 1 in the last element.*/ B = tcalloc(NumberOfRows(*D) + 1, sizeof(double)); @@ -142,16 +145,13 @@ /*Iterate through each transition*/ for (i = 0; i < Transitions; i++) { - /*Zero a column of Dx and store it temporarily in dx for later restoration*/ - for (j = 0; j <= NumberOfRows(*D); j++) - { - //Restore the previous transition (if there is one to restore) - if (i) SetMatrixEl(&Dx, j, i - 1, GetMatrixEl(&dx, j, 0)); - //Copy the current transition - SetMatrixEl(&dx, j, 0, GetMatrixEl(&Dx, j, i)); - //Zero the current transition. - SetMatrixEl(&Dx, j, i, 0); - } + /*If there is a previous transition to restore, restore it.*/ + if (i) SwapColumns(&Dx, &dx, i - 1, 0); + /*Swap out the current transition. Because dx is a column of zeros this + will effectively zero the current transition and save a copy in dx for later + restoration.*/ + SwapColumns(&Dx, &dx, i, 0); + //ipsolve_r ipsolve(matrix* L, double* B, double* f, short int *IntList, double *ub, double *lb, short int *ctype); result = ipsolve(&Dx, B, 0, IntList, 0, 0, 0); if (result.res) free(result.res); Modified: spnbox/tests/Makefile =================================================================== --- spnbox/tests/Makefile 2009-08-21 19:18:18 UTC (rev 230) +++ spnbox/tests/Makefile 2009-08-21 19:39:34 UTC (rev 231) @@ -39,7 +39,7 @@ MSPLIT=msplit.o PN2ACPN=pn2acpn.o SUPERVIS=supervis.o $(EXTENDEDMATRIX) -ACTN=actn.o $(NLTRANS) +ACTN=actn.o $(EXTENDEDMATRIX) $(NLTRANS) ADMCON=admcon.o $(EXTENDEDMATRIX) $(IPSOLVE) ASIPH=asiph.o $(ACTN) $(EXTENDEDMATRIX) ILPADM=ilpadm.o $(IPSOLVE) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ste...@us...> - 2009-08-21 19:18:27
|
Revision: 230 http://pntool.svn.sourceforge.net/pntool/?rev=230&view=rev Author: StephenCamp Date: 2009-08-21 19:18:18 +0000 (Fri, 21 Aug 2009) Log Message: ----------- Added optimized row/column swap operations in extendedmatrix.c and appropriate test routines. Modified mroadm.c and reduce.c to use the new optimized row/column swaps. Modified Paths: -------------- spnbox/README.txt spnbox/extendedmatrix.c spnbox/extendedmatrix.h spnbox/mroadm.c spnbox/reduce.c spnbox/tests/Makefile spnbox/tests/test-extendedmatrix.c spnbox/tests/test-extendedmatrix.txt Modified: spnbox/README.txt =================================================================== --- spnbox/README.txt 2009-08-21 16:14:28 UTC (rev 229) +++ spnbox/README.txt 2009-08-21 19:18:18 UTC (rev 230) @@ -1,45 +1,94 @@ #ABOUT -SPNBOX implements the Petri net supervisory control functions originally developed by Dr. Iordache for Matlab. +SPNBOX implements the Petri net supervisory control functions originally developed +for Matlab by Dr. Marian V. Iordache. +The functions were converted to C for use with the ACTS tool by Stephen Camp. + #COMPILING -To generate object files for the entire SPNBOX toolset, run "make" from the pntool/spnbox directory. +To generate object files for the entire SPNBOX toolset, run "make" from the +pntool/spnbox directory. -Note that SPNBOX makes use of the LPSOLVE MILP solver API found in the pntool/third-party directory. The makefile will attempt to copy the compiled library liblpsolve55.a from the LPSOLVE directories into the pntool/spnbox directory if it is not already present. If the LPSOLVE library is not present in its own directory, the SPNBOX makefile will invoke LPSOLVE's linux-targeted makefile to build the lpsolve library. +Note that SPNBOX makes use of the LPSOLVE MILP solver API found in the +pntool/third-party directory. The makefile will attempt to copy the compiled +library liblpsolve55.a from the LPSOLVE directories into the pntool/spnbox +directory if it is not already present. If the LPSOLVE library is not present in +its own directory, the SPNBOX makefile will invoke LPSOLVE's linux-targeted +makefile to build the lpsolve library. #TESTING -The subdirectory "tests" contains test files for the SPNBOX functions. There are source files for a test program for each function except chkcons, which is used as a subroutine of other functions and so tested implicitly. -The makefile within the directory will make any of the test programs. To generate the test program for a particular function, use a command of the form: +The subdirectory "tests" contains test files for the SPNBOX functions. There are +source files for a test program for each function except chkcons, which is used +as a subroutine of other functions and so tested implicitly. +The makefile within the directory will make any of the test programs. To generate +the test program for a particular function, use a command of the form: make <functionname> This will generate an executable called <functionname>.exe. -Note that the makefile can be configured to include a set of debugging routines from the third-party library memwatch that will aid in debugging memory errors. See MEMORY DEBUGGING later in this file for more information. To include this library, the "USEMEMWATCH" variable in the test makefile should be set to "yes". If it is set to anything else the memory debugging routines will not be included. +Note that the makefile can be configured to include a set of debugging routines +from the third-party library memwatch that will aid in debugging memory errors. +See MEMORY DEBUGGING later in this file for more information. To include this +library, the "USEMEMWATCH" variable in the test makefile should be set to "yes". +If it is set to anything else the memory debugging routines will not be included. + make all will generate test executables for all spnbox functions. -To test the various functions in the matrixmath.c file, use make matrixmath. To test the functions in the extendedmatrix.c file, use make extendedmatrix. -For all with such test programs except that ipslv, the test program is implemented as a program that will read from an input stream containing text in a human-readable format, interpret the text as parameters to the function, make a function call, and display the results. For format specifications, see the comments in StructuredIO.c/h. -The programs may be invoked with a single command line argument, which will be taken as the name of a text file from which to read the input. If no command line argument is used the test programs will take input from the console. +To test the various functions in the matrixmath.c file, use make matrixmath. To +test the functions in the extendedmatrix.c file, use make extendedmatrix. -Pre-formatted test scripts with problems to test each part of a function have been provided. These are named in the form test-<functionname>.txt. There is no test script for admcon.c as the admcon function is thoroughly tested by its use within the dp function. +For all with such test programs except that ipslv, the test program is implemented +as a program that will read from an input stream containing text in a human- +readable format, interpret the text as parameters to the function, make a function +call, and display the results. For format specifications, see the comments in +StructuredIO.c/h. -Thus, to test ipsolve with the default test script the following command sequence might be issued: +The programs may be invoked with a single command line argument, which will be +taken as the name of a text file from which to read the input. If no command line +argument is used the test programs will take input from the console. +Pre-formatted test scripts with problems to test each part of a function have +been provided. These are named in the form test-<functionname>.txt. There is no +test script for admcon.c as the admcon function is thoroughly tested by its use +within the dp function. + +Thus, to test ipsolve with the default test script the following command sequence +might be issued: + cd ~/pntool/spnbox/tests make ipsolve ./ipsolve test-ipsolve.txt #MEMORY DEBUGGING -The test makefile can compile and link the spnbox files so that their test routines will make use of the "memwatch" memory debugger. Memwatch is a set of routines, declared in memwatch.h in the pntool/third-party/memwatch-2.71/ directory, that overrides the standard memory allocation and deallocation functions with its own wrappers. -Memwatch keeps track of allocations and deallocations through its routines. It can detect some but not all array overwrites, underwrites, wild pointer writes, deallocations of invalid pointers, and various other potential errors related to dynamically allocated memory. -When a program that contains the Memwatch routines runs it will create a text file in the current directory, titled memwatch.log by default, that lists any errors or anomalies detected by the memwatch routines. +The test makefile can compile and link the spnbox files so that their test +routines will make use of the "memwatch" memory debugger. Memwatch is a set of +routines, declared in memwatch.h in the pntool/third-party/memwatch-2.71/ +directory, that overrides the standard memory allocation and deallocation +functions with its own wrappers. + +Memwatch keeps track of allocations and deallocations through its routines. It +can detect some but not all array overwrites, underwrites, wild pointer writes, +deallocations of invalid pointers, and various other potential errors related to +dynamically allocated memory. + +When a program that contains the Memwatch routines runs it will create a text +file in the current directory, titled memwatch.log by default, that lists any +errors or anomalies detected by the memwatch routines. + Note that the memwatch routines slow memory-related operations drastically. + See pntool/third-party/memwatch-2.71/USING for more information. -memwatch is licensed under the GNU public license, present in the file pntool/third-party/memwatch-2.71/gpl.txt. +memwatch is licensed under the GNU public license, present in the file +pntool/third-party/memwatch-2.71/gpl.txt. #FILES Main directory: - spnbox.h: This is the header file containing the definitions for all the SPNBOX functions, as well as various constant definitions. -- matrixmath.h & matrixmath.c: These implement various matrix operations used by - other SPNBOX functions. +- matrixmath.h & matrixmath.c: These implement various matrix arithmetic operations + used by other SPNBOX functions. +- extendedmatrix.h & extendedmatrix.c: These implement operations to insert or + remove rows and columns from matrices. Note that these functions employ when + possible optimizations that rely heavily on the internal details of matrix + implementation, and so if the matrix implementation is ever changed these + files will need to be modified accordingly. - deallocation.c: This implements functions to deallocate the structures returned by SPNBOX functions. - Makefile: This is the main makefile. When used without a target it builds Modified: spnbox/extendedmatrix.c =================================================================== --- spnbox/extendedmatrix.c 2009-08-21 16:14:28 UTC (rev 229) +++ spnbox/extendedmatrix.c 2009-08-21 19:18:18 UTC (rev 230) @@ -345,6 +345,66 @@ return *m; } +void SwapRows(matrix* a, matrix* b, int rowA, int rowB) +{ + if (! (a && b)) + { + merror(0, "SWAPROWS/COLUMNS: One of the matrix pointers is null"); + return; + } + if (NumberOfColumns(*a) != NumberOfColumns(*b)) + { + merror(0, "SWAPROWS/COLUMNS: The dimensions of the matrices do not agree"); + return; + } + if (rowA < 0 || rowA >= NumberOfRows(*a) || rowB < 0 || rowB >= NumberOfRows(*b)) + { + merror(0, "SWAPROWS/COLUMNS: One of the row/column numbers is out of range"); + return; + } + /*If a and b refer to the same matrix and the same row numbers are used, + no operation is necessary.*/ + if (a == b && rowA == rowB) return; + + /*If the matrices are type-2 untransposed, do a swap of the pointers in ar + rather than copying whole rows.*/ + if (a->type == 2 && b->type == 2 && !(a->trans || b->trans)) + { + mtype* temp = b->ar[rowB]; + b->ar[rowB] = a->ar[rowA]; + a->ar[rowA] = temp; + } + /*Otherwise we'll have to iterate through the whole row and do a copy-type + swap.*/ + else + { + int temp, i; + for (i = 0; i < NumberOfColumns(*a); i++) + { + temp = GetMatrixEl(a, rowA, i); + SetMatrixEl(a, rowA, i, GetMatrixEl(b, rowB, i)); + SetMatrixEl(b, rowB, i, temp); + } + } +} + +void SwapColumns(matrix *a, matrix* b, int colA, int colB) +{ + if (a && b) + { + TransposeMatrix(a); + TransposeMatrix(b); + SwapRows(a, b, colA, colB); + TransposeMatrix(a); + TransposeMatrix(b); + } + else + { + merror(0, "SWAPROWS/COLUMNS: One of the matrix pointers is null"); + return; + } +} + void OptimizeRows(matrix* m) { matrix newM; Modified: spnbox/extendedmatrix.h =================================================================== --- spnbox/extendedmatrix.h 2009-08-21 16:14:28 UTC (rev 229) +++ spnbox/extendedmatrix.h 2009-08-21 19:18:18 UTC (rev 230) @@ -84,6 +84,20 @@ (reducing computational complexity by a factor at least equal to the number of rows in the matrix) if and only if the matrix is a type-2 transposed.*/ +void SwapRows(matrix* a, matrix* b, int rowA, int rowB); +/*SwapRows exchanges the contents of the rowA'th row of A with the rowB'th row of +B. If both matrices are type-2 untransposed, the function employs an optimization +that reduces computational complexity by a factor equal to the number of columns +in the matrices. +a and b can point to the same matrix.*/ + +void SwapColumns(matrix *a, matrix* b, int colA, int colB); +/*SwapColumns exchanges the contents of the colA'th column of A with the colB'th +column of B. If both matrices are type-2 transposed, the function employs an +optimization that reduces computational complexity by a factor equal to the +number of rows in the matrices. +a and b can point to the same matrix.*/ + void OptimizeRows(matrix *m); /*OptimizeRows modifies the matrix passed to it so that its use with the row- manipulation functions will be optimized for speed.*/ Modified: spnbox/mroadm.c =================================================================== --- spnbox/mroadm.c 2009-08-21 16:14:28 UTC (rev 229) +++ spnbox/mroadm.c 2009-08-21 19:18:18 UTC (rev 230) @@ -2,6 +2,7 @@ #include "../pnheaders/general.h" #include "../pnheaders/matrix.h" #include "matrixmath.h" +#include "extendedmatrix.h" #include "spnbox.h" typedef struct mroadm_d @@ -297,10 +298,6 @@ { int success = 1, i, j, upperlimit; upperlimit = d->places; - /*At some point we are going to need to swap some rows of M. Allocate a - matrix to hold intermediate values.*/ - matrix mrow; - AllocateMatrixType(1, &mrow, 1, NumberOfColumns(d->M)); for (i = 0; i < upperlimit; i++) { /*See if there are any elements below the main diagonal less than 0.*/ @@ -312,10 +309,7 @@ { if (j != i) { - /*Swap rows*/ - CopyBlock(1, NumberOfColumns(d->M), &d->M, i, 0, &mrow, 0, 0); - CopyBlock(1, NumberOfColumns(d->M), &d->M, j, 0, &d->M, i, 0); - CopyBlock(1, NumberOfColumns(d->M), &mrow, 0, 0, &d->M, j, 0); + SwapRows(&d->M, &d->M, i, j); } czero(d, i, i); } @@ -352,7 +346,6 @@ } if (i < d->places + d->conversionCount) success = 0; } - DeallocateMatrix(&mrow); return success; } @@ -362,10 +355,6 @@ { int success = 1, i, j, k, upperlimit; upperlimit = d->places; - /*At some point we are going to need to swap some rows of M. Allocate a - matrix to hold intermediate values.*/ - matrix mrow; - AllocateMatrixType(1, &mrow, 1, NumberOfColumns(d->M)); for (i = 0; i < upperlimit; i++) { /*See if there are any elements below the main diagonal less than 0.*/ @@ -375,10 +364,7 @@ } if (k < d->places && k != i) { - /*Swap rows*/ - CopyBlock(1, NumberOfColumns(d->M), &d->M, i, 0, &mrow, 0, 0); - CopyBlock(1, NumberOfColumns(d->M), &d->M, k, 0, &d->M, i, 0); - CopyBlock(1, NumberOfColumns(d->M), &mrow, 0, 0, &d->M, k, 0); + SwapRows(&d->M, &d->M, i, k); } if (k < d->places) { @@ -397,10 +383,7 @@ { if (j != i) { - /*Swap rows*/ - CopyBlock(1, NumberOfColumns(d->M), &d->M, i + k, 0, &mrow, 0, 0); - CopyBlock(1, NumberOfColumns(d->M), &d->M, j, 0, &d->M, i + k, 0); - CopyBlock(1, NumberOfColumns(d->M), &mrow, 0, 0, &d->M, j, 0); + SwapRows(&d->M, &d->M, i + k, j); } czero(d, i + k, i); } @@ -424,7 +407,6 @@ break; } } - DeallocateMatrix(&mrow); } /******************************************************************************* Modified: spnbox/reduce.c =================================================================== --- spnbox/reduce.c 2009-08-21 16:14:28 UTC (rev 229) +++ spnbox/reduce.c 2009-08-21 19:18:18 UTC (rev 230) @@ -2,6 +2,7 @@ #include "../pnheaders/matrix.h" #include "../pnheaders/pns.h" #include "spnbox.h" +#include "extendedmatrix.h" static void ExtractConstraint(matrix* L, matrix* l, int* B, int* b, int Constraint); static void RestoreConstraint(matrix* L, matrix* l, int* B, int b, int Constraint); @@ -99,17 +100,14 @@ return result; } /******************************************************************************* -ExtractConstraint takes the given constraint row from L and B, copies it to the -single-row parameters l and b, and zeros it in L in preparation for redundancy -tests with chkcons.*/ +ExtractConstraint nulls out l and swaps its single row with the given constraint +row from L. It swaps out the proper element of B and b as well. This is in +preparation for redundancy tests with chkcons.*/ void ExtractConstraint(matrix* L, matrix* l, int* B, int* b, int Constraint) { int i; - for (i = 0; i < NumberOfColumns(*L); i++) - { - SetMatrixEl(l, 0, i, GetMatrixEl(L, Constraint, i)); - SetMatrixEl(L, Constraint, i, 0); - } + MakeZeroRow(l, 0); + SwapRows(L, l, Constraint, 0); *b = B[Constraint]; B[Constraint] = 0; } @@ -120,9 +118,6 @@ void RestoreConstraint(matrix* L, matrix* l, int* B, int b, int Constraint) { int i; - for (i = 0; i < NumberOfColumns(*L); i++) - { - SetMatrixEl(L, Constraint, i, GetMatrixEl(l, 0, i)); - } + SwapRows(L, l, Constraint, 0); B[Constraint] = b; } Modified: spnbox/tests/Makefile =================================================================== --- spnbox/tests/Makefile 2009-08-21 16:14:28 UTC (rev 229) +++ spnbox/tests/Makefile 2009-08-21 19:18:18 UTC (rev 230) @@ -6,7 +6,7 @@ #This variable controls whether or not the memwatch memory debugging routines are included in #compilation. Set to "yes" to include them and "no" to leave them out. -USEMEMWATCH = yes +USEMEMWATCH = no #Assign the default compiler call and options. COMPILER=gcc -g @@ -43,11 +43,11 @@ ADMCON=admcon.o $(EXTENDEDMATRIX) $(IPSOLVE) ASIPH=asiph.o $(ACTN) $(EXTENDEDMATRIX) ILPADM=ilpadm.o $(IPSOLVE) -MROADM=mroadm.o $(GCDV) +MROADM=mroadm.o $(EXTENDEDMATRIX) $(GCDV) LINENF=linenf.o $(ILPADM) $(MROADM) NLTRANS=nltrans.o $(IPSOLVE) PN2EACPN=pn2eacpn.o $(NLTRANS) -REDUCE=reduce.o chkcons.o $(IPSOLVE) +REDUCE=reduce.o chkcons.o $(EXTENDEDMATRIX) $(IPSOLVE) TACTN=tactn.o $(IPSOLVE) DP=dp.o tactn.o reduce.o chkcons.o pn2eacpn.o nltrans.o asiph.o actn.o admcon.o supervis.o msplit.o issiph.o fvpr.o avpr.o $(EXTENDEDMATRIX) $(IPSOLVE) DP4=dp4.o tactn.o reduce.o chkcons.o pn2acpn.o nltrans.o asiph.o actn.o admcon.o supervis.o msplit.o issiph.o fvpr.o avpr.o $(EXTENDEDMATRIX) $(IPSOLVE) Modified: spnbox/tests/test-extendedmatrix.c =================================================================== --- spnbox/tests/test-extendedmatrix.c 2009-08-21 16:14:28 UTC (rev 229) +++ spnbox/tests/test-extendedmatrix.c 2009-08-21 19:18:18 UTC (rev 230) @@ -27,6 +27,10 @@ static void SInsertNullC(int Size, int Reps, int Col, int Cols, int Optimized); static void TInsertNullR(matrix *A, int Row, int Rows, int Mode, int Optimized); static void TInsertNullC(matrix *A, int Col, int Cols, int Mode, int Optimized); +static void TSwapR(matrix* A, matrix* B, int Row, int Optimized); +static void TSwapC(matrix* A, matrix* B, int Col, int Optimized); +static void SSwapR(int Size, int Reps, int Row, int Optimized); +static void SSwapC(int Size, int Reps, int Col, int Optimized); static void TOptimizeR(matrix *A); static void TOptimizeC(matrix *A); @@ -127,6 +131,28 @@ TRemoveC(&A, Column, Columns, Mode, Optimized); } } + else if (! strcmp(Operation, "SwapRows")) + { + if (SpeedTest) + { + SSwapR(Size, Reps, Row, Optimized); + } + else + { + TSwapR(&A, &B, Row, Optimized); + } + } + else if (! strcmp(Operation, "SwapColumns")) + { + if (SpeedTest) + { + SSwapC(Size, Reps, Column, Optimized); + } + else + { + TSwapC(&A, &B, Column, Optimized); + } + } else if (! strcmp(Operation, "OptimizeRows")) { TOptimizeR(&A); @@ -438,12 +464,96 @@ if (Mode >= 0) DeallocateMatrix(&result); } +void TSwapR(matrix* A, matrix* B, int Row, int Optimized) +{ + printf("Testing row swap: A(%d,:) <-> B(%d,:).\n", Row, 0); + printf("Optimization: %s.\n", Optimized ? "Yes" : "No"); + ShowMatrix(A, "A Before"); + ShowMatrix(B, "B Before"); + if (Optimized) + { + OptimizeRows(A); + OptimizeRows(B); + } + else + { + OptimizeColumns(A); + OptimizeColumns(B); + } + SwapRows(A, B, Row, 0); + ShowMatrix(A, "A After"); + ShowMatrix(B, "B After"); +} + +void TSwapC(matrix* A, matrix* B, int Col, int Optimized) +{ + printf("Testing column swap: A(:,%d) <-> B(:,%d).\n", Col, 0); + printf("Optimization: %s.\n", Optimized ? "Yes" : "No"); + ShowMatrix(A, "A Before"); + ShowMatrix(B, "B Before"); + if (! Optimized) + { + OptimizeRows(A); + OptimizeRows(B); + } + else + { + OptimizeColumns(A); + OptimizeColumns(B); + } + SwapColumns(A, B, Col, 0); + ShowMatrix(A, "A After"); + ShowMatrix(B, "B After"); +} + +void SSwapR(int Size, int Reps, int Row, int Optimized) +{ + printf("Speed-testing row swap (%s).\n", Optimized ? "optimized" : "unoptimized"); + + printf("Swapping the %d-th rows of two empty square matrices of size %d, %d times.\n", Row, Size, Reps); + + matrix *a = AllocateMatrices(Size, Size, Reps, ! Optimized); + matrix *b = AllocateMatrices(Size, Size, Reps, ! Optimized); + + clock_t t0 = clock(); + int i; + for (i = 0; i < Reps; i++) + { + SwapRows(a + i, b + i, Row, Row); + } + double time = ((double) (clock() - t0)) / ((double) CLOCKS_PER_SEC); + printf("Time: %.2f ms\n", time * 1000.0); + DeallocateMatrices(Reps, a); + DeallocateMatrices(Reps, b); +} + +void SSwapC(int Size, int Reps, int Col, int Optimized) +{ + printf("Speed-testing column swap (%s).\n", Optimized ? "optimized" : "unoptimized"); + + printf("Swapping the %d-th columns of two empty square matrices of size %d, %d times.\n", Col, Size, Reps); + + matrix *a = AllocateMatrices(Size, Size, Reps, Optimized); + matrix *b = AllocateMatrices(Size, Size, Reps, Optimized); + + clock_t t0 = clock(); + int i; + for (i = 0; i < Reps; i++) + { + SwapColumns(a + i, b + i, Col, Col); + } + double time = ((double) (clock() - t0)) / ((double) CLOCKS_PER_SEC); + printf("Time: %.2f ms\n", time * 1000.0); + DeallocateMatrices(Reps, a); + DeallocateMatrices(Reps, b); +} + void TOptimizeR(matrix *A) { ShowMatrix(A, "A before row optimization"); OptimizeRows(A); ShowMatrix(A, "A after row optimization"); - printf("A is %stransposed", A->trans ? "" : "un"); + printf("A is %stransposed.\n", A->trans ? "" : "un"); } void TOptimizeC(matrix *A) Modified: spnbox/tests/test-extendedmatrix.txt =================================================================== --- spnbox/tests/test-extendedmatrix.txt 2009-08-21 16:14:28 UTC (rev 229) +++ spnbox/tests/test-extendedmatrix.txt 2009-08-21 19:18:18 UTC (rev 230) @@ -138,7 +138,7 @@ columns 1 optimization yes done -quit + echo Problem 13. Null row insertion, unoptimized speedtest. operation InsertNullRows size 20 @@ -215,4 +215,49 @@ operation OptimizeColumns done +echo Problem 21. Row Swap. +A 3 3 +1 2 3 +4 5 6 +7 8 9 +B 3 3 +10 11 12 +13 14 15 +16 17 18 +row 1 +operation SwapRows +optimization no +done + +echo Problem 22. Column Swap. +A 3 3 +1 2 3 +4 5 6 +7 8 9 +B 3 3 +10 11 12 +13 14 15 +16 17 18 +column 1 +operation SwapColumns +optimization yes +done + +echo Problem 23. Speed-test row swap (unoptimized). +size 10 +repetitions 20000 +row 3 +optimization no +speedtest yes +operation SwapRows +done + +echo Problem 24. Speed-test row swap (optimized). +size 10 +repetitions 20000 +row 3 +optimization yes +speedtest yes +operation SwapRows +done quit This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ste...@us...> - 2009-08-21 16:14:44
|
Revision: 229 http://pntool.svn.sourceforge.net/pntool/?rev=229&view=rev Author: StephenCamp Date: 2009-08-21 16:14:28 +0000 (Fri, 21 Aug 2009) Log Message: ----------- Fixed a typo in the spnbox makefile. Modified Paths: -------------- spnbox/Makefile Modified: spnbox/Makefile =================================================================== --- spnbox/Makefile 2009-08-21 16:09:19 UTC (rev 228) +++ spnbox/Makefile 2009-08-21 16:14:28 UTC (rev 229) @@ -5,7 +5,7 @@ all: actn.o admcon.o asiph.o avpr.o chkcons.o deallocation.o dp.o\ extendedmatrix.o fvpr.o gcdv.o invar.o ilpadm.o ipslv.o ipsolve.o isadm.o\ - issiph.o linenf.o matrixmath.o MemoryManager.o mroadm.o msplit.o nltrans.o\ + issiph.o linenf.o matrixmath.o MemoryManager.o mroadm.o msplit.o nltrans.o\ pn2acpn.o pn2eacpn.o reduce.o supervis.o tactn.o liblpsolve55.a actn.o: actn.c spnbox.h MemoryManager.h matrixmath.h ../pnheaders/general.h ../pnheaders/matrix.h @@ -91,7 +91,6 @@ tactn.o: tactn.c spnbox.h ../pnheaders/matrix.h ../pnheaders/pns.h matrixmath.h MemoryManager.h $(COMPILER) -c tactn.c - liblpsolve55.a: ../third-party/lp_solve_5.5/lpsolve55/liblpsolve55.a cp ../third-party/lp_solve_5.5/lpsolve55/liblpsolve55.a liblpsolve55.a This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ste...@us...> - 2009-08-21 16:09:28
|
Revision: 228 http://pntool.svn.sourceforge.net/pntool/?rev=228&view=rev Author: StephenCamp Date: 2009-08-21 16:09:19 +0000 (Fri, 21 Aug 2009) Log Message: ----------- linenf.c has been altered to attempt to use mroadm before reverting to the slower ilpadm. Fixed a bug (bad array upper limit) in mroadm.c. Modified Paths: -------------- spnbox/linenf.c spnbox/mroadm.c spnbox/tests/Makefile Modified: spnbox/linenf.c =================================================================== --- spnbox/linenf.c 2009-08-21 15:06:30 UTC (rev 227) +++ spnbox/linenf.c 2009-08-21 16:09:19 UTC (rev 228) @@ -228,13 +228,15 @@ NewD = SubtractMatrix(&NewDp, &NewDm, (matrix*) 2); ManageMatrix(&RowMemory, &NewD); - /*Transform the marking constraints to admissible marking constraints.*/ - AdmResult = ilpadm(&NewL, b ? b + i : 0, &NewD, NewTucCount, NewTuc, TuoCount, Tuo, Newm0); - ManageMatrix(&RowMemory, &AdmResult.La); - ManageMatrix(&RowMemory, &AdmResult.R1); - ManageMatrix(&RowMemory, &AdmResult.R2); - ManageMemory(&RowMemory, AdmResult.ba); - ManageMemory(&RowMemory, AdmResult.dhow); + /*Transform the marking constraints to admissible marking constraints. + Use mroadm first. If it fails to solve, try the slower but more + thorough ilpadm.*/ + AdmResult = (ilpadm_r) mroadm(&NewL, b ? b + i : 0, &NewD, NewTuc, NewTucCount, Tuo, TuoCount, Newm0); + if (strcmp(AdmResult.dhow[0], HOW_OK)) + { + DeallocateIlpadm(&AdmResult); + AdmResult = ilpadm(&NewL, b ? b + i : 0, &NewD, NewTucCount, NewTuc, TuoCount, Tuo, Newm0); + } Ret.dhow[i] = AdmResult.dhow[0]; @@ -281,7 +283,7 @@ /*Collapse the enforced net back to applying to the original problem and store the results in the return structure.*/ CollapseNet(i, &EnfResult, &Transform, &Ret, Places, Transitions); - + DeallocateIlpadm(&AdmResult); DeallocateLinenf(&EnfResult); } else Modified: spnbox/mroadm.c =================================================================== --- spnbox/mroadm.c 2009-08-21 15:06:30 UTC (rev 227) +++ spnbox/mroadm.c 2009-08-21 16:09:19 UTC (rev 228) @@ -454,7 +454,7 @@ } } /*Now iterate through places from the one given as a parameter.*/ - for (i = row; i < row + d->places; i++) + for (i = row; i < d->places; i++) { /*Process if the places are of opposite sign.*/ if (GetMatrixEl(&d->M, i, col) * GetMatrixEl(&d->M, row, col) < 0) Modified: spnbox/tests/Makefile =================================================================== --- spnbox/tests/Makefile 2009-08-21 15:06:30 UTC (rev 227) +++ spnbox/tests/Makefile 2009-08-21 16:09:19 UTC (rev 228) @@ -44,7 +44,7 @@ ASIPH=asiph.o $(ACTN) $(EXTENDEDMATRIX) ILPADM=ilpadm.o $(IPSOLVE) MROADM=mroadm.o $(GCDV) -LINENF=linenf.o $(ILPADM) +LINENF=linenf.o $(ILPADM) $(MROADM) NLTRANS=nltrans.o $(IPSOLVE) PN2EACPN=pn2eacpn.o $(NLTRANS) REDUCE=reduce.o chkcons.o $(IPSOLVE) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ste...@us...> - 2009-08-21 15:06:40
|
Revision: 227 http://pntool.svn.sourceforge.net/pntool/?rev=227&view=rev Author: StephenCamp Date: 2009-08-21 15:06:30 +0000 (Fri, 21 Aug 2009) Log Message: ----------- Fixed a minor bug in dp. Added mroadm, the test routine, a partial test script, and the appropriate spnbox.h, deallocation.c, and makefile entries. mroadm runs and passes the current test script, but the script is not guaranteed to test all functionality. Changed the listing of C authors in spnbox.h from "Marian Iordache & Stephen Camp" to "Stephen Camp". Modified Paths: -------------- spnbox/Makefile spnbox/deallocation.c spnbox/dp.c spnbox/spnbox.h spnbox/tests/Makefile Added Paths: ----------- spnbox/mroadm.c spnbox/tests/test-mroadm.c spnbox/tests/test-mroadm.txt Modified: spnbox/Makefile =================================================================== --- spnbox/Makefile 2009-08-20 13:40:31 UTC (rev 226) +++ spnbox/Makefile 2009-08-21 15:06:30 UTC (rev 227) @@ -5,8 +5,8 @@ all: actn.o admcon.o asiph.o avpr.o chkcons.o deallocation.o dp.o\ extendedmatrix.o fvpr.o gcdv.o invar.o ilpadm.o ipslv.o ipsolve.o isadm.o\ - issiph.o linenf.o matrixmath.o MemoryManager.o msplit.o nltrans.o pn2acpn.o\ - pn2eacpn.o reduce.o supervis.o tactn.o liblpsolve55.a + issiph.o linenf.o matrixmath.o MemoryManager.o mroadm.o msplit.o nltrans.o\ + pn2acpn.o pn2eacpn.o reduce.o supervis.o tactn.o liblpsolve55.a actn.o: actn.c spnbox.h MemoryManager.h matrixmath.h ../pnheaders/general.h ../pnheaders/matrix.h $(COMPILER) -c actn.c @@ -68,6 +68,9 @@ MemoryManager.o: MemoryManager.c MemoryManager.h ../pnheaders/general.h ../pnheaders/matrix.h $(COMPILER) -c MemoryManager.c +mroadm.o: mroadm.c spnbox.h ../pnheaders/matrix.h ../pnheaders/general.h matrixmath.h + $(COMPILER) -c mroadm.c + msplit.o: msplit.c spnbox.h MemoryManager.h matrixmath.h ../pnheaders/general.h ../pnheaders/matrix.h $(COMPILER) -c msplit.c Modified: spnbox/deallocation.c =================================================================== --- spnbox/deallocation.c 2009-08-20 13:40:31 UTC (rev 226) +++ spnbox/deallocation.c 2009-08-21 15:06:30 UTC (rev 227) @@ -42,6 +42,11 @@ memset(data, 0, sizeof(ilpadm)); } +void DeallocateMroadm(mroadm_r* data) +{ + DeallocateIlpadm((ilpadm_r*) data); +} + void DeallocateLinenf(linenf_r *data) { FreeMatrixSafe(&data->Dfm); Modified: spnbox/dp.c =================================================================== --- spnbox/dp.c 2009-08-20 13:40:31 UTC (rev 226) +++ spnbox/dp.c 2009-08-21 15:06:30 UTC (rev 227) @@ -319,7 +319,7 @@ } free(d->TD); } - if (d->TDCount) free(d->TD); + if (d->TDCount) free(d->TDCount); DeallocateMatrix(&d->Dm); DeallocateMatrix(&d->Dp); DeallocateMatrix(&d->DI); Added: spnbox/mroadm.c =================================================================== --- spnbox/mroadm.c (rev 0) +++ spnbox/mroadm.c 2009-08-21 15:06:30 UTC (rev 227) @@ -0,0 +1,601 @@ +#include <stdlib.h> +#include "../pnheaders/general.h" +#include "../pnheaders/matrix.h" +#include "matrixmath.h" +#include "spnbox.h" + +typedef struct mroadm_d +{ + /*The matrices.*/ + matrix M, R1, R2, L, D; + /*The number of places and transitions in the original Petri net.*/ + int places, transitions; + /*The uncontrollable and unobservable transitions.*/ + int *Tuc, *Tuo; + int TucCount, TuoCount; + /*The initial marking.*/ + int* m0; + /*B*/ + int* B; + /*The list of constraints that need to be converted.*/ + int *conversionList; + int conversionCount; + /*The per-constraint status messages.*/ + char** dhow; +} mroadm_d; + +static int CheckParams(matrix* L, int* B, matrix* D, int** Tuc, int* TucCount, int** Tuo, int* TuoCount, int* m0); +static mroadm_d CreateData(matrix* L, int* B, matrix* D, int* Tuc, int TucCount, int* Tuo, int TuoCount, int *m0); +static int FindConstraintsToConvert(mroadm_d* d); +static void BuildM(mroadm_d* d); +static int educ(mroadm_d* d); +static void zduo(mroadm_d* d); +static void czero(mroadm_d* d, int row, int col); +static void subtest(mroadm_d* d); +static mroadm_r BuildSolution(mroadm_d* d); +void display(char* beginning, char* middle, char* end, int i, int p); + +mroadm_r mroadm(matrix* L, int* B, matrix* D, int* Tuc, int TucCount, int* Tuo, int TuoCount, int* m0) +{ + mroadm_r result; + memset(&result, 0, sizeof(mroadm_r)); + if (! CheckParams(L, B, D, &Tuc, &TucCount, &Tuo, &TuoCount, m0)) return result; + + if (! NumberOfRows(*L)) + { + result.how = HOW_OK; + display("Empty set of constraints!", "", "", 1, 1); + return result; + } + if (! NumberOfRows(*D)) + { + result.how = HOW_OK; + result.ba = tcalloc(NumberOfRows(*L), sizeof(int)); + memcpy(result.ba, B, NumberOfRows(*L) * sizeof(int)); + AllocateMatrixType(2, &result.La, NumberOfRows(*L), NumberOfColumns(*L)); + CopyMatrix(L, &result.La); + return result; + } + + mroadm_d data = CreateData(L, B, D, Tuc, TucCount, Tuo, TuoCount, m0); + + /*Get the list of constraints that need to be converted and convert them.*/ + if (FindConstraintsToConvert(&data)) + { + BuildM(&data); + if (educ(&data)) + { + zduo(&data); + } + subtest(&data); + + /*Reduce the constraint-related rows of M. We'll need a copy of the last part + of a row of M, the part that was originally an identity. Allocate space for + it now.*/ + matrix mrow; + AllocateMatrixType(1, &mrow, 1, NumberOfColumns(data.M) - data.TucCount - data.TuoCount - 1); + int i, j; + for (i = 0; i < data.conversionCount; i++) + { + CopyBlock(1, NumberOfColumns(data.M) - data.TucCount - data.TuoCount - 1, &data.M, i + data.places, data.TucCount + data.TuoCount + 1, &mrow, 0, 0); + int d = gcdv(&mrow, -1, -1); + for (j = 0; j < NumberOfColumns(data.M); j++) + { + SetMatrixEl(&data.M, i + data.places, j, GetMatrixEl(&data.M, i + data.places, j) / d); + } + } + DeallocateMatrix(&mrow); + + /*The constraint-related parts of M now become parts of the transformation + matrices.*/ + for (i = 0; i < data.conversionCount; i++) + { + CopyBlock(1, NumberOfColumns(data.R1), &data.M, i + data.places, data.TucCount + data.TuoCount + 1, &data.R1, data.conversionList[i], 0); + SetMatrixEl(&data.R2, data.conversionList[i], data.conversionList[i], GetMatrixEl(&data.M, data.places + i, data.TucCount + data.TuoCount + data.places + i + 1)); + } + } + /*Get rid of intermediate variables.*/ + DeallocateMatrix(&data.M); + free(data.conversionList); + + /*Cleanup output.*/ + if (is_verbose() >= VRB_MROADM) + { + printf("\n"); + } + + /*Build the solution.*/ + return BuildSolution(&data); +} + +/******************************************************************************* +CheckParams checks to make sure the parameters are valid. Returns a logical +value, nonzero for valid and zero for invalid.*/ +int CheckParams(matrix* L, int* B, matrix* D, int** Tuc, int* TucCount, int** Tuo, int* TuoCount, int* m0) +{ + /*D, L, and B are all required.*/ + if (! (D && L)) + { + merror(0, "MROADM: A required pointer was null!"); + return 0; + } + /*The constraint matrix must have as many columns as there are places.*/ + if (NumberOfColumns(*L) != NumberOfRows(*D)) + { + merror(0, "MROADM: The dimensions of the constraint and incidence matrices are inconsistent"); + return 0; + } + /*Make sure that null pointers and counters at zero agree.*/ + if (! *Tuc) *TucCount = 0; + else if (! *TucCount) *Tuc = 0; + if (! *Tuo) *TuoCount = 0; + else if (! *TuoCount) *Tuo = 0; + return 1; +} + +/******************************************************************************* +CreateData creates the initial parts of the mroadm_d data structure, which holds +information about the problem and is passed to various subroutines of the +problem. CreateData allocates space for some of the matrices and sets various +counters.*/ +mroadm_d CreateData(matrix* L, int* B, matrix* D, int* Tuc, int TucCount, int* Tuo, int TuoCount, int *m0) +{ + mroadm_d data; + memset(&data, 0, sizeof(mroadm_d)); + + data.places = NumberOfRows(*D); + data.transitions = NumberOfColumns(*D); + data.TucCount = TucCount; + data.Tuc = Tuc; + data.TuoCount = TuoCount; + data.Tuo = Tuo; + data.L = *L; + data.D = *D; + data.B = B; + data.m0 = m0; + + /*R1 will have as many rows as there are constraints and columns as there are + places.*/ + AllocateMatrixType(2, &data.R1, NumberOfRows(*L), data.places); + /*R2 defaults to an identity with as many rows and columns as there are + constraints. Setup the per-constraint status messages to default to OK while + we're in the loop.*/ + AllocateMatrixType(2, &data.R2, NumberOfRows(*L), NumberOfRows(*L)); + data.dhow = tcalloc(NumberOfRows(*L), sizeof(char*)); + int i; + for (i = 0; i < NumberOfRows(*L); i++) + { + SetMatrixEl(&data.R2, i, i, 1); + data.dhow[i] = HOW_OK; + } + return data; +} + +/******************************************************************************* +FindConstraintsToConvert fills in the list of which constraints need to be +converted. It returns the number of constraints that need to be converted.*/ +int FindConstraintsToConvert(mroadm_d* d) +{ + /*Allocate space for the list of constraints that need to be converted.*/ + d->conversionList = tcalloc(NumberOfRows(d->L), sizeof(int)); + + /*Iterate through constraints.*/ + int i, j, ucFlag, uoFlag, feasible; + for (i = 0; i < NumberOfRows(d->L); i++) + { + /*If m0 has been provided, make sure the constraint works with it.*/ + feasible = 1; + if (d->m0) + { + if (MultiplyVector(&d->L, (matrix*) d->m0, i, MULTIPLYVECTOR_ARRAY, 0) > (d->B ? d->B[i] : 0)) + { + feasible = 0; + } + } + /*Make sure there exist no uncontrollable transitions such that the current + constraint row times the incidence column is greater than 0.*/ + ucFlag = 1; + for (j = 0; j < d->TucCount; j++) + { + if (MultiplyVector(&d->L, &d->D, i, d->Tuc[j], 0) > 0) + { + ucFlag = 0; + break; + } + } + /*Make sure there exist no unobservable transitions such that the current + constraint row times the incidence column is nonzero.*/ + uoFlag = 1; + for (j = 0; j < d->TuoCount; j++) + { + if (MultiplyVector(&d->L, &d->D, i, d->Tuo[j], 0)) + { + uoFlag = 0; + break; + } + } + + if (! feasible) + { + d->dhow[i] = HOW_INFEASIBLE; + display("The transformation is infeasible due to the unitial marking","",".",i,NumberOfRows(d->L)); + } + else if (ucFlag && uoFlag) + { + d->dhow[i] = HOW_OK; + display("No transformation is necessary","",".",i,NumberOfRows(d->L)); + } + else + { + /*Transformation is necessary.*/ + d->conversionList[d->conversionCount++] = i; + } + } + return d->conversionCount; +} + +/******************************************************************************* +BuildM fills in the matrix M, which is used for processing by the mroadm +algorithm.*/ +void BuildM(mroadm_d* d) +{ + /*Build M. In matlab: + Lz = L(conversionList,:) + mm = [m0; Lz * m0 - b(conversionList) - ones(conversionCount,1)] + M = [[Duc, Duo, Lz*Duc, Lz*Duo] mm eye(places + conversionCount)] + Allocate space.*/ + AllocateMatrixType(2, &d->M, d->places + d->conversionCount, d->TucCount + d->TuoCount + 1 + d->places + d->conversionCount); + /*Copy in [Duc; Lz*Duc]*/ + int i, j; + for (i = 0; i < d->TucCount; i++) + { + CopyBlock(d->places, 1, &d->D, 0, d->Tuc[i], &d->M, 0, i); + for (j = 0; j < d->conversionCount; j++) + { + SetMatrixEl(&d->M, d->places + j, i, MultiplyVector(&d->L, &d->D, d->conversionList[j], d->Tuc[i], 0)); + } + } + for (i = 0; i < d->TuoCount; i++) + { + CopyBlock(d->places, 1, &d->D, 0, d->Tuo[i], &d->M, 0, i + d->TucCount); + for (j = 0; j < d->conversionCount; j++) + { + SetMatrixEl(&d->M, d->places + j, i + d->TucCount, MultiplyVector(&d->L, &d->D, d->conversionList[j], d->Tuo[i], 0)); + } + } + /*Build mm*/ + if (d->m0) + { + for (i = 0; i < d->places; i++) + { + SetMatrixEl(&d->M, i, d->TucCount + d->TuoCount, d->m0[i]); + } + for (i = 0; i < d->conversionCount; i++) + { + SetMatrixEl(&d->M, d->places + i, d->TucCount + d->TuoCount, + MultiplyVector(&d->L, (matrix*) d->m0, d->conversionList[i], + MULTIPLYVECTOR_ARRAY, 0) - (d->B ? d->B[d->conversionList[i]] - 1 : 0)); + } + } + else + { + for (i = 0; i < d->conversionCount; i++) + { + SetMatrixEl(&d->M, d->places + i, d->TucCount + d->TuoCount, -1); + } + } + /*Fill in the identity.*/ + for (i = 0; i < d->places + d->conversionCount; i++) + { + SetMatrixEl(&d->M, i, d->TucCount + d->TuoCount + 1 + i, 1); + } +} + +/******************************************************************************* +educ eliminates positive elements from Duc.*/ +int educ(mroadm_d* d) +{ + int success = 1, i, j, upperlimit; + upperlimit = d->places; + /*At some point we are going to need to swap some rows of M. Allocate a + matrix to hold intermediate values.*/ + matrix mrow; + AllocateMatrixType(1, &mrow, 1, NumberOfColumns(d->M)); + for (i = 0; i < upperlimit; i++) + { + /*See if there are any elements below the main diagonal less than 0.*/ + for (j = i; j < d->places; j++) + { + if (GetMatrixEl(&d->M, j, i) < 0) break; + } + if (j < d->places) + { + if (j != i) + { + /*Swap rows*/ + CopyBlock(1, NumberOfColumns(d->M), &d->M, i, 0, &mrow, 0, 0); + CopyBlock(1, NumberOfColumns(d->M), &d->M, j, 0, &d->M, i, 0); + CopyBlock(1, NumberOfColumns(d->M), &mrow, 0, 0, &d->M, j, 0); + } + czero(d, i, i); + } + else + { + /*Find out if there exist any elements of M with certain characteristics. + First, any elements in the constraint-related rows of M and in the current + column such that they are greater than 0, and second, any elements in the + same rows and in the mm column that are greater than or equal to 0?*/ + for (j = d->places; j < d->places + d->conversionCount; j++) + { + if (GetMatrixEl(&d->M, j, i) > 0) break; + if (GetMatrixEl(&d->M, j, d->TucCount + d->TuoCount)) break; + } + if (j < d->places + d->conversionCount) + { + success = 0; + break; + } + } + } + /*If we have not already failed, check another failure condition: Are there + any elements in the constraint-related rows of M and the uncontrollable- + transition columns that are greater than 0?*/ + if (success) + { + for (i = d->places; i < d->places + d->conversionCount; i++) + { + for (j = 0; j < d->TucCount; j++) + { + if (GetMatrixEl(&d->M, i, j) > 0) break; + } + if (j < d->TucCount) break; + } + if (i < d->places + d->conversionCount) success = 0; + } + DeallocateMatrix(&mrow); + return success; +} + +/******************************************************************************* +zduo performs the operations relevant to zeroing elements of Duo.*/ +void zduo(mroadm_d* d) +{ + int success = 1, i, j, k, upperlimit; + upperlimit = d->places; + /*At some point we are going to need to swap some rows of M. Allocate a + matrix to hold intermediate values.*/ + matrix mrow; + AllocateMatrixType(1, &mrow, 1, NumberOfColumns(d->M)); + for (i = 0; i < upperlimit; i++) + { + /*See if there are any elements below the main diagonal less than 0.*/ + for (k = i; k < d->places; k++) + { + if (GetMatrixEl(&d->M, k, i) < 0) break; + } + if (k < d->places && k != i) + { + /*Swap rows*/ + CopyBlock(1, NumberOfColumns(d->M), &d->M, i, 0, &mrow, 0, 0); + CopyBlock(1, NumberOfColumns(d->M), &d->M, k, 0, &d->M, i, 0); + CopyBlock(1, NumberOfColumns(d->M), &mrow, 0, 0, &d->M, k, 0); + } + if (k < d->places) + { + k = 1; + } + else + { + k = 0; + } + /*See if there are any elements below the main diagonal greater than 0.*/ + for (j = i; j < d->places; j++) + { + if (GetMatrixEl(&d->M, j, i) > 0) break; + } + if (j < d->places) + { + if (j != i) + { + /*Swap rows*/ + CopyBlock(1, NumberOfColumns(d->M), &d->M, i + k, 0, &mrow, 0, 0); + CopyBlock(1, NumberOfColumns(d->M), &d->M, j, 0, &d->M, i + k, 0); + CopyBlock(1, NumberOfColumns(d->M), &mrow, 0, 0, &d->M, j, 0); + } + czero(d, i + k, i); + } + if (k) + { + czero(d, i, i); + } + /*Find out if there exist any elements of M with certain characteristics. + First, any elements in the constraint-related rows of M and in the current + column such that they are greater than 0, and second, any elements in the + same rows and in the mm column that are greater than or equal to 0? + If there are, fail.*/ + for (j = d->places; j < d->places + d->conversionCount; j++) + { + if (GetMatrixEl(&d->M, j, i) > 0) break; + if (GetMatrixEl(&d->M, j, d->TucCount + d->TuoCount)) break; + } + if (j < d->places + d->conversionCount) + { + success = 0; + break; + } + } + DeallocateMatrix(&mrow); +} + +/******************************************************************************* +czero performs the operations related to column zeroing.*/ +void czero(mroadm_d* d, int row, int col) +{ + /*Iterate through the places corresponding to the second group of rows in M + (the ones related to constraints to be converted)*/ + int i, j, x, a, b; + + for (i = d->places; i < d->places + d->conversionCount; i++) + { + /*Get the two places of interest.*/ + /*If the places are of opposite sign, do the processing.*/ + if (GetMatrixEl(&d->M, i, col) * GetMatrixEl(&d->M, row, col) < 0) + { + /*Reduce the row (sort of)*/ + a = GetMatrixEl(&d->M, i, col); + b = GetMatrixEl(&d->M, row, col); + int c = gcdv(0, a, b); + for (j = 0; j < NumberOfColumns(d->M); j++) + { + x = GetMatrixEl(&d->M, i, j) * abs(b) / c; + x += GetMatrixEl(&d->M, row, j) * abs(a) / c; + SetMatrixEl(&d->M, i, j, x); + } + } + } + /*Now iterate through places from the one given as a parameter.*/ + for (i = row; i < row + d->places; i++) + { + /*Process if the places are of opposite sign.*/ + if (GetMatrixEl(&d->M, i, col) * GetMatrixEl(&d->M, row, col) < 0) + { + while (GetMatrixEl(&d->M, i, col)) + { + a = GetMatrixEl(&d->M, i, col); + b = GetMatrixEl(&d->M, row, col); + if (abs(b) > abs(a)) + { + int c = (-b / a) - (! (b % a)); + for (j = 0; j < NumberOfColumns(d->M); j++) + { + x = GetMatrixEl(&d->M, row, j) + c * GetMatrixEl(&d->M, i, j); + SetMatrixEl(&d->M, row, j, x); + } + } + else + { + int c = -a / b; + for (j = 0; j < NumberOfColumns(d->M); j++) + { + x = GetMatrixEl(&d->M, i, j) + c * GetMatrixEl(&d->M, row, j); + SetMatrixEl(&d->M, i, j, x); + } + } + } + } + } +} + +/******************************************************************************* +subtest runs a series of tests on the constraint set based on the contents of M +and modifies the per-constraint status messages as appropriate.*/ +void subtest(mroadm_d* d) +{ + int i, j, flag; + /*Iterate through the places to transform.*/ + for (i = 0; i < d->conversionCount; i++) + { + /*According to the Matlab comments, this tests the marking.*/ + if (GetMatrixEl(&d->M, d->places + i, d->TucCount + d->TuoCount)) flag = 1; + /*Test to see if there are any elements in constraint*Duc > 0.*/ + flag = 0; + for (j = 0; j < d->TucCount && ! flag; j++) + { + if (GetMatrixEl(&d->M, d->places + i, j) > 0) + { + flag = 1; + } + } + /*Test to see if there are any elements in constraint*Duo != 0.*/ + for (j = 0; j < d->TuoCount && ! flag; j++) + { + if (GetMatrixEl(&d->M, d->places + i, d->TucCount + j)) + { + flag = 1; + } + } + if (flag) + { + d->dhow[d->conversionList[i]] = HOW_NOTSOLVED; + } + else + { + d->dhow[d->conversionList[i]] = HOW_OK; + } + } +} + +/******************************************************************************* +BuildSolution builds a final solution given the data from the problem.*/ +mroadm_r BuildSolution(mroadm_d* d) +{ + mroadm_r res; + memset(&res, 0, sizeof(mroadm_r)); + + res.dhow = d->dhow; + /*The overall status message.*/ + int i, j, k; + res.how = HOW_OK; + for (i = 0; i < NumberOfRows(d->L); i++) + { + if (! strcmp(d->dhow[i], HOW_NOTSOLVED)) + { + res.how = HOW_NOTSOLVED; + } + if (! strcmp(d->dhow[i], HOW_INFEASIBLE)) + { + res.how = HOW_IMPOSSIBLE; + break; + } + } + /*R1 and R2.*/ + res.R1 = d->R1; + res.R2 = d->R2; + /*La*/ + /*Do the multiplication. This can be simplified by the fact that R2 is a + diagonal matrix.*/ + matrix R2L; + AllocateMatrixType(2, &R2L, NumberOfRows(d->R2), NumberOfColumns(d->L)); + for (i = 0; i < NumberOfRows(R2L); i++) + { + for (j = 0; j < NumberOfColumns(R2L); j++) + { + k = GetMatrixEl(&d->R2, i, i) * GetMatrixEl(&d->L, i, j); + SetMatrixEl(&R2L, i, j, k); + } + } + /*Do the addition.*/ + res.La = AddMatrix(&d->R1, &R2L, (matrix*) 2); + DeallocateMatrix(&R2L); + /*Build the new B.*/ + res.ba = tcalloc(NumberOfRows(res.La), sizeof(int)); + for (i = 0; i < NumberOfRows(res.La); i++) + { + res.ba[i] = (GetMatrixEl(&d->R2, i, i) * (d->B ? d->B[i] + 1 : 1)) - 1; + } + return res; +} + +/******************************************************************************* +display does some display (if the verbosity threshold is high enough)*/ +void display(char* beginning, char* middle, char* end, int i, int p) +{ + if (is_verbose() >= VRB_MROADM) + { + if (p <= 1) + { + printf("MROADM: %s%s%s\n", beginning, middle, end); + } + else + { + printf("MROADM, constraint %d: %s%s%s\n", i, beginning, middle, end); + } + } +} + +/******************************************************************************* +Finds the absolute value of a number.*/ +int abs(int a) +{ + return (a < 0) ? -a : a; +} Modified: spnbox/spnbox.h =================================================================== --- spnbox/spnbox.h 2009-08-20 13:40:31 UTC (rev 226) +++ spnbox/spnbox.h 2009-08-21 15:06:30 UTC (rev 227) @@ -32,6 +32,9 @@ //may be deallocated, but the individual messages should not be. } ilpadm_r; +/*The type returned by mroadm is identical to the type returned by ilpadm.*/ +typedef ilpadm_r mroadm_r; + typedef struct linenf_r {/*The values returned from linenf*/ matrix Dfm; //The modified Petri net output matrix @@ -206,6 +209,7 @@ void DeallocateIpslv(ipslv_r *data); void DeallocateIpsolve(ipsolve_r *data); void DeallocateIlpadm(ilpadm_r *data); +void DeallocateMroadm(mroadm_r *data); void DeallocateLinenf(linenf_r *data); void DeallocateMsplit(msplit_r *data); void DeallocateNltrans(nltrans_r *data); @@ -238,8 +242,9 @@ various spnbox functions will print output.*/ #define VRB_CHKCONS 4 #define VRB_REDUCE 3 -#define VRB_DP 2 +#define VRB_DP 1 #define VRB_ILPADM 2 +#define VRB_MROADM 2 #define VRB_ASIPH 3 #define VRB_MAX 10 @@ -293,7 +298,7 @@ array, respectively. Same as dpl in Matlab. See ipl, ipCount for defaults. Written for Matlab by Marian V. Iordache, mar...@le.... -Converted to C by Marian V. Iordache and Stephen Camp, ste...@le....*/ +Converted to C by Stephen Camp, ste...@le....*/ ilpadm_r ilpadm(matrix* L, int* b, matrix* D, int TucCount, int* Tuc, int TuoCount, int* Tuo, int* m0); /*ILP_ADM - transformation to admissible constraints based on linear integer programming @@ -334,8 +339,40 @@ program-wide verbosity level. Written for Matlab by Marian V. Iordache, mar...@le.... -Converted to C by Marian V. Iordache and Stephen Camp, ste...@le....*/ +Converted to C by Stephen Camp, ste...@le....*/ +mroadm_r mroadm(matrix* L, int* B, matrix* D, int* Tuc, int TucCount, int* Tuo, int TuoCount, int* m0); +/* +MRO_ADM - transformation to admissible constraints based on matrix row + operations + +[La, ba, R1, R2, how, dhow] = mro_adm(L, b, D, Tuc, Tuo, m0, vrb) + +The function transforms a marking constraint L*places <= b to an admissible +marking constraint (R1 + R2*L)*places <= R2*(b+1). If the transformation is +possible for the given initial marking, 'ok' is returned in a variable +how; else 'impossible' is returned; similarly, dhow{i} is 'ok' if the +transformation of the constraint i of Lm <= b was possible. + +D - the incidence matrix +Tuc - the uncontrollable transitions (e.g. for Tuc = [2, 5], the second and + the fifth columns of D correspond to uncontrollable transitions +Tuo - the unobservable transitions +m0 - the initial marking +vrb - use vrb = 0 to suppress messages. Default is vrb = 1. + +Use m0 = [] or only the first five arguments if the initial marking is +not of interest. +Usage in C: +mroadm_r mroadm(matrix* L, int* B, matrix* D, int* Tuc, int TucCount, int* Tuo, +int TuoCount, int* m0); +The parameters have the same meaning as in Matlab with the same notes and +exceptions as for ilpadm. + +Written for Matlab by Marian V. Iordache, mar...@le... +Converted to C by Stephen Camp, ste...@le... +*/ + supervis_r supervis(matrix* PlantIn, matrix* PlantOut, matrix* L); /* supervis_r supervis(const matrix PlantIn, const matrix PlantOut, const matrix L) @@ -351,7 +388,7 @@ This is the approach in the papers by Moody and Yamalidou. Written for Matlab by Marian V. Iordache, mar...@le... - Converted to C by Marian V. Iordache & Stephen Camp, ste...@le... + Converted to C by Stephen Camp, ste...@le... */ ipsolve_r ipsolve(matrix* L, double* B, double* f, short int *IntList, double *ub, double *lb, short int *ctype); @@ -389,7 +426,7 @@ This interface to the LP_SOLVE package has been written by Marian V. Iordache, mar...@le.... -It was converted to C by Marian V. Iordache and Stephen Camp, ste...@le....*/ +It was converted to C by Stephen Camp, ste...@le....*/ /*Most complete C syntax (all optional parameters included): ipsolve_r ipsolve(int numberOfArguments, matrix *L, double *B, double *f, short *IntList, double *ub, double *lb, short *ctype) All parameters after the first three are optional.*/ @@ -458,7 +495,7 @@ ms0 = bf - Lf*m0 - Cf*v0 Written by Marian V. Iordache, mar...@le... -Converted to C by Marian V. Iordache and Stephen Camp, ste...@le...*/ +Converted to C by Stephen Camp, ste...@le...*/ int* isadm(matrix* Dm, matrix* Dp, matrix* L, int* b, int* m0, matrix* F, matrix* C, int TucCount, int* Tuc, int TuoCount, int* Tuo); /* @@ -513,7 +550,7 @@ See LINENF and PNCGRAPH. Written for Matlab by Marian V. Iordache, mar...@le.... -Converted to C by Marian V. Iordache and Stephen Camp, ste...@le.... +Converted to C by Stephen Camp, ste...@le.... */ nltrans_r nltrans(matrix* D, int* UnraisableTransitions, int urtCount); @@ -540,7 +577,7 @@ of elements in the array. Written by Marian V. Iordache, mar...@le.... -Converted to C by Marian V. Iordache and Stephen Camp, ste...@le... +Converted to C by Stephen Camp, ste...@le... */ pn2acpn_r pn2acpn(matrix* Dm, matrix* Dp, int* Mask, matrix* MX, matrix* L0, matrix* L, int *ipl, int ipCount, int* dpl, int dpCount); @@ -580,7 +617,7 @@ M. Iordache -- Sep. 4, 2000 revised on Oct. 24, 2001 -Converted to C by Marian V. Iordache and Stephen Camp, ste...@le... +Converted to C by Stephen Camp, ste...@le... Stephen Camp -- Jun. 18, 2009 */ @@ -631,7 +668,7 @@ This is the extension for extended asymmetric choice nets; M. Iordache, July 2003 -Converted to C by M. Iordache and Stephen Camp, Ste...@le.... +Converted to C by Stephen Camp, Ste...@le.... Matlab code was under construction at time of conversion to C. Stephen Camp, June 2009 */ @@ -666,7 +703,7 @@ The C implementation may be changed to implement the newer CHK_CON.M sometime in the future. Written by Marian V. Iordache, mar...@le.... -Converted to C by Marian Iordache and Stephen Camp, ste...@le.... +Converted to C by Stephen Camp, ste...@le.... */ reduce_r reduce(matrix* L0, int* B0); @@ -686,7 +723,7 @@ L0 and B0 are L and B, respectively, from the Matlab version. Written for Matlab by Marian V. Iordache, mar...@le.... -Converted to C by Marian Iordache and Stephen Camp, ste...@le.... +Converted to C by Stephen Camp, ste...@le.... */ actn_r actn(matrix* Dm, matrix* Dp, int* X, int XCount, matrix *Dcm, matrix *Dcp, int update, int checkUnique); @@ -727,7 +764,7 @@ structure will be set to 0 regardless of the actual state of the result. Written for Matlab by Marian V. Iordache, mar...@le.... -Converted to C by Marian Iordache and Stephen Camp, ste...@le.... +Converted to C by Stephen Camp, ste...@le.... */ tactn_r tactn(matrix* Dm, matrix* Dp, int* IncludeT, int IncludeTCount, int* ExcludeT, int ExcludeTCount, matrix *Dcm, matrix *Dcp, int checkUnique); @@ -801,7 +838,7 @@ Marian V. Iordache, Sep. 5, 2000. Revised on Oct. 24, 2001, and enhanced in February 2002. -Converted to C by Marian V. Iordache and Stephen Camp, ste...@le.... +Converted to C by Stephen Camp, ste...@le.... */ issiph_r issiph(matrix *Dm, matrix *Dp, void *PlaceSet, int MultiplePlaceSets); @@ -827,7 +864,7 @@ to an integer array, where each integer is a flag as described above. Written for Matlab by Marian V. Iordache, mar...@le.... -Converted to C by Marian V. Iordache and Stephen Camp, ste...@le.... +Converted to C by Stephen Camp, ste...@le.... */ asiph_r asiph(matrix *Dm, matrix *Dp, int* list, int listCount, matrix *PS, matrix *Dma, matrix *Dpa); @@ -865,7 +902,7 @@ See also MSIPH, SIPH2, MINSIPH Written for Matlab by Marian V. Iordache, mar...@le... -Converted to C by Marian V. Iordache and Stephen Camp, ste...@le... +Converted to C by Stephen Camp, ste...@le... lst feature is not yet fully implemented! (the case when a source place appears in the list has not been considered). @@ -931,7 +968,7 @@ how - is set to 0 if no admissible constraint could be found. Written for Matlab by Marian V. Iordache, mar...@le.... -Converted to C by Marian V. Iordache and Stephen Camp, ste...@le.... +Converted to C by Stephen Camp, ste...@le.... C Usage: The admcon function takes a pointer to a structure of type admcon_p, which @@ -973,7 +1010,7 @@ [str] = avpr(x,var,1) Written for Matlab by Marian V. Iordache, mar...@le.... -Converted to C by Marian V. Iordache and Stephen Camp, ste...@le.... +Converted to C by Stephen Camp, ste...@le.... C Usage: Parameters have the same meaning and names as in Matlab. If chr is a null pointer it will default to m, as in Matlab. @@ -996,7 +1033,7 @@ [str] = fvpr(x,2) Written for Matlab by Marian V. Iordache, mar...@le.... -Converted to C by Marian V. Iordache and Stephen Camp, ste...@le.... +Converted to C by Stephen Camp, ste...@le.... C Usage: Parameters have the same meaning and names as in Matlab. Use mode = DISPLAY_MATRIX for vector a pointer to a matrix. length is ignored. Use mode = DISPLAY_INTS for vector a pointer to an array of integers. @@ -1087,7 +1124,7 @@ their column number in the incidence matrix. Written for Matlab by Marian V. Iordache, mar...@le... -Converted to C by Marian V. Iordache and Stephen Camp, ste...@le... +Converted to C by Stephen Camp, ste...@le... Marian V. Iordache, March 1999 @@ -1148,8 +1185,7 @@ only parameter and returns the solution matrix. Since the pntool matrix type does not support non-integer matrices, nothing has been implemented to deal with them. -Converted from Matlab to C by Marian V. Iordache, mar...@le..., and -Stephen Camp, ste...@le.... +Converted to C by Stephen Camp, ste...@le.... */ #endif Modified: spnbox/tests/Makefile =================================================================== --- spnbox/tests/Makefile 2009-08-20 13:40:31 UTC (rev 226) +++ spnbox/tests/Makefile 2009-08-21 15:06:30 UTC (rev 227) @@ -43,6 +43,7 @@ ADMCON=admcon.o $(EXTENDEDMATRIX) $(IPSOLVE) ASIPH=asiph.o $(ACTN) $(EXTENDEDMATRIX) ILPADM=ilpadm.o $(IPSOLVE) +MROADM=mroadm.o $(GCDV) LINENF=linenf.o $(ILPADM) NLTRANS=nltrans.o $(IPSOLVE) PN2EACPN=pn2eacpn.o $(NLTRANS) @@ -55,7 +56,7 @@ COMMONHEADER=../spnbox.h test.h ../../pnheaders/general.h ../../pnheaders/pns.h ../../pnheaders/matrix.h ../matrixmath.h ../MemoryManager.h StructuredIO.h #Targets -all: avpr dp dp4 extendedmatrix fvpr gcdv invar ipslv ipsolve isadm issiph msplit matrixmath pn2acpn supervis actn admcon asiph ilpadm linenf nltrans pn2eacpn reduce tactn +all: avpr dp dp4 extendedmatrix fvpr gcdv invar ipslv ipsolve isadm issiph msplit matrixmath pn2acpn supervis actn admcon asiph ilpadm mroadm linenf nltrans pn2eacpn reduce tactn avpr: test-avpr.o $(AVPR) $(COMMON) $(COMPILER) -o avpr.exe test-avpr.o $(AVPR) $(COMMON) extendedmatrix: test-extendedmatrix.o $(EXTENDEDMATRIX) $(COMMON) @@ -89,7 +90,9 @@ asiph: test-asiph.o $(COMMON) $(ASIPH) $(COMPILER) -o asiph.exe test-asiph.o $(COMMON) $(ASIPH) ilpadm: test-ilpadm.o $(COMMON) $(ILPADM) - $(COMPILER) -o ilpadm.exe test-ilpadm.o $(COMMON) $(ILPADM) + $(COMPILER) -o ilpadm.exe test-ilpadm.o $(COMMON) $(ILPADM) +mroadm: test-mroadm.o $(COMMON) $(MROADM) + $(COMPILER) -o mroadm.exe test-mroadm.o $(COMMON) $(MROADM) linenf: test-linenf.o $(COMMON) $(LINENF) $(COMPILER) -o linenf.exe test-linenf.o $(COMMON) $(LINENF) nltrans: test-nltrans.o $(COMMON) $(NLTRANS) @@ -152,6 +155,8 @@ $(MEMWCOMP) -c ../matrixmath.c MemoryManager.o: ../MemoryManager.h ../MemoryManager.c ../../pnheaders/general.h ../../pnheaders/matrix.h $(MEMWCOMP) -c ../MemoryManager.c +mroadm.o: ../mroadm.c ../spnbox.h ../../pnheaders/matrix.h ../../pnheaders/general.h ../matrixmath.h + $(MEMWCOMP) -c ../mroadm.c msplit.o: ../spnbox.h ../../pnheaders/matrix.h ../matrixmath.h ../MemoryManager.h ../msplit.c $(MEMWCOMP) -c ../msplit.c nltrans.o: ../nltrans.c ../spnbox.h ../../pnheaders/matrix.h ../matrixmath.h ../MemoryManager.h @@ -204,6 +209,8 @@ $(MEMWCOMP) -c test-linenf.c test-matrixmath.o: test-matrixmath.c $(COMMONHEADER) $(MEMWCOMP) -c test-matrixmath.c +test-mroadm.o: test-mroadm.c $(COMMONHEADER) + $(MEMWCOMP) -c test-mroadm.c test-msplit.o: test-msplit.c $(COMMONHEADER) $(MEMWCOMP) -c test-msplit.c test-nltrans.o: test-nltrans.c $(COMMONHEADER) Added: spnbox/tests/test-mroadm.c =================================================================== --- spnbox/tests/test-mroadm.c (rev 0) +++ spnbox/tests/test-mroadm.c 2009-08-21 15:06:30 UTC (rev 227) @@ -0,0 +1,60 @@ +#include "test.h" + +int main(int argc, char* argv[]) +{ + + /*all correct solutions will satisfy La*m0 <= ba, La*D(:, Tuc) <= 0, and La*D(:, Tuo) = 0. + Also, a correct solution will satisfy that for all nonnegative integer vectors m, if La*m <= ba, then L*m <= b.*/ + + char InDesc[] = "matrix D, indexarray Tuc, indexarray Tuo, matrix L, arrayi B, arrayi m0"; + char OutDesc[] = "string Message, matrix La, arrayi Ba"; + + mroadm_r answer; + matrix D, L; + int BCount, m0Count, TucCount, TuoCount; + int *B, *m0, *Tuc, *Tuo, *InFilled, OutFilled[3]; + FILE* input; + MemoryManager mem; + + mem = CreateMemoryManager(10, 10, 0, 0); + + /*Set the verbosity level to maximum*/ + setverbose(VRB_MAX); + + if (! (input = ParseCmdLine(argc, argv))) + { + return 0; + } + + while (ParseStructure(input, InDesc, &InFilled, &mem, &D, &Tuc, &TucCount, &Tuo, &TuoCount, &L, &B, &BCount, &m0, &m0Count)) + { + /*Display the problem.*/ + DisplayStructure(InDesc, InFilled, &D, Tuc, TucCount, InFilled[0] ? NumberOfColumns(D) : 0, Tuo, TuoCount, InFilled[0] ? NumberOfColumns(D) : 0, &L, B, BCount, m0, m0Count); + + /*Solve the problem.*/ + answer = mroadm(InFilled[3] ? &L : 0, InFilled[4] ? B : 0, InFilled[0] ? &D : 0, InFilled[1] ? Tuc : 0, TucCount, InFilled[2] ? Tuo : 0, TuoCount, InFilled[5] ? m0 : 0); + + OutFilled[0] = 1; + OutFilled[1] = 1; + if (answer.ba) + { + OutFilled[2] = 1; + } + else + { + OutFilled[2] = 0; + } + + /*Show the solution*/ + printf("\nSolution:\n"); + DisplayStructure(OutDesc, OutFilled, answer.how, &answer.La, answer.ba, NumberOfRows(answer.La)); + printf("--------------------------------------------------------------------------------\n"); + + /*Clear and re-initialize dynamic memory log and loop again.*/ + FreeMemory(&mem); + DeallocateIlpadm(&answer); + mem = CreateMemoryManager(10, 10, 0, 0); + } + FreeMemory(&mem); + return 0; +} Added: spnbox/tests/test-mroadm.txt =================================================================== --- spnbox/tests/test-mroadm.txt (rev 0) +++ spnbox/tests/test-mroadm.txt 2009-08-21 15:06:30 UTC (rev 227) @@ -0,0 +1,146 @@ +echo Example 1 +D 3 3 +-1 0 1 +1 -1 0 +0 1 -1 + +L 1 3 +0 0 1 + +B 1 1 + +m0 3 +3 0 0 + +Tuc 1 +1 + +done + +echo Example 2 +D 3 3 +-1 0 1 +1 -1 0 +0 1 -1 + +m0 3 +3 0 0 + +Tuc 1 +1 + +L 1 3 +0 0 1 + +B 1 1 + +done + +echo Example 3 +D 4 4 +-1 -1 0 1 +1 0 -1 0 +0 1 -1 0 +0 0 1 -1 + +m0 4 +3 0 0 0 +Tuc 1 +2 + +L 1 4 +0 0 0 1 + +B 1 1 +done + +echo Example 4 +D 4 4 +-1 0 0 1 +0 -1 0 2 +2 1 -2 0 +0 0 1 -2 + +m0 4 +1 2 0 2 + +L 1 4 +0 0 0 1 + +B 1 2 + +Tuc 1 2 + +done +echo Example 5 +D 3 3 +-1 1 0 +-1 0 1 +2 -1 -1 + +L 2 3 +-1 0 -1 +0 -1 -1 + +B 2 +-1 -1 + +Tuo 1 0 + +m0 3 +1 1 0 + +done + +echo Example 6 +echo This uses the data from Example 5 but supplies no initial marking. +D 3 3 +-1 1 0 +-1 0 1 +2 -1 -1 + +L 2 3 +-1 0 -1 +0 -1 -1 + +B 2 +-1 -1 + +Tuo 1 0 + +done + +echo Example 7 +echo This reuses the data from Example 2 but supplies no constraint vector. +D 3 3 +-1 0 1 +1 -1 0 +0 1 -1 + +m0 3 +3 0 0 + +Tuc 1 +1 + +L 1 3 +0 0 1 + +done + +echo Example 8 +echo This reuses the data from Example 2 but supplies neither constraint vector +echo nor initial marking. +D 3 3 +-1 0 1 +1 -1 0 +0 1 -1 + +Tuc 1 +1 + +L 1 3 +0 0 1 + +done +quit This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ste...@us...> - 2009-08-20 13:40:42
|
Revision: 226 http://pntool.svn.sourceforge.net/pntool/?rev=226&view=rev Author: StephenCamp Date: 2009-08-20 13:40:31 +0000 (Thu, 20 Aug 2009) Log Message: ----------- Changed the array allocation optimizing functions in MemoryManager to make the interface more consistent. Modified invar to use the new function definitions. Removed "ID", a debugging parameter, from Dp and Dp4 source and from the test routines. Modified Dp to use the MemoryGrower functions for its arrays which constantly change length. MemoryGrower uses large block allocations to minimize the number of times that new memory actually has to be allocated. Memwatch linking is ON in this test Makefile version. Modified Paths: -------------- spnbox/MemoryManager.c spnbox/MemoryManager.h spnbox/dp.c spnbox/dp4.c spnbox/invar.c spnbox/spnbox.h spnbox/tests/Makefile spnbox/tests/test-dp.c spnbox/tests/test-dp.txt Modified: spnbox/MemoryManager.c =================================================================== --- spnbox/MemoryManager.c 2009-08-19 15:49:09 UTC (rev 225) +++ spnbox/MemoryManager.c 2009-08-20 13:40:31 UTC (rev 226) @@ -127,64 +127,64 @@ return g; } -/*GetGrowableMemory gets some memory that can grow.*/ -void* GetGrowableMemory(MemoryGrower* g, int size) +void* growMalloc(MemoryGrower* g, void* memory, int size) { + /*If the pointer is null, allocate some new memory.*/ if (! g) { - merror(0, "GETGROWABLEMEMORY: Required parameter is null"); + merror(0, "MEMORYGROWER: The pointer to the grower is null"); return 0; - } - if (g->next == g->memories) - { - merror(0, "GETGROWABLEMEMORY: Too many pointers in memory"); - return 0; } - if (size < g->blocksize) size = g->blocksize; - g->memory[g->next] = tmalloc(size); - g->capacity[g->next] = size; - return g->memory[g->next++]; -} - -/*GrowMemory increases the capacity of the given piece of memory. Raises -a fatal error if the memory has not been registered with it.*/ -void* GrowMemory(MemoryGrower* g, void* memory, int newCapacity) -{ - if (! (g && memory)) + if (! memory) { - merror(0, "GROWMEMORY: Required pointer is null"); - return 0; + if (g->next == g->memories) + { + merror(0, "MEMORYGROWER: Too many pointers registered with the grower"); + return 0; + } + if (size < g->blocksize) size = g->blocksize; + g->memory[g->next] = tmalloc(size); + g->capacity[g->next] = size; + return g->memory[g->next++]; } - /*Find the memory.*/ - int i; - for (i = 0; i < g->next; i++) - { - if (memory == g->memory[i]) break; - } - if (i == g->next) - { - merror(0, "GROWMEMORY: The memory did not originate with the grower"); - return 0; - } - /*If we are still within the allocated capacity, return the memory - as-is.*/ - if (newCapacity <= g->capacity[i]) - { - return memory; - } - /*Otherwise, allocate some new memory.*/ else { - if (newCapacity < g->capacity[i] + g->blocksize) newCapacity = g->capacity[i] + g->blocksize; - void* newMem = tmalloc(newCapacity); - memcpy(newMem, memory, g->capacity[i]); - g->capacity[i] = newCapacity; - g->memory[i] = newMem; - free(memory); - return newMem; + /*Otherwise, find the index of the memory record.*/ + int i; + for (i = 0; i < g->next; i++) + { + if (memory == g->memory[i]) break; + } + if (i == g->next) + { + merror(0, "MEMORYGROWER: The memory did not originate with the grower"); + return 0; + } + /*If the request size is smaller than the current capacity return without + reallocating.*/ + if (size < g->capacity[i]) + { + return memory; + } + /*Otherwise, allocate as necessary.*/ + { + if (size < g->capacity[i] + g->blocksize) size = g->capacity[i] + g->blocksize; + void* newMem = tmalloc(size); + memcpy(newMem, memory, g->capacity[i]); + g->capacity[i] = size; + g->memory[i] = newMem; + free(memory); + return newMem; + } } } +void* growCalloc(MemoryGrower* g, void* memory, int elementSize, int elements) +{ + return growMalloc(g, memory, elementSize * elements); +} + + /*FreeMemoryGrower deallocates all the memories pointed to by a memory grower.*/ void FreeMemoryGrower(MemoryGrower* g) Modified: spnbox/MemoryManager.h =================================================================== --- spnbox/MemoryManager.h 2009-08-19 15:49:09 UTC (rev 225) +++ spnbox/MemoryManager.h 2009-08-20 13:40:31 UTC (rev 226) @@ -62,14 +62,13 @@ /*CreateMemoryGrower initializes a memory grower structure.*/ MemoryGrower CreateMemoryGrower(int pointers, int blocksize); -/*GetGrowableMemory gets some memory that can grow.*/ -void* GetGrowableMemory(MemoryGrower* g, int size); +/*growMalloc and growCalloc grow the specified piece of memory to the given +capacity. If the pointer to the memory is null, new memory is allocated. If the +pointer points to a piece of memory the memorygrower is not responsible for the +function fails.*/ +void* growMalloc(MemoryGrower* g, void* memory, int size); +void* growCalloc(MemoryGrower* g, void* memory, int elementSize, int elements); -/*GrowMemory increases the capacity of the given piece of memory. Raises -a fatal error if the memory has not been registered with the memory -grower.*/ -void* GrowMemory(MemoryGrower* g, void* memory, int newCapacity); - /*FreeMemoryGrower deallocates all the memories pointed to by a memory grower.*/ void FreeMemoryGrower(MemoryGrower* g); Modified: spnbox/dp.c =================================================================== --- spnbox/dp.c 2009-08-19 15:49:09 UTC (rev 225) +++ spnbox/dp.c 2009-08-20 13:40:31 UTC (rev 226) @@ -7,6 +7,7 @@ #include "matrixmath.h" #include "extendedmatrix.h" #include "spnbox.h" +#include "MemoryManager.h" typedef struct dpState { @@ -44,6 +45,9 @@ from use in subnet computation.*/ int *TA; /*Active transitions.*/ int *Tuc, *Tuo; /*Uncontrollable and unobservable transitions.*/ + /*The MemoryGrower is used to reduce the number of times we'll actually have + to reallocate the index arrays above to increase their length.*/ + MemoryGrower gmem; /*Counts of the list*/ int opCount, ipCount, dpCount, apCount, upCount, cpCount, ExcludeCount, IncludeCount, TACount, TucCount, TuoCount; @@ -69,7 +73,6 @@ int uci, upd, consis; //flags matrix TSIPH; //All siphons found during a run. matrix S; //New siphons found during a run. - int ID; } dpData; /*A set of marking constraints. The return type of UpdateMarkingConstraints, @@ -85,8 +88,8 @@ more information.*/ static int CheckParams(dp_p *p); static void Sort(int* array, int length); -static void AddToArray(int** array, int length, int item); -static void AddToIndexArray(int** array, int* length, int item); +static void AddToArray(int** array, int length, int item, MemoryGrower* gmem); +static void AddToIndexArray(int** array, int* length, int item, MemoryGrower* gmem); static void UpdateDPData(dpData *data, char* description, void *newData); static MarkingConstraints UpdateMarkingConstraints(dpData *d); static dpData CreateDpData(dp_p *p); @@ -111,7 +114,7 @@ static void FinalPrint(dpData* d); static void FreeDpParts(dpData* d); -dp_r dp(dp_p* params, int ID) +dp_r dp(dp_p* params) { dp_r result; int i, j, flag; @@ -124,7 +127,7 @@ /*Initialize the data structure.*/ dpData d = CreateDpData(params); - d.ID = ID; + /*Initial message printing.*/ if (is_verbose() >= VRB_DP) { @@ -183,9 +186,8 @@ EnforceMarkingConstraints(&d); /*Build the useful places list: include all places initially.*/ - if (d.upl) free(d.upl); d.upCount = NumberOfRows(d.Dm); - d.upl = tcalloc(d.upCount, sizeof(int)); + d.upl = growCalloc(&d.gmem, d.upl, d.upCount, sizeof(int)); for (i = 0; i < d.upCount; i++) { d.upl[i] = i; @@ -272,9 +274,17 @@ /*Build the result.*/ result.Lf = d.L; - result.Bf = d.B; + if (NumberOfRows(d.L)) + { + result.Bf = tcalloc(NumberOfRows(d.L), sizeof(int)); + memcpy(result.Bf, d.B, NumberOfRows(d.L) * sizeof(int)); + } result.L0f = d.L0; - result.B0f = d.B0; + if (NumberOfRows(d.L0)) + { + result.B0f = tcalloc(NumberOfRows(d.L0), sizeof(int)); + memcpy(result.B0f, d.B0, NumberOfRows(d.L0) * sizeof(int)); + } result.how = d.status; /*Do log printing and closeout.*/ @@ -309,25 +319,14 @@ } free(d->TD); } + if (d->TDCount) free(d->TD); DeallocateMatrix(&d->Dm); DeallocateMatrix(&d->Dp); DeallocateMatrix(&d->DI); DeallocateMatrix(&d->Dcm); DeallocateMatrix(&d->Dcp); DeallocateMatrix(&d->M); - free(d->G); - free(d->opl); - free(d->ipl); - free(d->dpl); - free(d->apl); - free(d->upl); - free(d->cpl); - free(d->ExcludeT); - free(d->IncludeT); - free(d->TA); - free(d->Tuc); - free(d->Tuo); - free(d->TDCount); + FreeMemoryGrower(&d->gmem); DeallocateMatrix(&d->TSIPH); /*S may not ever have been allocated if no new siphons were found.*/ if (d->S.type) DeallocateMatrix(&d->S); @@ -679,11 +678,10 @@ int siphon, i, j, k, b, x, flag, siphons; int* currentSiphon; /*Zero the (new) control place list.*/ - free(d->cpl); - d->cpl = 0; d->cpCount = 0; siphons = NumberOfColumns(d->S); - currentSiphon = tcalloc(NumberOfRows(d->S), sizeof(int)); + MemoryGrower siphonGrower = CreateMemoryGrower(1, NumberOfRows(d->S)); + currentSiphon = growCalloc(&siphonGrower, 0, NumberOfRows(d->S), sizeof(int)); /*Iterate through each new siphon.*/ for (siphon = 0; siphon < siphons; siphon++) @@ -752,7 +750,7 @@ /*We are checking constraints for consistency, not redundancy - add the proposed new constraint to the set of constraints. Use a copy so that the memory can be absorbed into L in an optimized operation.*/ - AddToArray(&cons.B, NumberOfRows(cons.L), b); + AddToArray(&cons.B, NumberOfRows(cons.L), b, 0); AllocateMatrixType(2, &l2, 1, NumberOfColumns(l)); CopyMatrix(&l, &l2); InsertRows(&cons.L, &l2, -1, -1); @@ -793,9 +791,9 @@ if (d->log) PrintConstraints(d, &l, b, currentSiphon, NumberOfRows(d->Dm), x); /*Add the new place index to the dependent place list, the useful places list, and the new control places list.*/ - AddToIndexArray(&d->dpl, &d->dpCount, NumberOfRows(supervisRes.Dfm) - 1); - AddToIndexArray(&d->upl, &d->upCount, NumberOfRows(supervisRes.Dfm) - 1); - AddToIndexArray(&d->cpl, &d->cpCount, NumberOfRows(supervisRes.Dfm) - 1); + AddToIndexArray(&d->dpl, &d->dpCount, NumberOfRows(supervisRes.Dfm) - 1, &d->gmem); + AddToIndexArray(&d->upl, &d->upCount, NumberOfRows(supervisRes.Dfm) - 1, &d->gmem); + AddToIndexArray(&d->cpl, &d->cpCount, NumberOfRows(supervisRes.Dfm) - 1, &d->gmem); /*Dm and Dp should be set to the supervised net Dfm and Dfp.*/ UpdateDPData(d, "Dm Dp", &supervisRes); memset(&supervisRes, 0, sizeof(supervis_r)); @@ -803,23 +801,20 @@ optimized row-adds and not do too many allocations.*/ AllocateMatrixType(2, &l2, 1, NumberOfColumns(l)); CopyMatrix(&l, &l2); - AddToArray(&d->B, NumberOfRows(d->L), b); - AddToArray(&d->G, NumberOfRows(d->L), b); + AddToArray(&d->B, NumberOfRows(d->L), b, &d->gmem); + AddToArray(&d->G, NumberOfRows(d->L), b, &d->gmem); InsertRows(&d->L, &l, -1, -1); InsertRows(&d->M, &l2, -1, -1); /*Add a null row to the end of S and allocate enough space for the new siphon array.*/ InsertNullRows(&d->S, -1, 1, -1); - int *newCSiphon = tcalloc(NumberOfRows(d->S), sizeof(int)); - memcpy(newCSiphon, currentSiphon, sizeof(int) * (NumberOfRows(d->S) - 1)); - free(currentSiphon); - currentSiphon = newCSiphon; + currentSiphon = growCalloc(&siphonGrower, currentSiphon, NumberOfRows(d->S), sizeof(int)); } else { /*Add the built constraint to the initial marking constraints.*/ if (d->log) PrintConstraints(d, &l, b, currentSiphon, 0, x); - AddToArray(&d->B0, NumberOfRows(d->L0), b); + AddToArray(&d->B0, NumberOfRows(d->L0), b, &d->gmem); InsertRows(&d->L0, &l, -1, -1); } } @@ -865,7 +860,7 @@ } } DeallocateMatrix(&a); - free(currentSiphon); + FreeMemoryGrower(&siphonGrower); } /******************************************************************************* @@ -938,11 +933,11 @@ /*Update the exclusion list. It should include all transitions which are inactive. We can build this list from the active transition list already computed.*/ - free(d->ExcludeT); - d->ExcludeCount = NumberOfColumns(d->Dm) - d->TACount; + + d->ExcludeCount = NumberOfColumns(d->Dm) - d->TACount; if (d->ExcludeCount) { - d->ExcludeT = tcalloc(d->ExcludeCount, sizeof(int)); + d->ExcludeT = growCalloc(&d->gmem, d->ExcludeT, d->ExcludeCount, sizeof(int)); j = 0; k = 0; for (i = 0; i < d->TACount; i++) @@ -983,10 +978,9 @@ if (d->ipl[i] >= d->targetRows) break; } /*i now contains the number of independent places that we want to use. - Update the total count and allocate memory.*/ - free(d->upl); + Update the total count and allocate memory.*/ d->upCount = i + d->dpCount; - d->upl = tcalloc(d->upCount, sizeof(int)); + d->upl = growCalloc(&d->gmem, d->upl, d->upCount, sizeof(int)); /*Fill in the independent places.*/ for (j = 0; j < i; j++) { @@ -1054,8 +1048,9 @@ admcon_p BuildAdmconParams(dpData* d, int* siphon) { /*We'll need an updated copy of the active place list. Build it now.*/ - int *newApl = tcalloc(NumberOfRows(d->Dcm), sizeof(int)); - int newApCount = 0, i, j; + d->apl = growCalloc(&d->gmem, d->apl, NumberOfRows(d->Dcm), sizeof(int)); + int i, j; + d->apCount = 0; for (i = 0; i < NumberOfRows(d->Dcm); i++) { for (j = 0; j < NumberOfColumns(d->Dcm); j++) @@ -1065,11 +1060,8 @@ break; } } - if (j != NumberOfColumns(d->Dcm)) newApl[newApCount++] = i; + if (j != NumberOfColumns(d->Dcm)) d->apl[d->apCount++] = i; } - free(d->apl); - d->apl = newApl; - d->apCount = newApCount; /*Transform the siphon row to an admissible constraint using admcon. Start by building the admcon call parameters:*/ @@ -1144,14 +1136,15 @@ } /*Now convert the flag array to an index list. Use the same memory; this is a waste of memory but avoids an allocation.*/ - free(d->ExcludeT); + d->ExcludeCount = k; - d->ExcludeT = ExcludeFlag; + d->ExcludeT = growCalloc(&d->gmem, d->ExcludeT, d->ExcludeCount, sizeof(int)); k = 0; for (i = 0; i < NumberOfColumns(d->Dm); i++) { - if (d->ExcludeT[i]) d->ExcludeT[k++] = i; + if (ExcludeFlag[i]) d->ExcludeT[k++] = i; } + free(ExcludeFlag); } /******************************************************************************* @@ -1239,9 +1232,9 @@ /*We'll needs lists of active transitions and places. TA will have just been updated before this function call. Update apl. To avoid having to iterate - through the whole matrix twice, preallocate newApl to its maximum possible + through the whole matrix twice, preallocate apl to its maximum possible size.*/ - int *newApl = tcalloc(NumberOfRows(d->Dcm), sizeof(int)); + d->apl = growCalloc(&d->gmem, d->apl, NumberOfRows(d->Dcm), sizeof(int)); int i, j; d->apCount = 0; for (i = 0; i < NumberOfRows(d->Dcm); i++) @@ -1250,13 +1243,11 @@ { if (GetMatrixEl(&d->Dcm, i, j) || GetMatrixEl(&d->Dcp, i, j)) { - newApl[d->apCount++] = i; + d->apl[d->apCount++] = i; break; } } } - free(d->apl); - d->apl = newApl; /*Build a list of places that will be considered for siphon computation. This is any place such that it is present in both the useful and the active place @@ -1448,7 +1439,7 @@ UpdateDPData(d, "Dm Dp", &supervisRes); /*Create the dependent place list.*/ d->dpCount = NumberOfRows(d->Dm) - d->targetRows; - d->dpl = tcalloc(d->dpCount, sizeof(int)); + d->dpl = growCalloc(&d->gmem, d->dpl, d->dpCount, sizeof(int)); int i; for (i = d->targetRows; i < NumberOfRows(d->Dm); i++) { @@ -1457,7 +1448,7 @@ /*Setup M = L, G = B. Optimize for row operations.*/ AllocateMatrixType(2, &d->M, NumberOfRows(d->L), NumberOfColumns(d->L)); CopyMatrix(&d->L, &d->M); - d->G = tcalloc(NumberOfRows(d->L), sizeof(int)); + d->G = growCalloc(&d->gmem, d->G, NumberOfRows(d->L), sizeof(int)); memcpy(d->G, d->B, NumberOfRows(d->L) * sizeof(int)); } } @@ -1644,14 +1635,12 @@ } if (p->B) { - free(d->B); - d->B = tcalloc(NumberOfRows(d->L), sizeof(int)); + d->B = growCalloc(&d->gmem, d->B, NumberOfRows(d->L), sizeof(int)); memcpy(d->B, p->B, NumberOfRows(d->L) * sizeof(int)); } if (p->B0) - { - free(d->B0); - d->B0 = tcalloc(NumberOfRows(d->L0), sizeof(int)); + { + d->B0 = growCalloc(&d->gmem, d->B0, NumberOfRows(d->L0), sizeof(int)); memcpy(d->B0, p->B0, NumberOfRows(d->L0) * sizeof(int)); } } @@ -1660,12 +1649,8 @@ d->opCount = d->targetRows; d->ipCount = d->targetRows; d->dpCount = 0; - if (d->opl) free(d->opl); - if (d->ipl) free(d->ipl); - if (d->dpl) free(d->dpl); - d->opl = tcalloc(d->opCount, sizeof(int)); - d->ipl = tcalloc(d->ipCount, sizeof(int)); - d->dpl = 0; + d->opl = growCalloc(&d->gmem, d->opl, d->opCount, sizeof(int)); + d->ipl = growCalloc(&d->gmem, d->ipl, d->ipCount, sizeof(int)); int i; for (i = 0; i < d->targetRows; i++) { @@ -1674,8 +1659,6 @@ } /*Empty G and M.*/ - if (d->G) free(d->G); - d->G = 0; if (d->M.type) DeallocateMatrix(&d->M); /*Initialize M to be the right size for an msplit.*/ @@ -1732,10 +1715,12 @@ } d.targetRows = NumberOfRows(p->Dm); d.targetCols = NumberOfColumns(p->Dm); + /*Initialize the memory grower that will be used with the index lists.*/ + d.gmem = CreateMemoryGrower(15, d.targetRows > d.targetCols ? d.targetRows : d.targetCols); /*Copy index lists (and fill in the corresponding flags).*/ if (p->Tuc && p->TucCount) { - d.Tuc = tcalloc(p->TucCount, sizeof(int)); + d.Tuc = growCalloc(&d.gmem, 0, p->TucCount, sizeof(int)); d.TucCount = p->TucCount; memcpy(d.Tuc, p->Tuc, sizeof(int) * p->TucCount); /*Make sure the index array is sorted. This will allow us to speed up @@ -1744,7 +1729,7 @@ } if (p->Tuo && p->TuoCount) { - d.Tuo = tcalloc(p->TuoCount, sizeof(int)); + d.Tuo = growCalloc(&d.gmem, 0, p->TuoCount, sizeof(int)); d.TuoCount = p->TuoCount; memcpy(d.Tuo, p->Tuo, sizeof(int) * p->TuoCount); /*Make sure the index array is sorted. This will allow us to speed up @@ -1753,7 +1738,7 @@ } if (p->ExcludeT && p->ExcludeCount) { - d.ExcludeT = tcalloc(p->ExcludeCount, sizeof(int)); + d.ExcludeT = growCalloc(&d.gmem, 0, p->ExcludeCount, sizeof(int)); d.ExcludeCount = p->ExcludeCount; memcpy(d.ExcludeT, p->ExcludeT, sizeof(int) * p->ExcludeCount); /*Make sure the index array is sorted. This will allow us to speed up @@ -1762,7 +1747,7 @@ } if (p->IncludeT && p->IncludeCount) { - d.IncludeT = tcalloc(p->IncludeCount, sizeof(int)); + d.IncludeT = growCalloc(&d.gmem, 0, p->IncludeCount, sizeof(int)); d.IncludeCount = p->IncludeCount; memcpy(d.IncludeT, p->IncludeT, sizeof(int) * p->IncludeCount); /*Make sure the index array is sorted. This will allow us to speed up @@ -1772,7 +1757,7 @@ else { /*If IncludeT is not present, it defaults to including all transitions.*/ - d.IncludeT = tcalloc(d.targetCols, sizeof(int)); + d.IncludeT = growCalloc(&d.gmem, 0, d.targetCols, sizeof(int)); d.IncludeCount = d.targetCols; for (i = 0; i < d.targetCols; i++) { @@ -1781,13 +1766,13 @@ } /*Copy the constraint vectors*/ if (p->B) - { - d.B = tcalloc(NumberOfRows(d.L), sizeof(int)); + { + d.B = growCalloc(&d.gmem, 0, NumberOfRows(d.L), sizeof(int)); memcpy(d.B, p->B, NumberOfRows(d.L) * sizeof(int)); } if (p->B0) { - d.B0 = tcalloc(NumberOfRows(d.L0), sizeof(int)); + d.B0 = growCalloc(&d.gmem, 0, NumberOfRows(d.L0), sizeof(int)); memcpy(d.B0, p->B0, NumberOfRows(d.L0) * sizeof(int)); } /*The only one of the state flags that does not default to zero is perm.*/ @@ -1871,7 +1856,7 @@ } if (count && (d->B || d->B0)) { - result.B = tcalloc(count, sizeof(int)); + result.B = calloc(count, sizeof(int)); if (d->B) { memcpy(result.B, d->B, sizeof(int) * NumberOfRows(d->L)); @@ -1913,6 +1898,9 @@ matrix* destMatrix = 0; int* destInt = 0; int** destIntArray = 0; + int** destGrownArray = 0; + int destGrownArrayCapacity = -1; + int* destGrownArrayCount = 0; int*** destTD = 0; /*If we encounter an ignore instruction, we want to ignore the next paramater. If we encounter a deallocate instruction, we want to deallocate @@ -1965,19 +1953,31 @@ merror(0, "DP: Internal Error: 'matrix' encounted without a 'free' or 'ignore' directive"); } } - else if (! strcmp(token, "B")) destIntArray = &data->B; - else if (! strcmp(token, "B0")) destIntArray = &data->B0; - else if (! strcmp(token, "G")) destIntArray = &data->G; - else if (! strcmp(token, "opl")) destIntArray = &data->opl; - else if (! strcmp(token, "ipl")) destIntArray = &data->ipl; - else if (! strcmp(token, "dpl")) destIntArray = &data->dpl; - else if (! strcmp(token, "apl")) destIntArray = &data->apl; - else if (! strcmp(token, "ExcludeT")) destIntArray = &data->ExcludeT; - else if (! strcmp(token, "IncludeT")) destIntArray = &data->IncludeT; - else if (! strcmp(token, "TA")) destIntArray = &data->TA; - else if (! strcmp(token, "Tuc")) destIntArray = &data->Tuc; - else if (! strcmp(token, "Tuo")) destIntArray = &data->Tuo; - else if (! strcmp(token, "upl")) destIntArray = &data->upl; + else if (! strcmp(token, "B")) + { + destGrownArray = &data->B; + destGrownArrayCapacity = NumberOfRows(data->L); + } + else if (! strcmp(token, "B0")) + { + destGrownArray = &data->B0; + destGrownArrayCapacity = NumberOfRows(data->L0); + } + else if (! strcmp(token, "G")) + { + destGrownArray = &data->G; + destGrownArrayCapacity = NumberOfRows(data->L); + } + else if (! strcmp(token, "opl")) destGrownArray = &data->opl; + else if (! strcmp(token, "ipl")) destGrownArray = &data->ipl; + else if (! strcmp(token, "dpl")) destGrownArray = &data->dpl; + else if (! strcmp(token, "apl")) destGrownArray = &data->apl; + else if (! strcmp(token, "ExcludeT")) destGrownArray = &data->ExcludeT; + else if (! strcmp(token, "IncludeT")) destGrownArray = &data->IncludeT; + else if (! strcmp(token, "TA")) destGrownArray = &data->TA; + else if (! strcmp(token, "Tuc")) destGrownArray = &data->Tuc; + else if (! strcmp(token, "Tuo")) destGrownArray = &data->Tuo; + else if (! strcmp(token, "upl")) destGrownArray = &data->upl; else if (! strcmp(token, "intarray")) { if (ignore) destIntArray = (int**) 1; @@ -2005,6 +2005,34 @@ merror(0, "DP: Internal Error"); return; } + if (destGrownArray) + { + if (ignore || deallocate) + { + destIntArray = destGrownArray; + } + else + { + /*If we have not been given the new capacity via some other function, + it is the next value in the given values. Peek ahead to get it.*/ + if (destGrownArrayCapacity < 0) + { + destIntArray = next; + destInt = (int*)(++destIntArray); + destGrownArrayCapacity = *destInt; + destIntArray = 0; + destInt = 0; + } + /*Grow the array to the required capacity.*/ + (*destGrownArray) = growCalloc(&data->gmem, *destGrownArray, destGrownArrayCapacity, sizeof(int)); + /*Copy the previous array to the new one.*/ + memcpy(*destGrownArray, *((int**)next), destGrownArrayCapacity * sizeof(int)); + free(*((int**)next)); + /*Shift the next pointer as appropriate.*/ + destGrownArray = next; + next = ++destGrownArray; + } + } if (destMatrix) { if ((! ignore) && destMatrix->type) DeallocateMatrix(destMatrix); @@ -2047,25 +2075,39 @@ This function adds an item to an index array, increments the count, and makes sure the array is sorted properly. Note the Sort will make at only one pass through an array that is already properly sorted, so this is low-cost.*/ -void AddToIndexArray(int** array, int* length, int item) +void AddToIndexArray(int** array, int* length, int item, MemoryGrower* gmem) { - int *newArray = tcalloc(*length + 1, sizeof(int)); - if (length) memcpy(newArray, *array, sizeof(int) * (*length)); - newArray[(*length)++] = item; - free(*array); - *array = newArray; + if (gmem) + { + *array = growCalloc(gmem, *array, *length + 1, sizeof(int)); + } + else + { + int *newArray = tcalloc(*length + 1, sizeof(int)); + if (length) memcpy(newArray, *array, sizeof(int) * (*length)); + free(*array); + *array = newArray; + } + (*array)[(*length)++] = item; Sort(*array, *length); } /******************************************************************************* This function adds an item to an integer array.*/ -void AddToArray(int** array, int length, int item) +void AddToArray(int** array, int length, int item, MemoryGrower* gmem) { - int* newArray = tcalloc(length + 1, sizeof(int)); - if (length) memcpy(newArray, *array, sizeof(int) * length); - newArray[length] = item; - free(*array); - *array = newArray; + if (gmem) + { + *array = growCalloc(gmem, *array, length + 1, sizeof(int)); + } + else + { + int* newArray = tcalloc(length + 1, sizeof(int)); + if (length) memcpy(newArray, *array, sizeof(int) * length); + free(*array); + *array = newArray; + } + (*array)[length] = item; } /******************************************************************************* Modified: spnbox/dp4.c =================================================================== --- spnbox/dp4.c 2009-08-19 15:49:09 UTC (rev 225) +++ spnbox/dp4.c 2009-08-20 13:40:31 UTC (rev 226) @@ -63,7 +63,6 @@ int uci, upd, consis; //flags matrix TSIPH; //All siphons found during a run. matrix S; //New siphons found during a run. - int ID; } dpData; /*A set of marking constraints. The return type of UpdateMarkingConstraints, @@ -105,7 +104,7 @@ static void FinalPrint(dpData* d); static void FreeDpParts(dpData* d); -dp_r dp(dp_p* params, int ID) +dp_r dp(dp_p* params) { dp_r result; int i, j, flag; @@ -118,7 +117,6 @@ /*Initialize the data structure.*/ dpData d = CreateDpData(params); - d.ID = ID; /*Initial message printing.*/ if (is_verbose() >= VRB_DP) { Modified: spnbox/invar.c =================================================================== --- spnbox/invar.c 2009-08-19 15:49:09 UTC (rev 225) +++ spnbox/invar.c 2009-08-20 13:40:31 UTC (rev 226) @@ -29,9 +29,9 @@ routine set in MemoryManager.c)*/ d.gmem = CreateMemoryGrower(3, NumberOfRows(d.B) * sizeof(int)); int i, j, flag; - d.Ip = GetGrowableMemory(&d.gmem, NumberOfRows(d.B) * sizeof(int)); - d.Im = GetGrowableMemory(&d.gmem, NumberOfRows(d.B) * sizeof(int)); - d.I = GetGrowableMemory(&d.gmem, NumberOfRows(d.B) * sizeof(int)); + d.Ip = growCalloc(&d.gmem, 0, NumberOfRows(d.B), sizeof(int)); + d.Im = growCalloc(&d.gmem, 0, NumberOfRows(d.B), sizeof(int)); + d.I = growCalloc(&d.gmem, 0, NumberOfRows(d.B), sizeof(int)); /*Iterate through columns of B.*/ for (j = 0; j < NumberOfColumns(d.B); j++) @@ -84,9 +84,9 @@ } /*Make sure I, Ip, and Im are as large as they need to be for the next loop iteration.*/ - d.I = GrowMemory(&d.gmem, d.I, sizeof(int) * NumberOfRows(d.C)); - d.Ip = GrowMemory(&d.gmem, d.Ip, sizeof(int) * NumberOfRows(d.C)); - d.Im = GrowMemory(&d.gmem, d.Im, sizeof(int) * NumberOfRows(d.C)); + d.I = growCalloc(&d.gmem, d.I, sizeof(int), NumberOfRows(d.C)); + d.Ip = growCalloc(&d.gmem, d.Ip, sizeof(int), NumberOfRows(d.C)); + d.Im = growCalloc(&d.gmem, d.Im, sizeof(int), NumberOfRows(d.C)); if (! NumberOfRows(d.B)) break; } } @@ -150,7 +150,7 @@ { int i, j, k, less, more; /*Make sure I is big enough to hold all the new flags.*/ - d->I = GrowMemory(&d->gmem, d->I, sizeof(int) * NumberOfRows(d->C)); + d->I = growCalloc(&d->gmem, d->I, sizeof(int), NumberOfRows(d->C)); /*Clear I.*/ memset(d->I, 0, sizeof(int) * NumberOfRows(d->C)); for (i = 0; i < NumberOfRows(d->C); i++) @@ -225,7 +225,7 @@ SetMatrixEl(&d->C, NumberOfRows(d->C) - 1, l, c); } /*Flag the new row in I.*/ - d->I = GrowMemory(&d->gmem, d->I, sizeof(int) * NumberOfRows(d->C)); + d->I = growCalloc(&d->gmem, d->I, sizeof(int), NumberOfRows(d->C)); d->I[NumberOfRows(d->C) - 1] = 1; } } Modified: spnbox/spnbox.h =================================================================== --- spnbox/spnbox.h 2009-08-19 15:49:09 UTC (rev 225) +++ spnbox/spnbox.h 2009-08-20 13:40:31 UTC (rev 226) @@ -1031,7 +1031,7 @@ int option; } dp_p; -dp_r dp(dp_p* params, int ID); +dp_r dp(dp_p* params); /* Matlab Usage: Modified: spnbox/tests/Makefile =================================================================== --- spnbox/tests/Makefile 2009-08-19 15:49:09 UTC (rev 225) +++ spnbox/tests/Makefile 2009-08-20 13:40:31 UTC (rev 226) @@ -6,7 +6,7 @@ #This variable controls whether or not the memwatch memory debugging routines are included in #compilation. Set to "yes" to include them and "no" to leave them out. -USEMEMWATCH = no +USEMEMWATCH = yes #Assign the default compiler call and options. COMPILER=gcc -g @@ -55,7 +55,7 @@ COMMONHEADER=../spnbox.h test.h ../../pnheaders/general.h ../../pnheaders/pns.h ../../pnheaders/matrix.h ../matrixmath.h ../MemoryManager.h StructuredIO.h #Targets -all: avpr extendedmatrix fvpr gcdv invar ipslv ipsolve isadm issiph msplit matrixmath pn2acpn supervis actn admcon asiph ilpadm linenf nltrans pn2eacpn reduce tactn +all: avpr dp dp4 extendedmatrix fvpr gcdv invar ipslv ipsolve isadm issiph msplit matrixmath pn2acpn supervis actn admcon asiph ilpadm linenf nltrans pn2eacpn reduce tactn avpr: test-avpr.o $(AVPR) $(COMMON) $(COMPILER) -o avpr.exe test-avpr.o $(AVPR) $(COMMON) extendedmatrix: test-extendedmatrix.o $(EXTENDEDMATRIX) $(COMMON) Modified: spnbox/tests/test-dp.c =================================================================== --- spnbox/tests/test-dp.c 2009-08-19 15:49:09 UTC (rev 225) +++ spnbox/tests/test-dp.c 2009-08-20 13:40:31 UTC (rev 226) @@ -7,11 +7,11 @@ { return 0; } - char iDesc[] = "matrix D, matrix Dm, matrix Dp, indexarray Tuc, indexarray Tuo, arrayi IncludeT, arrayi ExcludeT, arrayi B, arrayi B0, matrix L, matrix L0, string WriteLog, string EnforceLive, int ID"; + char iDesc[] = "matrix D, matrix Dm, matrix Dp, indexarray Tuc, indexarray Tuo, arrayi IncludeT, arrayi ExcludeT, arrayi B, arrayi B0, matrix L, matrix L0, string WriteLog, string EnforceLive"; char oDesc[] = "matrix Lf, arrayi Bf, matrix L0f, arrayi B0f, string how"; int *iFill; int oFill[5]; - int BCount, B0Count, i, ID; + int BCount, B0Count, i; matrix D; char WriteLog[128] = "", EnforceLive[128] = ""; dp_p p; @@ -30,11 +30,11 @@ remove("dp.log"); remove("dp.dat"); int transitions; - ID = -1; - while (ParseStructure(input, iDesc, &iFill, &mem, &D, &p.Dm, &p.Dp, &p.Tuc, &p.TucCount, &p.Tuo, &p.TuoCount, &p.IncludeT, &p.IncludeCount, &p.ExcludeT, &p.ExcludeCount, &p.B, &BCount, &p.B0, &B0Count, &p.L, &p.L0, WriteLog, EnforceLive, &ID)) + + while (ParseStructure(input, iDesc, &iFill, &mem, &D, &p.Dm, &p.Dp, &p.Tuc, &p.TucCount, &p.Tuo, &p.TuoCount, &p.IncludeT, &p.IncludeCount, &p.ExcludeT, &p.ExcludeCount, &p.B, &BCount, &p.B0, &B0Count, &p.L, &p.L0, WriteLog, EnforceLive)) { transitions = (iFill[0] ? NumberOfColumns(D) : (iFill[1] ? NumberOfColumns(p.Dm) : (iFill[2] ? NumberOfColumns(p.Dp) : 0))); - DisplayStructure(iDesc, iFill, &D, &p.Dm, &p.Dp, p.Tuc, p.TucCount, NumberOfColumns(p.Dm), p.Tuo, p.TuoCount, NumberOfColumns(p.Dm), p.IncludeT, p.IncludeCount, p.ExcludeT, p.ExcludeCount, p.B, BCount, p.B0, B0Count, &p.L, &p.L0, WriteLog, EnforceLive, ID); + DisplayStructure(iDesc, iFill, &D, &p.Dm, &p.Dp, p.Tuc, p.TucCount, NumberOfColumns(p.Dm), p.Tuo, p.TuoCount, NumberOfColumns(p.Dm), p.IncludeT, p.IncludeCount, p.ExcludeT, p.ExcludeCount, p.B, BCount, p.B0, B0Count, &p.L, &p.L0, WriteLog, EnforceLive); FillDmDp(iFill, &D, &p.Dm, &p.Dp, &mem); /*Log writing defaults to on.*/ if (strcmp(WriteLog, "off")) p.option |= DP_OPT_WRITELOG; @@ -54,7 +54,7 @@ //For the duration of a test, append to the log files. p.option |= DP_OPT_APPENDLOGS; - dp_r res = dp(&p, ID); + dp_r res = dp(&p); printf("Solution:\n"); DisplayStructure(oDesc, oFill, &res.Lf, res.Bf, NumberOfRows(res.Lf), &res.L0f, res.B0f, NumberOfRows(res.L0f), res.how); printf("-------------------------------------------------------------------------------\n\n"); @@ -63,7 +63,6 @@ mem = CreateMemoryManager(10, 10, 0, 0); memset(&p, 0, sizeof(dp_p)); - ID = -1; WriteLog[0] = '\0'; EnforceLive[0] = '\0'; } Modified: spnbox/tests/test-dp.txt =================================================================== --- spnbox/tests/test-dp.txt 2009-08-19 15:49:09 UTC (rev 225) +++ spnbox/tests/test-dp.txt 2009-08-20 13:40:31 UTC (rev 226) @@ -11,7 +11,6 @@ echo Answer should be: echo L = [ 2 2 1 ] echo b = [ 2 ] -ID 1 Dp 3 5 0 1 0 1 0 0 0 1 0 1 @@ -25,7 +24,6 @@ echo Problem 2. echo A Petri net in which deadlock cannot be prevented. -ID 2 Dp 3 3 0 1 0 0 0 1 @@ -39,7 +37,6 @@ echo Problem 3. echo A repetetive Petri net with no smaller siphons. -ID 3 Dm 3 3 0 1 0 1 0 0 @@ -54,7 +51,6 @@ echo Problem 4. echo A similar net that is not strongly connected, i.e. the union of two echo distinct repetitive Petri nets. -ID 4 Dm 6 6 0 1 0 0 0 0 1 0 0 0 0 0 @@ -81,7 +77,6 @@ echo B = [ 1 ] echo ....[ 1 ] echo ....[ 3 ] -ID 5 Dm 4 5 1 0 1 0 1 0 0 0 1 0 @@ -101,7 +96,6 @@ echo L = [ 1 1 0 0 ] B = [ 1 ] echo ....[ 0 0 1 1 ] [ 1 ] echo ....[ 1 1 1 1 ] [ 3 ] -ID 6 Dm 4 5 1 0 1 0 1 0 0 0 1 0 @@ -124,7 +118,6 @@ echo This is an example from K. Lautenback, et al, "The Linear Algebra of echo Deadlock Avoidance - A Petri Net Approach", technical report at the echo University of Koblenz, Institute for Computer Science, 1996. -ID 7 Dm 4 4 3 0 5 0 0 1 0 0 @@ -143,7 +136,6 @@ echo L = [ 2 0 1 ] B = [ 1 ] echo .....[ 0 2 1 ] [ 1 ] echo L0 = [ 2 2 2 ] B0 = [ 3 ] -ID 8 D 3 3 -1 1 0 -1 0 1 @@ -156,7 +148,6 @@ echo ----- Liveness Enforcement Tests ----- echo --------------------------------------------------------------------------- echo Problem 0. (from dpdem4.m) -ID 100 D 15 11 -1 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 1 -1 0 0 0 0 @@ -179,7 +170,6 @@ echo Problem 1. Example 5.2 from the ISIS report #4 of 2000. echo The answer should be: echo L = [ 2 2 1 ] B = [ 2 ] -ID 101 Dp 3 5 0 1 0 1 0 0 0 1 0 1 @@ -192,7 +182,6 @@ done echo Problem 2. A Petri net in which deadlock cannot be prevented. -ID 102 Dp 3 3 0 1 0 0 0 1 @@ -205,7 +194,6 @@ done echo Problem 3. A repetitive net. -ID 103 Dm 3 3 0 1 0 1 0 0 @@ -218,7 +206,6 @@ done echo Problem 4. The union of two distinct repetetive Petri nets. -ID 104 Dm 6 6 0 1 0 0 0 0 1 0 0 0 0 0 @@ -237,7 +224,6 @@ done echo Problem 5. DAta from Example 5.1 from ISIS report #3 of 2000. -ID 105 Dm 4 5 1 0 1 0 1 0 0 0 1 0 @@ -253,7 +239,6 @@ echo Problem 6. The same as Problem 5 (Data from Example 5.1 from ISIS report #3 echo of 2000.) except with an initial constraint. -ID 106 Dm 4 5 1 0 1 0 1 0 0 0 1 0 @@ -276,7 +261,6 @@ echo L = [ 2 0 1 ] B = [ 1 ] echo .....[ 0 2 1 ] [ 1 ] echo L0 = [ 2 2 2 ] B0 = [ 3 ] -ID 107 D 3 3 -1 1 0 -1 0 1 @@ -291,7 +275,6 @@ echo L = [ 1 0 1 1 1 ] B = [ 1 ] echo .....[ 0 1 1 1 1 ] [ 1 ] echo L0 = [ -1 -1 -1 -1 -1 ] B0 = [ -1 ] -ID 108 D 5 6 -1 1 0 0 0 0 -1 0 1 0 0 0 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ste...@us...> - 2009-08-19 15:49:23
|
Revision: 225 http://pntool.svn.sourceforge.net/pntool/?rev=225&view=rev Author: StephenCamp Date: 2009-08-19 15:49:09 +0000 (Wed, 19 Aug 2009) Log Message: ----------- Removed dp4.o from the list of targets made when "make" is called from this directory to make all spnbox functions - otherwise the "dp" function is defined twice if one simply links all object files from the spnbox directory. Modified Paths: -------------- spnbox/Makefile Modified: spnbox/Makefile =================================================================== --- spnbox/Makefile 2009-08-19 15:34:14 UTC (rev 224) +++ spnbox/Makefile 2009-08-19 15:49:09 UTC (rev 225) @@ -3,9 +3,9 @@ COMPILER=gcc -g -all: actn.o admcon.o asiph.o avpr.o chkcons.o deallocation.o dp.o dp4.o\ - extendedmatrix.o fvpr.o gcdv.o ilpadm.o ipslv.o ipsolve.o isadm.o issiph.o\ - linenf.o matrixmath.o MemoryManager.o msplit.o nltrans.o pn2acpn.o\ +all: actn.o admcon.o asiph.o avpr.o chkcons.o deallocation.o dp.o\ + extendedmatrix.o fvpr.o gcdv.o invar.o ilpadm.o ipslv.o ipsolve.o isadm.o\ + issiph.o linenf.o matrixmath.o MemoryManager.o msplit.o nltrans.o pn2acpn.o\ pn2eacpn.o reduce.o supervis.o tactn.o liblpsolve55.a actn.o: actn.c spnbox.h MemoryManager.h matrixmath.h ../pnheaders/general.h ../pnheaders/matrix.h This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ste...@us...> - 2009-08-19 15:34:23
|
Revision: 224 http://pntool.svn.sourceforge.net/pntool/?rev=224&view=rev Author: StephenCamp Date: 2009-08-19 15:34:14 +0000 (Wed, 19 Aug 2009) Log Message: ----------- Forgot to add the test routines for gcdv and invar earlier. Added Paths: ----------- spnbox/tests/test-gcdv.c spnbox/tests/test-gcdv.txt spnbox/tests/test-invar.c spnbox/tests/test-invar.txt Added: spnbox/tests/test-gcdv.c =================================================================== --- spnbox/tests/test-gcdv.c (rev 0) +++ spnbox/tests/test-gcdv.c 2009-08-19 15:34:14 UTC (rev 224) @@ -0,0 +1,30 @@ +#include "test.h" + +int main(int argc, char* argv[]) +{ + FILE* input; + if (! (input = ParseCmdLine(argc, argv))) + { + return 0; + } + matrix m; + int row = -1, col = -1; + int *filled; + char iDesc[] = "matrix m, int row, int column"; + MemoryManager mem = CreateMemoryManager(5, 1, 0, 0); + while (ParseStructure(input, iDesc, &filled, &mem, &m, &row, &col)) + { + filled[1] = 1; + filled[2] = 1; + DisplayStructure(iDesc, filled, &m, row, col); + + printf("Result: %d\n", gcdv(filled[0] ? &m : 0, row, col)); + printf("-------------------------------------------------------------------------------\n"); + FreeMemory(&mem); + mem = CreateMemoryManager(5, 1, 0, 0); + row = -1; + col = -1; + } + FreeMemory(&mem); + return 0; +} Added: spnbox/tests/test-gcdv.txt =================================================================== --- spnbox/tests/test-gcdv.txt (rev 0) +++ spnbox/tests/test-gcdv.txt 2009-08-19 15:34:14 UTC (rev 224) @@ -0,0 +1,28 @@ +echo Problem 1. GCD of a whole matrix. Answer should be 5. +m 3 3 +100 50 75 +30 65 30 +40 35 45 +done + +echo Problem 2. GCD of 1st row. Answer should be 25. +m 3 3 +100 50 75 +30 65 30 +40 35 45 +row 0 +done + +echo Problem 3. GCD of 3rd column. Answer should be 15. +m 3 3 +100 50 75 +30 65 30 +40 35 45 +column 2 +done + +echo Problem 4. GCD of two scalars. Answer should be 13. +row 26 +column 39 +done +quit Added: spnbox/tests/test-invar.c =================================================================== --- spnbox/tests/test-invar.c (rev 0) +++ spnbox/tests/test-invar.c 2009-08-19 15:34:14 UTC (rev 224) @@ -0,0 +1,38 @@ +#include "test.h" + +int main(int argc, char* argv[]) +{ + FILE* input; + if (! (input = ParseCmdLine(argc, argv))) + { + return 0; + } + matrix A, result; + int row = -1, col = -1; + int *filled; + char iDesc[] = "matrix A"; + MemoryManager mem = CreateMemoryManager(5, 1, 0, 0); + while (ParseStructure(input, iDesc, &filled, &mem, &A)) + { + if (filled[0]) + { + ShowMatrix(&A, "A"); + + result = invar(&A); + ManageMatrix(&mem, &result); + ShowMatrix(&result, "Result:"); + } + else + { + printf("No matrix given. Ignoring problem.\n"); + } + + printf("-------------------------------------------------------------------------------\n"); + FreeMemory(&mem); + mem = CreateMemoryManager(5, 1, 0, 0); + row = -1; + col = -1; + } + FreeMemory(&mem); + return 0; +} Added: spnbox/tests/test-invar.txt =================================================================== --- spnbox/tests/test-invar.txt (rev 0) +++ spnbox/tests/test-invar.txt 2009-08-19 15:34:14 UTC (rev 224) @@ -0,0 +1,33 @@ +echo Problem 1. Answer should be: +echo 1 +echo 1 +A 2 2 +-1 1 + 1 -1 +done + +echo Problem 2. Answer should be: +echo 1 0 +echo 1 1 +echo 0 1 +A 1 3 +1 -1 1 +done + +echo Problem 4. Answer should be: +echo <empty matrix> +A 1 2 +1 1 +done + +echo Problem 5. Answer should be: +echo 1 +echo 2 +echo 2 +echo 1 +A 3 4 +-1 0 1 -1 + 2 -1 0 0 + 0 1 -1 0 +done +quit This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ste...@us...> - 2009-08-19 15:33:13
|
Revision: 223 http://pntool.svn.sourceforge.net/pntool/?rev=223&view=rev Author: StephenCamp Date: 2009-08-19 15:33:06 +0000 (Wed, 19 Aug 2009) Log Message: ----------- Set "USEMEMWATCH" in pntool/spnbox/tests/Makefile back to "no" to avoid compiling memory debugging libraries into the test routines. Modified Paths: -------------- spnbox/tests/Makefile Modified: spnbox/tests/Makefile =================================================================== --- spnbox/tests/Makefile 2009-08-19 15:29:25 UTC (rev 222) +++ spnbox/tests/Makefile 2009-08-19 15:33:06 UTC (rev 223) @@ -6,7 +6,7 @@ #This variable controls whether or not the memwatch memory debugging routines are included in #compilation. Set to "yes" to include them and "no" to leave them out. -USEMEMWATCH = yes +USEMEMWATCH = no #Assign the default compiler call and options. COMPILER=gcc -g This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ste...@us...> - 2009-08-19 15:29:35
|
Revision: 222 http://pntool.svn.sourceforge.net/pntool/?rev=222&view=rev Author: StephenCamp Date: 2009-08-19 15:29:25 +0000 (Wed, 19 Aug 2009) Log Message: ----------- dp4.c has been modified slightly: now uses pn2acpn calls instead of pn2eacpn. Added a new type of memory management object and routines to MemoryManager.c: A manager that will "grow" regions of memory by blocks to avoid constantly having to reallocate them. Added gcdv.c and test routines. All tests passed. Added invar.c and test routines. All tests passed. Modified spnbox.h and makefiles as appropriate. Modified Paths: -------------- spnbox/Makefile spnbox/MemoryManager.c spnbox/MemoryManager.h spnbox/dp4.c spnbox/spnbox.h spnbox/tests/Makefile Added Paths: ----------- spnbox/gcdv.c spnbox/invar.c Modified: spnbox/Makefile =================================================================== --- spnbox/Makefile 2009-08-18 22:18:47 UTC (rev 221) +++ spnbox/Makefile 2009-08-19 15:29:25 UTC (rev 222) @@ -4,7 +4,7 @@ COMPILER=gcc -g all: actn.o admcon.o asiph.o avpr.o chkcons.o deallocation.o dp.o dp4.o\ - extendedmatrix.o fvpr.o ilpadm.o ipslv.o ipsolve.o isadm.o issiph.o\ + extendedmatrix.o fvpr.o gcdv.o ilpadm.o ipslv.o ipsolve.o isadm.o issiph.o\ linenf.o matrixmath.o MemoryManager.o msplit.o nltrans.o pn2acpn.o\ pn2eacpn.o reduce.o supervis.o tactn.o liblpsolve55.a @@ -38,6 +38,12 @@ fvpr.o: fvpr.c ../pnheaders/general.h ../pnheaders/matrix.h $(COMPILER) -c fvpr.c +gcdv.o: gcdv.c ../pnheaders/general.h ../pnheaders/matrix.h + $(COMPILER) -c gcdv.c + +invar.o: invar.c spnbox.h matrixmath.h MemoryManager.h extendedmatrix.h ../pnheaders/general.h ../pnheaders/matrix.h + $(COMPILER) -c invar.c + ilpadm.o: ilpadm.c spnbox.h MemoryManager.h matrixmath.h ../pnheaders/general.h ../pnheaders/matrix.h ../pnheaders/pns.h $(COMPILER) -c ilpadm.c Modified: spnbox/MemoryManager.c =================================================================== --- spnbox/MemoryManager.c 2009-08-18 22:18:47 UTC (rev 221) +++ spnbox/MemoryManager.c 2009-08-19 15:29:25 UTC (rev 222) @@ -107,3 +107,95 @@ mgr.addressblockm = MatrixAddressBlockSize; return mgr; } + +/*CreateMemoryGrower initializes a memory grower structure.*/ +MemoryGrower CreateMemoryGrower(int pointers, int blocksize) +{ + MemoryGrower g; + if (pointers < 1 || blocksize < 1) + { + merror(0, "CREATEMEMORYGROWER: Parameters are non-positive"); + memset(&g, 0, sizeof(MemoryGrower)); + return g; + } + + g.blocksize = blocksize; + g.memories = pointers; + g.memory = tcalloc(pointers, sizeof(void*)); + g.capacity = tcalloc(pointers, sizeof(int)); + g.next = 0; + return g; +} + +/*GetGrowableMemory gets some memory that can grow.*/ +void* GetGrowableMemory(MemoryGrower* g, int size) +{ + if (! g) + { + merror(0, "GETGROWABLEMEMORY: Required parameter is null"); + return 0; + } + if (g->next == g->memories) + { + merror(0, "GETGROWABLEMEMORY: Too many pointers in memory"); + return 0; + } + if (size < g->blocksize) size = g->blocksize; + g->memory[g->next] = tmalloc(size); + g->capacity[g->next] = size; + return g->memory[g->next++]; +} + +/*GrowMemory increases the capacity of the given piece of memory. Raises +a fatal error if the memory has not been registered with it.*/ +void* GrowMemory(MemoryGrower* g, void* memory, int newCapacity) +{ + if (! (g && memory)) + { + merror(0, "GROWMEMORY: Required pointer is null"); + return 0; + } + /*Find the memory.*/ + int i; + for (i = 0; i < g->next; i++) + { + if (memory == g->memory[i]) break; + } + if (i == g->next) + { + merror(0, "GROWMEMORY: The memory did not originate with the grower"); + return 0; + } + /*If we are still within the allocated capacity, return the memory + as-is.*/ + if (newCapacity <= g->capacity[i]) + { + return memory; + } + /*Otherwise, allocate some new memory.*/ + else + { + if (newCapacity < g->capacity[i] + g->blocksize) newCapacity = g->capacity[i] + g->blocksize; + void* newMem = tmalloc(newCapacity); + memcpy(newMem, memory, g->capacity[i]); + g->capacity[i] = newCapacity; + g->memory[i] = newMem; + free(memory); + return newMem; + } +} + +/*FreeMemoryGrower deallocates all the memories pointed to by a memory +grower.*/ +void FreeMemoryGrower(MemoryGrower* g) +{ + if (! g) return; + int i; + for (i = 0; i < g->next; i++) + { + free(g->memory[i]); + } + free(g->memory); + free(g->capacity); + memset(g, 0, sizeof(MemoryGrower)); +} Modified: spnbox/MemoryManager.h =================================================================== --- spnbox/MemoryManager.h 2009-08-18 22:18:47 UTC (rev 221) +++ spnbox/MemoryManager.h 2009-08-19 15:29:25 UTC (rev 222) @@ -20,7 +20,6 @@ int addressblockm; } MemoryManager; - /*ManageMatrix adds a matrix to the list of matrices to free later.*/ inline void ManageMatrix(MemoryManager* mgr, matrix* m); @@ -50,4 +49,28 @@ five and will be set to five automatically if passed as less than that.*/ MemoryManager CreateMemoryManager(int InitialLength, int InitialMatrices, int AddressBlockSize, int MatrixAddressBlockSize); +/*The MemoryGrower structure maintains the information needed to have a region +of memory that can be increased in size several times before a time-consuming +reallocation is necessary.*/ +typedef struct MemoryGrower +{ + void** memory; + int * capacity; + int blocksize, memories, next; +} MemoryGrower; + +/*CreateMemoryGrower initializes a memory grower structure.*/ +MemoryGrower CreateMemoryGrower(int pointers, int blocksize); + +/*GetGrowableMemory gets some memory that can grow.*/ +void* GetGrowableMemory(MemoryGrower* g, int size); + +/*GrowMemory increases the capacity of the given piece of memory. Raises +a fatal error if the memory has not been registered with the memory +grower.*/ +void* GrowMemory(MemoryGrower* g, void* memory, int newCapacity); + +/*FreeMemoryGrower deallocates all the memories pointed to by a memory +grower.*/ +void FreeMemoryGrower(MemoryGrower* g); #endif Modified: spnbox/dp4.c =================================================================== --- spnbox/dp4.c 2009-08-18 22:18:47 UTC (rev 221) +++ spnbox/dp4.c 2009-08-19 15:29:25 UTC (rev 222) @@ -876,12 +876,8 @@ { ncp[d->cpl[i]] = 1; } - /* For debugging purposes, we replace the pn2eacpn call with a pn2acpn call.*/ - pn2eacpn_r pn2eacpnRes = pn2eacpn(&d->Dm, &d->Dp, ncp, &d->M, &d->L0, &d->L, d->ipl, d->ipCount, d->dpl, d->dpCount, 0, 0); - UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount free TD free intarray", &pn2eacpnRes); - /* pn2acpn_r pn2acpnRes = pn2acpn(&d->Dm, &d->Dp, ncp, &d->M, &d->L0, &d->L, d->ipl, d->ipCount, d->dpl, d->dpCount); - UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount", &pn2acpnRes);*/ + UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount", &pn2acpnRes); free(ncp); } @@ -1348,10 +1344,8 @@ { /*If we get here we are doing (T-)liveness enforcement. Transform the net to an EAC net.*/ - pn2eacpn_r pn2eacpnRes = pn2eacpn(&d->Dm, &d->Dp, 0, &d->M, &d->L0, &d->L, d->ipl, d->ipCount, d->dpl, d->dpCount, 0, 0); - UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount free TD free intarray", &pn2eacpnRes); - /*pn2acpn_r pn2acpnRes = pn2acpn(&d->Dm, &d->Dp, 0, &d->M, &d->L0, &d->L, d->ipl, d->ipCount, d->dpl, d->dpCount); - UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount", &pn2acpnRes);*/ + pn2acpn_r pn2acpnRes = pn2acpn(&d->Dm, &d->Dp, 0, &d->M, &d->L0, &d->L, d->ipl, d->ipCount, d->dpl, d->dpCount); + UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount", &pn2acpnRes); /*Find the t-minimal active subnet.*/ tactn_r tactnRes = tactn(&d->Dm, &d->Dp, d->IncludeT, d->IncludeCount, d->ExcludeT, d->ExcludeCount, 0, 0, 1); Added: spnbox/gcdv.c =================================================================== --- spnbox/gcdv.c (rev 0) +++ spnbox/gcdv.c 2009-08-19 15:29:25 UTC (rev 222) @@ -0,0 +1,95 @@ +#include "../pnheaders/general.h" +#include "../pnheaders/matrix.h" + +static int gcd(int a, int b); + +int gcdv(matrix* m, int row, int col) +{ + /*If the matrix pointer is present, get the limits on where we should be' + processing.*/ + if (m) + { + /*Check to make sure the row/column numbers are in range.*/ + if (row >= NumberOfRows(*m) || col >= NumberOfColumns(*m)) + { + merror(0, "GCDV: The row or column number is out of range"); + return 0; + } + int i, j, i0, j0, i1, j1, x; + /*Check to make sure we aren't being asked to find the gcd of a single + element.*/ + if (row >= 0 && col >= 0) + { + merror(0, "GCDV: The row and column numbers request the GCD of a single scalar element"); + return 1; + } + /*Get the limits over which we will be iterating (row and column)*/ + if (row >= 0) + { + i0 = row; + i1 = row + 1; + } + else + { + i0 = 0; + i1 = NumberOfRows(*m); + } + if (col >= 0) + { + j0 = col; + j1 = col + 1; + } + else + { + j0 = 0; + j1 = NumberOfColumns(*m); + } + /*Do the actual iteration.*/ + for (i = i0; i < i1; i++) + { + for (j = j0; j < j1; j++) + { + if (i == i0 && j == j0) + { + if ((x = GetMatrixEl(m, i, j)) == 1) break; + } + else + { + if ((x = gcd(GetMatrixEl(m, i, j), x)) == 1) break; + } + } + } + return x; + } + /*If m was not provided, find the gcd of the row and column numbers.*/ + else + { + return gcd(row, col); + } +} + +/******************************************************************************* +Find the greatest common divisor of a pair of integers via the Euclidian +algorithm.*/ +int gcd(int a, int b) +{ + int c; + /*Make sure a is greater than b by swapping if necessary.*/ + if (a < b) + { + c = a; + a = b; + b = c; + } + /*Make sure both are positive.*/ + if (a < 0) a = -a; + if (b < 0) b = -b; + /*Division-based Euclidian gcd algorithm.*/ + while (b) + { + c = b; + b = a % b; + a = c; + } + return a; +} Added: spnbox/invar.c =================================================================== --- spnbox/invar.c (rev 0) +++ spnbox/invar.c 2009-08-19 15:29:25 UTC (rev 222) @@ -0,0 +1,258 @@ +#include "../pnheaders/general.h" +#include "../pnheaders/matrix.h" +#include "MemoryManager.h" +#include "matrixmath.h" +#include "extendedmatrix.h" + +typedef struct invarData +{ + matrix B, C; + int *Ip, *Im, *I; + MemoryGrower gmem; +} invarData; + +static int InitMatrices(matrix* A, invarData* d); +static void AddGcdRows(invarData* d, int j); +static void FindNonMinimalRows(invarData* d); +static void EliminateNullSpace(invarData* d, matrix* A); + +matrix invar(matrix* A) +{ + invarData d; + if (! InitMatrices(A, &d)) + { + return d.B; + } + + /*We are going to be using several flag lists that will need to change + size with A and C. Use a memory grower (a fast memory-area growing + routine set in MemoryManager.c)*/ + d.gmem = CreateMemoryGrower(3, NumberOfRows(d.B) * sizeof(int)); + int i, j, flag; + d.Ip = GetGrowableMemory(&d.gmem, NumberOfRows(d.B) * sizeof(int)); + d.Im = GetGrowableMemory(&d.gmem, NumberOfRows(d.B) * sizeof(int)); + d.I = GetGrowableMemory(&d.gmem, NumberOfRows(d.B) * sizeof(int)); + + /*Iterate through columns of B.*/ + for (j = 0; j < NumberOfColumns(d.B); j++) + { + /*Flag the places with input and output arcs from the current + transition.*/ + flag = 0; + memset(d.Im, 0, sizeof(int) * NumberOfRows(d.B)); + memset(d.Ip, 0, sizeof(int) * NumberOfRows(d.B)); + for (i = 0; i < NumberOfRows(d.B); i++) + { + if (GetMatrixEl(&d.B, i, j) < 0) + { + d.Im[i] = 1; + flag |= 1; + } + if (GetMatrixEl(&d.B, i, j) > 0) + { + d.Ip[i] = 1; + flag |= 2; + } + } + /*Do the gcd row adds only if there is at least one flagged place each in + Ip and Im..*/ + if (flag == 3) + { + AddGcdRows(&d, j); + /*Eliminate all rows not flagged in I.*/ + for (i = NumberOfRows(d.B) - 1; i >= 0; i--) + { + if (! d.I[i]) + { + RemoveRows(&d.B, i, 1, -1); + RemoveRows(&d.C, i, 1, -1); + } + } + if (! NumberOfRows(d.B)) break; + + /*Flag the rows of C whose support is not minimal with respect to + other rows of C.*/ + FindNonMinimalRows(&d); + /*Remove those rows.*/ + for (i = NumberOfRows(d.C) - 1; i >= 0; i--) + { + if (d.I[i]) + { + RemoveRows(&d.B, i, 1, -1); + RemoveRows(&d.C, i, 1, -1); + } + } + /*Make sure I, Ip, and Im are as large as they need to be for the next + loop iteration.*/ + d.I = GrowMemory(&d.gmem, d.I, sizeof(int) * NumberOfRows(d.C)); + d.Ip = GrowMemory(&d.gmem, d.Ip, sizeof(int) * NumberOfRows(d.C)); + d.Im = GrowMemory(&d.gmem, d.Im, sizeof(int) * NumberOfRows(d.C)); + if (! NumberOfRows(d.B)) break; + } + } + /*Eliminate rows of C which are not part of null space.*/ + TransposeMatrix(A); + EliminateNullSpace(&d, A); + TransposeMatrix(A); + TransposeMatrix(&d.C); + /*Clean up C by reducing all the arc weights.*/ + for (j = 0; j < NumberOfColumns(d.C); j++) + { + int div; + if ((div = gcdv(&d.C, -1, j)) > 1) + { + for (i = 0; i < NumberOfRows(d.C); i++) + { + SetMatrixEl(&d.C, i, j, GetMatrixEl(&d.C, i, j) / div); + } + } + } + /*Free memory.*/ + DeallocateMatrix(&d.B); + FreeMemoryGrower(&d.gmem); + + return d.C; +} + +/******************************************************************************* +EliminateNonNullSpace eliminates rows which are not part of null space.*/ +void EliminateNullSpace(invarData* d, matrix* A) +{ + /*Get the matrix product of C and A.*/ + matrix X = MultiplyMatrix(&d->C, A, (matrix*) 2); + int i, j; + /*We'll be using I to flag rows that should be kept. Clear it now.*/ + memset(d->I, 0, sizeof(int) * NumberOfRows(d->C)); + /*Iterate through rows of C.*/ + for (i = 0; i < NumberOfRows(d->C); i++) + { + /*Find out if the corresponding row in X has any non-null entries.*/ + for (j = 0; j < NumberOfColumns(X); j++) + { + if (GetMatrixEl(&X, i, j)) break; + } + /*If there were no non-null entries, the row should be flagged for + keeping. Otherwise leave the flag blank to request removal.*/ + if (j == NumberOfColumns(X)) d->I[i] = 1; + } + /*Remove any rows of C not flagged in I.*/ + for (i = NumberOfRows(d->C) - 1; i >= 0; i--) + { + if (! d->I[i]) RemoveRows(&d->C, i, 1, -1); + } + DeallocateMatrix(&X); +} + +/******************************************************************************* +FindNonMinimimalRows finds rows of C whose support is not minimal with respect +to other rows of C and flags them for removal in I.*/ +void FindNonMinimalRows(invarData* d) +{ + int i, j, k, less, more; + /*Make sure I is big enough to hold all the new flags.*/ + d->I = GrowMemory(&d->gmem, d->I, sizeof(int) * NumberOfRows(d->C)); + /*Clear I.*/ + memset(d->I, 0, sizeof(int) * NumberOfRows(d->C)); + for (i = 0; i < NumberOfRows(d->C); i++) + { + if (d->I[i]) continue; + for (j = i + 1; j < NumberOfRows(d->C); j++) + { + if (d->I[j]) continue; + /*Check to see if logic(C(i,:)) >= logic(C(j,:)) or if logic(C(i,:)) <= + logic(C(j,:))*/ + less = 1; + more = 1; + for (k = 0; k < NumberOfColumns(d->C) && (less || more); k++) + { + if (more && GetMatrixEl(&d->C, j, k) && ! GetMatrixEl(&d->C, i, k)) + { + more = 0; + } + if (less && GetMatrixEl(&d->C, i, k) && ! GetMatrixEl(&d->C, j, k)) + { + less = 0; + } + } + if (more) + { + d->I[i] = 1; + } + else if (less) + { + d->I[j] = 1; + } + } + } +} + +/******************************************************************************* +AddGcdRows adds some rows to the B/C pair based on the gcd of particular +elements.*/ +void AddGcdRows(invarData* d, int j) +{ + int i, k, l, originalrows; + /*Make sure that*/ + originalrows = NumberOfRows(d->B); + memset(d->I, 0, originalrows * sizeof(int)); + for (i = 0; i < originalrows; i++) + { + /*Flag in I any row of B null in the current column.*/ + if (! GetMatrixEl(&d->B, i, j)) d->I[i] = 1; + + /*Skip from here any places without input arcs.*/ + if (! d->Ip[i]) continue; + /*Iterate through all the places again. We will examine input places in the + outer loop and output places in the inner loop.*/ + for (k = 0; k < originalrows; k++) + { + if (! d->Im[k]) continue; + int z = gcdv(0, GetMatrixEl(&d->B, i, j), GetMatrixEl(&d->B, k, j)); + int x = GetMatrixEl(&d->B, k, j) / z; + int y = GetMatrixEl(&d->B, i, j) / z; + /*Add a new row to BC.*/ + InsertNullRows(&d->B, -1, 1, -1); + InsertNullRows(&d->C, -1, 1, -1); + /*The new row should be found algorithmically.*/ + for (l = 0; l < NumberOfColumns(d->B); l++) + { + int c = (-x * GetMatrixEl(&d->B, i, l)) + (y * GetMatrixEl(&d->B, k, l)); + SetMatrixEl(&d->B, NumberOfRows(d->B) - 1, l, c); + } + for (l = 0; l < NumberOfColumns(d->C); l++) + { + int c = (-x * GetMatrixEl(&d->C, i, l)) + (y * GetMatrixEl(&d->C, k, l)); + SetMatrixEl(&d->C, NumberOfRows(d->C) - 1, l, c); + } + /*Flag the new row in I.*/ + d->I = GrowMemory(&d->gmem, d->I, sizeof(int) * NumberOfRows(d->C)); + d->I[NumberOfRows(d->C) - 1] = 1; + } + } +} + +/******************************************************************************* +InitMatrices initializes the matrices B and C.*/ +int InitMatrices(matrix* A, invarData* d) +{ + memset(d, 0, sizeof(invarData)); + if (! A) + { + merror(0, "INVAR: Null matrix pointer"); + return 0; + } + /*B should be a transpose copy of A optimized for row ops.*/ + AllocateMatrixType(2, &d->B, NumberOfColumns(*A), NumberOfRows(*A)); + TransposeMatrix(&d->B); + CopyMatrix(A, &d->B); + TransposeMatrix(&d->B); + + /*C should be an identity, number of rows of A, optimized for row ops.*/ + AllocateMatrixType(2, &d->C, NumberOfRows(d->B), NumberOfRows(d->B)); + int i; + for (i = 0; i < NumberOfRows(d->B); i++) + { + SetMatrixEl(&d->C, i, i, 1); + } + return 1; +} Modified: spnbox/spnbox.h =================================================================== --- spnbox/spnbox.h 2009-08-18 22:18:47 UTC (rev 221) +++ spnbox/spnbox.h 2009-08-19 15:29:25 UTC (rev 222) @@ -1108,4 +1108,48 @@ pointers in the structure to point to integer arrays containing the indices and setting the corresponding count integers to the length of the index lists. */ + +int gcdv(matrix *m, int row, int column); +/* +GCDV greatest common divisor of a vector/matrix. Uses GCD. + +Written by Marian V. Iordache, mio...@nd... + +C Usage: +If m is a null pointer, the function returns the gcd of the row and column +numbers. Otherwise: +If row is nonnegative the function returns the gcd of the given row, ignoring +the column number. +If row is negative but column is positive, the function returns the gcd of the +given column, ignoring the row number. +If both row and column are negative, the function returns the gcd of every +element in the matrix. +If both row and column are positive the function fails with an error.*/ + +matrix invar(matrix* A); +/* +INVAR - Positive invariant computation. + +INVAR(A) returns a matrix whose columns give the minimal support positive +invariants of a matrix A, i.e., it returns a basis for the solutions to +Ax = 0, x >= 0. + +The matlab version of INVAR is a modification of INVAR1. INVAR works with +integers only! In Matlab, INVAR1 is called if A is not an integer matrix. + +The solution is based on an algorithm by Martinez and Silva. + +In Matlab, INVAR is a slight modification of INVAR1; INVAR1 has been written by +John O. Moody. + + +C Usage: +INVAR1 has not been implemented in C. INVAR takes a pointer to a matrix as its +only parameter and returns the solution matrix. Since the pntool matrix type +does not support non-integer matrices, nothing has been implemented to deal with +them. +Converted from Matlab to C by Marian V. Iordache, mar...@le..., and +Stephen Camp, ste...@le.... +*/ + #endif Modified: spnbox/tests/Makefile =================================================================== --- spnbox/tests/Makefile 2009-08-18 22:18:47 UTC (rev 221) +++ spnbox/tests/Makefile 2009-08-19 15:29:25 UTC (rev 222) @@ -6,7 +6,7 @@ #This variable controls whether or not the memwatch memory debugging routines are included in #compilation. Set to "yes" to include them and "no" to leave them out. -USEMEMWATCH = no +USEMEMWATCH = yes #Assign the default compiler call and options. COMPILER=gcc -g @@ -30,6 +30,8 @@ AVPR=avpr.o EXTENDEDMATRIX=extendedmatrix.o FVPR=fvpr.o +GCDV=gcdv.o +INVAR=invar.o $(GCDV) $(EXTENDEDMATRIX) IPSLV=ipslv.o ../liblpsolve55.a IPSOLVE=ipsolve.o $(IPSLV) ISADM=isadm.o @@ -47,19 +49,23 @@ REDUCE=reduce.o chkcons.o $(IPSOLVE) TACTN=tactn.o $(IPSOLVE) DP=dp.o tactn.o reduce.o chkcons.o pn2eacpn.o nltrans.o asiph.o actn.o admcon.o supervis.o msplit.o issiph.o fvpr.o avpr.o $(EXTENDEDMATRIX) $(IPSOLVE) -DP4=dp4.o tactn.o reduce.o chkcons.o pn2eacpn.o nltrans.o asiph.o actn.o admcon.o supervis.o msplit.o issiph.o fvpr.o avpr.o $(EXTENDEDMATRIX) $(IPSOLVE) +DP4=dp4.o tactn.o reduce.o chkcons.o pn2acpn.o nltrans.o asiph.o actn.o admcon.o supervis.o msplit.o issiph.o fvpr.o avpr.o $(EXTENDEDMATRIX) $(IPSOLVE) #Common test header dependencies. -COMMONHEADER=../spnbox.h test.h ../../pnheaders/pns.h ../../pnheaders/matrix.h ../matrixmath.h ../MemoryManager.h StructuredIO.h +COMMONHEADER=../spnbox.h test.h ../../pnheaders/general.h ../../pnheaders/pns.h ../../pnheaders/matrix.h ../matrixmath.h ../MemoryManager.h StructuredIO.h #Targets -all: avpr extendedmatrix fvpr ipslv ipsolve isadm issiph msplit matrixmath pn2acpn supervis actn admcon asiph ilpadm linenf nltrans pn2eacpn reduce tactn +all: avpr extendedmatrix fvpr gcdv invar ipslv ipsolve isadm issiph msplit matrixmath pn2acpn supervis actn admcon asiph ilpadm linenf nltrans pn2eacpn reduce tactn avpr: test-avpr.o $(AVPR) $(COMMON) $(COMPILER) -o avpr.exe test-avpr.o $(AVPR) $(COMMON) extendedmatrix: test-extendedmatrix.o $(EXTENDEDMATRIX) $(COMMON) $(COMPILER) -o extendedmatrix.exe test-extendedmatrix.o $(EXTENDEDMATRIX) $(COMMON) fvpr: test-fvpr.o $(FVPR) $(COMMON) $(COMPILER) -o fvpr.exe test-fvpr.o $(FVPR) $(COMMON) +gcdv: test-gcdv.o $(GCDV) $(COMMON) + $(COMPILER) -o gcdv.exe test-gcdv.o $(GCDV) $(COMMON) +invar: test-invar.o $(INVAR) $(COMMON) + $(COMPILER) -o invar.exe test-invar.o $(INVAR) $(COMMON) ipslv: test-ipslv.o $(IPSLV) $(COMMON) $(COMPILER) -o ipslv.exe test-ipslv.o $(IPSLV) $(COMMON) ipsolve: test-ipsolve.o $(COMMON) $(IPSOLVE) @@ -122,10 +128,14 @@ $(MEMWCOMP) -c ../extendedmatrix.c fvpr.o: ../fvpr.c ../../pnheaders/general.h ../../pnheaders/matrix.h $(MEMWCOMP) -c ../fvpr.c +gcdv.o: ../gcdv.c ../../pnheaders/general.h ../../pnheaders/matrix.h + $(MEMWCOMP) -c ../gcdv.c general.o: ../../pnheaders/general.c ../../pnheaders/general.h $(MEMWCOMP) -c ../../pnheaders/general.c ilpadm.o: ../spnbox.h ../matrixmath.h ../../pnheaders/general.h ../../pnheaders/matrix.h ../MemoryManager.h ../ilpadm.c $(MEMWCOMP) -c ../ilpadm.c +invar.o: ../invar.c ../spnbox.h ../matrixmath.h ../MemoryManager.h ../extendedmatrix.h ../../pnheaders/general.h ../../pnheaders/matrix.h + $(MEMWCOMP) -c ../invar.c isadm.o: ../isadm.c ../spnbox.h ../../pnheaders/general.h ../MemoryManager.h ../../pnheaders/pns.h ../matrixmath.h $(MEMWCOMP) -c ../isadm.c issiph.o: ../issiph.c ../spnbox.h ../../pnheaders/general.h ../../pnheaders/matrix.h @@ -178,8 +188,12 @@ $(MEMWCOMP) -c test-dp.c test-fvpr.o: test-fvpr.c $(COMMONHEADER) $(MEMWCOMP) -c test-fvpr.c +test-gcdv.o: test-gcdv.c $(COMMONHEADER) + $(MEMWCOMP) -c test-gcdv.c test-ilpadm.o: test-ilpadm.c $(COMMONHEADER) $(MEMWCOMP) -c test-ilpadm.c +test-invar.o: test-invar.c $(COMMONHEADER) + $(MEMWCOMP) -c test-invar.c test-ipslv.o: test-ipslv.c $(MEMWCOMP) -c test-ipslv.c test-ipsolve.o: test-ipsolve.c $(COMMONHEADER) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mio...@us...> - 2009-08-18 22:19:01
|
Revision: 221 http://pntool.svn.sourceforge.net/pntool/?rev=221&view=rev Author: miordache Date: 2009-08-18 22:18:47 +0000 (Tue, 18 Aug 2009) Log Message: ----------- matrix.c correction Modified Paths: -------------- pnheaders/matrix.c Modified: pnheaders/matrix.c =================================================================== --- pnheaders/matrix.c 2009-08-17 21:56:30 UTC (rev 220) +++ pnheaders/matrix.c 2009-08-18 22:18:47 UTC (rev 221) @@ -465,7 +465,8 @@ void inline _delmatr3(matrix* m) { int i; MatrElem* p, *pt; - for (i = 0, p = m->row[i]; i < (m->nr); i++) + for (i = 0; i < (m->nr); i++) { + p = m->row[i]; if(p) { p->next[mLEFT]->next[mRIGHT] = 0; while(p) { @@ -474,6 +475,7 @@ p = pt; } } + } free(m->row); free(m->column); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mio...@us...> - 2009-08-17 21:56:43
|
Revision: 220 http://pntool.svn.sourceforge.net/pntool/?rev=220&view=rev Author: miordache Date: 2009-08-17 21:56:30 +0000 (Mon, 17 Aug 2009) Log Message: ----------- Modified Paths: -------------- pnheaders/matrix.c Modified: pnheaders/matrix.c =================================================================== --- pnheaders/matrix.c 2009-08-17 03:40:04 UTC (rev 219) +++ pnheaders/matrix.c 2009-08-17 21:56:30 UTC (rev 220) @@ -42,11 +42,11 @@ *next = p->next[dir]; return p; } + if(dir == mLEFT) { /* else *next will be set to p in a subsequent line */ + *next = p->next[mLEFT]; + return 0; + } } - if(dir == mLEFT) { - *next = p->next[mLEFT]; - return 0; - } } else {/* that is, if(dir == mDOWN || dir == mUP) */ p = m->column[jj]; @@ -58,11 +58,11 @@ *next = p->next[dir]; return p; } + if(dir == mUP) { /* else *next will be set to p in a subsequent line */ + *next = p->next[mUP]; + return 0; + } } - if(dir == mUP) { - *next = p->next[mUP]; - return 0; - } } *next = p; return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ste...@us...> - 2009-08-17 03:40:12
|
Revision: 219 http://pntool.svn.sourceforge.net/pntool/?rev=219&view=rev Author: StephenCamp Date: 2009-08-17 03:40:04 +0000 (Mon, 17 Aug 2009) Log Message: ----------- Dp4 (the older version of dp) is now implemented by dp4.c. Dp4's pn2acpn calls have been replaced with pn2eacpn calls. Modified Paths: -------------- spnbox/Makefile spnbox/tests/Makefile Added Paths: ----------- spnbox/dp4.c Modified: spnbox/Makefile =================================================================== --- spnbox/Makefile 2009-08-17 02:22:15 UTC (rev 218) +++ spnbox/Makefile 2009-08-17 03:40:04 UTC (rev 219) @@ -3,7 +3,10 @@ COMPILER=gcc -g -all: actn.o admcon.o asiph.o avpr.o chkcons.o deallocation.o extendedmatrix.o ilpadm.o ipslv.o ipsolve.o isadm.o issiph.o linenf.o matrixmath.o MemoryManager.o msplit.o nltrans.o pn2acpn.o pn2eacpn.o supervis.o liblpsolve55.a +all: actn.o admcon.o asiph.o avpr.o chkcons.o deallocation.o dp.o dp4.o\ + extendedmatrix.o fvpr.o ilpadm.o ipslv.o ipsolve.o isadm.o issiph.o\ + linenf.o matrixmath.o MemoryManager.o msplit.o nltrans.o pn2acpn.o\ + pn2eacpn.o reduce.o supervis.o tactn.o liblpsolve55.a actn.o: actn.c spnbox.h MemoryManager.h matrixmath.h ../pnheaders/general.h ../pnheaders/matrix.h $(COMPILER) -c actn.c @@ -23,9 +26,12 @@ deallocation.o: deallocation.c spnbox.h ../pnheaders/matrix.h $(COMPILER) -c deallocation.c -dp.o: dp.c spnbox.h matrixmath.h extendendmatrix.h ../pnheaders/general.h ../pnheaders/matrix.h ../pnheaders/pns.h +dp.o: dp.c spnbox.h matrixmath.h extendedmatrix.h ../pnheaders/general.h ../pnheaders/matrix.h ../pnheaders/pns.h $(COMPILER) -c dp.c +dp4.o: dp4.c spnbox.h matrixmath.h extendedmatrix.h ../pnheaders/general.h ../pnheaders/matrix.h ../pnheaders/pns.h + $(COMPILER) -c dp4.c + extendedmatrix.o: extendedmatrix.c extendedmatrix.h ../pnheaders/general.h ../pnheaders/matrix.h $(COMPILER) -c extendedmatrix.c @@ -73,6 +79,10 @@ supervis.o: supervis.c spnbox.h matrixmath.h ../pnheaders/matrix.h $(COMPILER) -c supervis.c + +tactn.o: tactn.c spnbox.h ../pnheaders/matrix.h ../pnheaders/pns.h matrixmath.h MemoryManager.h + $(COMPILER) -c tactn.c + liblpsolve55.a: ../third-party/lp_solve_5.5/lpsolve55/liblpsolve55.a cp ../third-party/lp_solve_5.5/lpsolve55/liblpsolve55.a liblpsolve55.a Added: spnbox/dp4.c =================================================================== --- spnbox/dp4.c (rev 0) +++ spnbox/dp4.c 2009-08-17 03:40:04 UTC (rev 219) @@ -0,0 +1,2186 @@ +#include <stdlib.h> +#include <stdio.h> +#include <time.h> +#include "../pnheaders/general.h" +#include "../pnheaders/matrix.h" +#include "../pnheaders/pns.h" +#include "matrixmath.h" +#include "extendedmatrix.h" +#include "spnbox.h" + +typedef struct dpState +{ + unsigned dptype : 2; /*Type of supervision: 0 = deadlock prevention, 1 = + liveness enforcement, 2 = T-liveness enforcement.*/ + unsigned unique : 1; /*1 indicates a unique nonzero active subnet this + iteration?*/ + unsigned perm : 1; /*1 indicates successful siphon control.*/ + unsigned anetfail : 1; /*1 if the active subnet does not contain all + transitions in the net (DP and LE case) or all + transitions of T (T-LE case).*/ + unsigned incon : 1; /*1 if initial constraints exist.*/ + unsigned uncontro : 1; /*1 if uncontrollable and/or unobservable transitions + exist.*/ + unsigned usfl : 1; /*1 if redundant constraints have been eliminated.*/ + unsigned nolive : 1; /*1 if no liveness-enforcing supervisor exists.*/ + unsigned noTlive : 1; /*1 if no T-liveness-enforcing supervisor exists.*/ +} dpState; + +typedef struct dpData +{ + dpState state; + /*Various matrices*/ + matrix Dm, Dp, DI, Dcm, Dcp, L, L0, M; + /*Constraint-related vectors*/ + int *B, *B0, *G; + /*Place lists:*/ + int *opl; /*Original places*/ + int *ipl; /*Independent places*/ + int *dpl; /*Dependent places*/ + int *apl; /*Active places*/ + int *upl; /*Useful places*/ + int *cpl; /*New control places added during a third-level sub-iteration.*/ + int *ExcludeT, *IncludeT; /*Transitions that must be included in or excluded + from use in subnet computation.*/ + int *TA; /*Active transitions.*/ + int *Tuc, *Tuo; /*Uncontrollable and unobservable transitions.*/ + + /*Counts of the list*/ + int opCount, ipCount, dpCount, apCount, upCount, cpCount, ExcludeCount, IncludeCount, TACount, TucCount, TuoCount; + + /*The size of the target Petri net.*/ + int targetRows, targetCols; + + /*The log file pointers.*/ + FILE *log, *dat; + + /*Data related to primary processing runs*/ + int firstpass, restart, run, terminate; + char *status; + + /*Data used during the inner iterations.*/ + int iteration; //Iteration number + int uci, upd, consis; //flags + matrix TSIPH; //All siphons found during a run. + matrix S; //New siphons found during a run. + int ID; +} dpData; + +/*A set of marking constraints. The return type of UpdateMarkingConstraints, +which concatenates the initial marking constraints with the ordinary marking +constraints.*/ +typedef struct MarkingConstraints +{ + matrix L; + int *B; +} MarkingConstraints; + +/*Functions used by dp, implemented in this file. See individual functions for +more information.*/ +static int CheckParams(dp_p *p); +static void Sort(int* array, int length); +static void AddToArray(int** array, int length, int item); +static void AddToIndexArray(int** array, int* length, int item); +static void UpdateDPData(dpData *data, char* description, void *newData); +static MarkingConstraints UpdateMarkingConstraints(dpData *d); +static dpData CreateDpData(dp_p *p); +static void InitDpData(dp_p *p, dpData* d); +static void PrintMessage(dpData* d, char* message); +static void PrintState(dpData *d); +static void asbnmessage(dpData *d); +static void EnforceMarkingConstraints(dpData* d); +static void UpdateActiveNet(dpData* d); +static int ComputeSiphons(dpData* d); +static void PrintConstraints(dpData *d, matrix *l, int b, int *siphon, int cpl, int wn); +static void BuildSiphonConstraint(dpData* d, matrix* l, int* b, matrix* a, int *siphon); +static void AddSiphonExclusions(dpData* d, int* siphon); +static admcon_p BuildAdmconParams(dpData* d, int* siphon); +static int DoConstraintsApplyToAll(dpData *d, supervis_r* supervisRes, matrix* a, int* siphon); +static void CleanupSiphonChanges(dpData* d); +static void EnforceSiphonConstraints(dpData *d); +static void EnforceSiphonConstraints(dpData *d); +static void ReduceLB(dpData *d); +static char* ListTransitions(int* list, int listCount); +static void PrintConstraintSet(matrix* L, int* B, FILE* log); +static void FinalPrint(dpData* d); +static void FreeDpParts(dpData* d); + +dp_r dp(dp_p* params, int ID) +{ + dp_r result; + int i, j, flag; + memset(&result, 0, sizeof(dp_r)); + /*Check the parameters.*/ + if (! CheckParams(params)) + { + return result; + } + + /*Initialize the data structure.*/ + dpData d = CreateDpData(params); + d.ID = ID; + /*Initial message printing.*/ + if (is_verbose() >= VRB_DP) + { + switch(d.state.dptype) + { + case 0: + printf("Producing a deadlock prevention supervisor...\n"); + break; + case 1: + printf("Producing a liveness enforcing supervisor...\n"); + break; + case 2: + printf("Producing a T-liveness enforcing supervisor...\n"); + break; + } + } + + /*Make sure the constraints are consistent: Get a set of complete constraints + and then check it using chkcons.*/ + MarkingConstraints cons = UpdateMarkingConstraints(&d); + if (cons.L.type) + { + chkcons_r chkconsRes = chkcons(&cons.L, cons.B, 0, 0); + /*If resCount is 0, it means the constraints are redundant.*/ + if (! chkconsRes.resCount) + { + if (d.log) + { + fprintf(d.log, "\n\nInconsistent set of constraints. Relax (L, B) and (L0, B0)."); + } + if (is_verbose() > VRB_DP) + { + printf("\n\nInconsistent set of constraints. Relax (L, B) and (L0, B0).\n"); + } + /*Mark for termination.*/ + d.terminate = 1; + } + DeallocateMatrix(&cons.L); + free(cons.B); + DeallocateChkcons(&chkconsRes); + } + + /*Main processing begins here.*/ + while ((d.restart || d.firstpass) && ! d.terminate) + { + d.restart = 0; + if (++d.run > 1 && is_verbose() >= VRB_DP) + { + printf("\n ====================== RUN %d ========================\n",d.run); + } + + /*Setup the dp data for this run.*/ + InitDpData(params, &d); + + /*If there are marking constraints, enforce them.*/ + EnforceMarkingConstraints(&d); + + /*Build the useful places list: include all places initially.*/ + if (d.upl) free(d.upl); + d.upCount = NumberOfRows(d.Dm); + d.upl = tcalloc(d.upCount, sizeof(int)); + for (i = 0; i < d.upCount; i++) + { + d.upl[i] = i; + } + + /*More log/verbose output output.*/ + if (d.log) + { + if (d.firstpass) + { + fprintf(d.dat, "\nStarting with the Petri net:"); + } + else + { + fprintf(d.dat, "\n ================= RUN NO. %d ================\n", d.run); + } + fflush(d.dat); + PrintState(&d); + } + if (is_verbose() >= VRB_DP) + { + asbnmessage(&d); + } + + /*Do an msplit.*/ + msplit_r msplitRes = msplit(&d.Dm, &d.Dp, 0, &d.M, &d.L0, &d.L, d.ipl, d.ipCount, d.dpl, d.dpCount, 0, 0); + UpdateDPData(&d, "free matrix Dm Dp M L0 L ipl ipCount free TD free intarray", &msplitRes); + + /*Update the listing of the active subnet.*/ + UpdateActiveNet(&d); + + /*Get ready for the inner iteration loop. Initialize TSIPH, the listing + of active siphons found this primary iteration, set the iteration number to + 1, and clear the uci flag.*/ + /*TSIPH should be initialized for column ops, as a siphon is recorded as + a column.*/ + if (d.TSIPH.type) DeallocateMatrix(&d.TSIPH); + AllocateMatrixType(2, &d.TSIPH, 0, NumberOfRows(d.Dm)); + TransposeMatrix(&d.TSIPH); + d.iteration = 1; + d.uci = 0; + + /*The inner iteration loop.*/ + while (! d.terminate) + { + /*Log and verbosity stuff.*/ + d.upd = 1; + if (d.log) + { + if (d.firstpass) fprintf(d.dat, "\nIteration %d", d.iteration); + else fprintf(d.dat, "\nRun %d, iteration %d", d.run, d.iteration); + fflush(d.dat); + } + + /*Do the actual siphon computation. This function returns the number + of new siphons. If there were no new siphons, terminate the loop.*/ + if (! ComputeSiphons(&d)) break; + + /*Build constraints from the siphons and enforce them.*/ + EnforceSiphonConstraints(&d); + + /*Cleanup and finish applying the changes made to this point.*/ + CleanupSiphonChanges(&d); + d.iteration++; + } + d.firstpass = 0; + d.terminate = ! d.restart; + } + /*Bring the marking constraints down to target size.*/ + if (NumberOfColumns(d.L) - d.targetRows > 0) + { + RemoveColumns(&d.L, d.targetRows, NumberOfColumns(d.L) - d.targetRows, -1); + } + if (NumberOfColumns(d.L0) - d.targetRows > 0) + { + RemoveColumns(&d.L0, d.targetRows, NumberOfColumns(d.L0) - d.targetRows, -1); + } + + /*If there are any active transitions left, remove redundant constraints.*/ + if (d.TACount) + { + ReduceLB(&d); + } + + /*Build the result.*/ + result.Lf = d.L; + result.Bf = d.B; + result.L0f = d.L0; + result.B0f = d.B0; + result.how = d.status; + + /*Do log printing and closeout.*/ + if (d.log) + { + FinalPrint(&d); + fclose(d.log); + fclose(d.dat); + if (is_verbose() >= VRB_DP) + { + printf("\nOutput written to dp.log and dp.dat\n"); + } + } + + /*Free up other memory.*/ + FreeDpParts(&d); + + return result; +} + +/******************************************************************************* +FreeDpParts frees up parts of the dpData structure that are not being used as +part of the return value.*/ +void FreeDpParts(dpData* d) +{ + int i; + DeallocateMatrix(&d->Dm); + DeallocateMatrix(&d->Dp); + DeallocateMatrix(&d->DI); + DeallocateMatrix(&d->Dcm); + DeallocateMatrix(&d->Dcp); + DeallocateMatrix(&d->M); + free(d->G); + free(d->opl); + free(d->ipl); + free(d->dpl); + free(d->apl); + free(d->upl); + free(d->cpl); + free(d->ExcludeT); + free(d->IncludeT); + free(d->TA); + free(d->Tuc); + free(d->Tuo); + + DeallocateMatrix(&d->TSIPH); + /*S may not ever have been allocated if no new siphons were found.*/ + if (d->S.type) DeallocateMatrix(&d->S); + memset(d, 0, sizeof(dpData)); +} + +/******************************************************************************* +FinalPrint prints the final data to the log and the data file.*/ +void FinalPrint(dpData* d) +{ + /*Generate a list that is the intersection of T and TA.*/ + int *TinTA; + int TinTACount = 0, i, j; + if (d->TACount && d->IncludeCount) + { + TinTA = tcalloc(d->TACount < d->IncludeCount ? d->TACount : d->IncludeCount, sizeof(int)); + for (i = 0, j = 0; i < d->TACount && j < d->IncludeCount; i++) + { + while(d->IncludeT[j] < d->TA[i]) j++; + if (d->IncludeT[j] == d->TA[i]) + { + TinTA[TinTACount++] = d->TA[i]; + } + } + } + /*flags*/ + int failed = ! strcmp(d->status, HOW_FAILED); + int impossible = ! strcmp(d->status, HOW_IMPOSSIBLE); + int ok = ! strcmp(d->status, HOW_OK); + char *achieve, *supname, *tmp;; + + fprintf(d->log, "\n\n===============================================================================\n\n"); + if (d->state.dptype == 0) + { + if (ok) + { + fprintf(d->log, "The generated supervisor is "); + if (d->state.perm && d->state.unique) + { + fprintf(d->log, "the least restrictive "); + if (d->state.anetfail) + { + fprintf(d->log, "T-"); + achieve = "T-live"; + } + else + { + achieve = "live"; + } + fprintf(d->log, "liveness enforcing supervisor."); + if (d->state.anetfail) + { + fprintf(d->log, "\nThe set T is:\nT = %s", ListTransitions(d->TA, d->TACount)); + } + } + else if (d->state.perm) + { + fprintf(d->log, "guaranteed to prevent total deadlock"); + achieve = "deadlock-free"; + if (d->state.anetfail) + { + fprintf(d->log, " in the subsystem containing the transitions\nT = %s", ListTransitions(d->TA, d->TACount)); + fprintf(d->log, "The supervisor may not enforce T-liveness.\n"); + fprintf(d->log, "The supervisor is guaranteed to be at least as permissive as the least\n"); + fprintf(d->log, "restrictive T-liveness enforcing supervisor."); + } + else + { + fprintf(d->log, ".\nThe supervisor may not enforce liveness.\n"); + fprintf(d->log, "The supervisor is guaranteed to be at least as permissive as the least\n"); + fprintf(d->log, "restrictive liveness enforcing supervisor"); + } + } + else + { + fprintf(d->log, "guaranteed to prevent total deadlock"); + achieve = "deadlock-free"; + if (d->state.anetfail) + { + fprintf(d->log, " in the subsystem containing the transitions\nT = %s", ListTransitions(d->TA, d->TACount)); + fprintf(d->log, "The supervisor may not enforce T-liveness.\n"); + } + else + { + fprintf(d->log, ".\nThe supervisor may not enforce liveness.\n"); + } + } + } + else if (impossible) + { + fprintf(d->log, "No deadlock prevention supervisors exist."); + if (d->state.incon && d->state.uncontro) + { + fprintf(d->log, "\nDeadlock prevention supervisors may exist for other initial constraints."); + } + else if (d->state.incon) + { + fprintf(d->log, "\nDeadlock prevention supervisors exist for other initial constraints."); + } + } + else if (failed) + { + fprintf(d->log, "The procedure could not generate a deadlock prevention supervisor."); + } + } + else + { + if (d->state.dptype == 1) + { + supname = "liveness"; + tmp = "live"; + } + else + { + supname = "T-liveness"; + tmp = "T-live"; + } + if (ok) + { + fprintf(d->log, "The generated supervisor is "); + if (d->state.unique && d->state.perm) + { + fprintf(d->log, "the least restrictive "); + if (d->state.anetfail) + { + fprintf(d->log, "Tx-liveness"); + achieve = "Tx-live"; + } + else + { + fprintf(d->log, "%s", supname); + achieve = tmp; + } + fprintf(d->log, " enforcing supervisor"); + if (d->state.anetfail) + { + fprintf(d->log, "The set Tx is:\nTx = %s", ListTransitions(d->TA, d->TACount)); + } + } + else + { + fprintf(d->log, "guaranteed to enforce"); + if (d->state.anetfail) + { + fprintf(d->log, "Tx-liveness in the subsystem containing the transitions\n"); + fprintf(d->log, "Tx = %s", ListTransitions(TinTA, TinTACount)); + achieve = "Tx-live"; + } + else + { + fprintf(d->log, "%s, ", supname); + achieve = tmp; + } + fprintf(d->log, "and may not be the least restrictive"); + } + if (d->state.perm && ! d->state.unique) + { + fprintf(d->log, "\nThe supervisor is the least restrictive Ta-liveness "); + fprintf(d->log, "enforcing supervisor for\nTa = %s", ListTransitions(d->TA, d->TACount)); + } + if (d->state.nolive) + { + fprintf(d->log, "\nNo liveness enforcing supervisor exists."); + } + if (d->state.noTlive) + { + fprintf(d->log, "\nNo T-livenss enforcing supervisor exists."); + } + } + else if (failed) + { + fprintf(d->log, "The procedure could not generate a liveness or T-liveness enforcing supervisor."); + } + else if (impossible) + { + fprintf(d->log, "No liveness/Tx-liveness enforcing supervisors exist, for any nonempty Tx."); + fprintf(d->log, "\nEven deadlock prevention is impossible."); + } + } + if (! ok) return; + switch(d->state.dptype) + { + case 0: + supname = "deadlock-free"; + break; + case 1: + supname = "live"; + break; + case 2: + supname = "T-live"; + break; + } + + if (! (NumberOfRows(d->L) && NumberOfRows(d->L0))) + { + fprintf(d->log, "\nNo constraints are needed: the Petri net is %s for all initial\nmarkings.", supname); + } + else + { + if (NumberOfRows(d->L)) + { + fprintf(d->log, "\nThe supervisor is defined by the following constraints:\n"); + PrintConstraintSet(&d->L, d->B, d->log); + } + if (NumberOfRows(d->L0)) + { + if (NumberOfRows(d->L)) + { + fprintf(d->log, "\n\nIn addition to the inequalities above, the initial marking \"i\" must satisfy:\n"); + } + else + { + fprintf(d->log, "\n\nThe target Petri net is %s for all intiial markings \"i\" satisfying\n", achieve); + } + PrintConstraintSet(&d->L0, d->B0, d->log); + } + } + if (d->state.usfl) + { + fprintf(d->log, "\n\n(The redundant constraints have been eliminated.)"); + } + fflush(d->log); + free(TinTA); +} + +/******************************************************************************* +PrintConstraintSet prints the constraints represented by the matrix L and the +integer array B in pretty format to the file given.*/ +void PrintConstraintSet(matrix* L, int* B, FILE* log) +{ + int i; + matrix lrow; + AllocateMatrix(&lrow, 1, NumberOfColumns(*L)); + for (i = 0; i < NumberOfRows(*L); i++) + { + CopyBlock(1, NumberOfColumns(*L), L, i, 0, &lrow, 0, 0); + fprintf(log, "\n%s >= %d", avpr(&lrow, 0, DISPLAY_MATRIX | DISPLAY_OFFSET, "m", 0), B[i]); + } + fflush(log); + DeallocateMatrix(&lrow); +} + +/******************************************************************************* +ListTransitions generates a pretty form of a transition index list.*/ +char* ListTransitions(int* list, int listCount) +{ + static char* buffer = 0; + static int bufferlength = 0; + char element[32]; + int i = 0, charsPerElement = 3, newbufferlength; + /*Compute the necessary buffer length.*/ + /*Take the log (to find the digit count) of the highest index.*/ + if (listCount) i = list[listCount - 1] + 1; + while (i) + { + charsPerElement++; + i /= 10; + } + if ((newbufferlength = charsPerElement * listCount + 4) > bufferlength) + { + free(buffer); + bufferlength = newbufferlength; + buffer = tcalloc(bufferlength, sizeof(char)); + } + + /*Fill the string.*/ + strcpy(buffer, "{"); + for (i = 0; i < listCount - 1; i++) + { + sprintf(element, "t%d, ", list[i] + 1); + strcat(buffer, element); + } + if (listCount) + { + sprintf(element, "t%d", list[listCount - 1]); + strcat(buffer, element); + } + strcat(buffer, "}\n"); + return buffer; +} + +/******************************************************************************* +ReduceLB removes redundant constraints.*/ +void ReduceLB(dpData *d) +{ + MarkingConstraints cons = UpdateMarkingConstraints(d); + //If there are no constraints, return immediately. + if (! cons.L.type) return; + + reduce_r rcons = reduce(&cons.L, cons.B); + free(cons.B); + DeallocateMatrix(&cons.L); + int i, j, k, count = 0; + /*We need to know which indices in the useful-places list returned by reduce + correspond to L rows and which correspond to L0 rows. Find the break.*/ + Sort(rcons.indf, NumberOfRows(rcons.Lf)); + for (count = 0; count < NumberOfRows(rcons.Lf) && rcons.indf[count] < NumberOfRows(d->L); count++); + /*The new marking constraint matrix will be all rows of the original that + are present in the list of useful rows returned by reduce. Remove all other + rows.*/ + j = NumberOfRows(d->L) - 1; + for (i = count - 1; i >= -1; i--) + { + while((i >= 0) ? j > rcons.indf[i] : j >= 0) + { + /*Remove the appropriate row from L.*/ + RemoveRows(&d->L, j, 1, -1); + /*Remove the appropriate entry from B.*/ + for (k = j; k < NumberOfRows(d->L); k++) + { + d->B[k] = d->B[k + 1]; + } + j--; + } + j--; + } + /*The new initial marking constraint will be all rows of the original that + are present in the list of useful rows returned by reduce. Remove all other + rows.*/ + j = NumberOfRows(d->L0) - 1; + for (i = NumberOfRows(rcons.Lf) - 1; i >= count - 1; i--) + { + while((i >= count) ? j > rcons.indf[i] - NumberOfRows(d->L) : j >= 0) + { + RemoveRows(&d->L0, j, 1, -1); + for (k = j; k < NumberOfRows(d->L0); k++) + { + d->B0[k] = d->B0[k + 1]; + } + j--; + } + j--; + } + /*Set the useful flag.*/ + d->state.usfl = (NumberOfRows(d->L) + NumberOfRows(d->L0) - NumberOfRows(rcons.Lf)) ? 1 : 0; + /*Free up memory used by the reduce-call result.*/ + DeallocateReduce(&rcons); +} + +/******************************************************************************* +EnforceSiphonConstraints creates and enforces new constraints based on the new +siphon lists.*/ +void EnforceSiphonConstraints(dpData *d) +{ + /*We will need several vectors with elements for each independent place. + Allocate space now.*/ + matrix l, l2, a; + AllocateMatrix(&a, 0, 0); + int siphon, i, j, k, b, x, flag, siphons; + int* currentSiphon; + /*Zero the (new) control place list.*/ + free(d->cpl); + d->cpl = 0; + d->cpCount = 0; + siphons = NumberOfColumns(d->S); + currentSiphon = tcalloc(NumberOfRows(d->S), sizeof(int)); + + /*Iterate through each new siphon.*/ + for (siphon = 0; siphon < siphons; siphon++) + { + /*Get a copy of the current siphon as an integer array.*/ + for (i = 0; i < NumberOfRows(d->S); i++) + { + currentSiphon[i] = GetMatrixEl(&d->S, i, siphon) ? 1 : 0; + } + AllocateMatrixType(2, &l, 1, d->ipCount); + DeallocateMatrix(&a); + AllocateMatrixType(1, &a, 1, NumberOfRows(d->Dm)); + + char message[64]; + /*Message printing.*/ + if (is_verbose() >= VRB_DP) + { + sprintf(message, "\nWorking on siphon %d of %d...", siphon + 1, siphons); + PrintMessage(d, message); + } + + /*Build a constraint based on this siphon.*/ + BuildSiphonConstraint(d, &l, &b, 0, currentSiphon); + + /*Check to see if the constraint is redundant.*/ + MarkingConstraints cons = UpdateMarkingConstraints(d); + chkcons_r chkconsRes; + + if (cons.L.type) + { + chkconsRes = chkcons(&cons.L, cons.B, &l, b); + } + else + { + /*If there are no constraints, then the proposed constraint is + nonredundant. Note this to be the case.*/ + memset(&chkconsRes, 0, sizeof(chkcons_r)); + chkconsRes.resCount = 1; + } + /*If res is not empty, the constraint is not redundant.*/ + if (chkconsRes.resCount) + { + DeallocateChkcons(&chkconsRes); + /*Build the admcon parameters.*/ + admcon_p admconP = BuildAdmconParams(d, currentSiphon); + /*Make the admcon call.*/ + admcon_r admconRes = admcon(&admconP); + /*Free the memory that was allocated for the admcon parameters.*/ + free(admconP.ntr); + + /*If admcon found an admissible constraint...*/ + if (admconRes.how) + { + /*Turn it into a constraint matrix and enforce it.*/ + for (i = 0; i < admconRes.lCount; i++) + { + SetMatrixEl(&a, 0, i, admconRes.l[i]); + } + supervis_r supervisRes = supervis(&d->Dp, &d->Dm, &a); + + /*Build l and b as before, but this time using a as the source.*/ + BuildSiphonConstraint(d, &l, &b, &a, 0); + /*Check the constraints if applicable.*/ + if (d->consis) + { + /*We are checking constraints for consistency, not redundancy - add + the proposed new constraint to the set of constraints. Use a copy + so that the memory can be absorbed into L in an optimized operation.*/ + AddToArray(&cons.B, NumberOfRows(cons.L), b); + AllocateMatrixType(2, &l2, 1, NumberOfColumns(l)); + CopyMatrix(&l, &l2); + InsertRows(&cons.L, &l2, -1, -1); + chkconsRes = chkcons(&cons.L, cons.B, 0, 0); + } + else + { + memset(&chkconsRes, 0, sizeof(chkcons_r)); + chkconsRes.resCount = 1; + } + /*We want to find out if there exist any elements of the vector a such + that their zero/nonzero state is the opposite of that of the current + siphon.*/ + x = 0; + for (i = 0; i < NumberOfRows(d->S); i++) + { + if ((! GetMatrixEl(&d->S, i, siphon)) != (! GetMatrixEl(&a, 0, i))) + { + /*If such a place is encountered, set the generic variable x to 2 for + later use as a function parameter.*/ + x = 2; + break; + } + } + /*If no such place existed, clear perm.*/ + if (! x) d->state.perm = 0; + + /*If the constraints were consistent, get ready to add them either to + L, B or L0, B0.*/ + if (chkconsRes.resCount) + { + DeallocateChkcons(&chkconsRes); + /*Find out whether these constraints should apply to the marking at + all times or just to the initial marking.*/ + if (DoConstraintsApplyToAll(d, &supervisRes, &a, currentSiphon)) + { + /*Print constraint data.*/ + if (d->log) PrintConstraints(d, &l, b, currentSiphon, NumberOfRows(d->Dm), x); + /*Add the new place index to the dependent place list, the useful + places list, and the new control places list.*/ + AddToIndexArray(&d->dpl, &d->dpCount, NumberOfRows(supervisRes.Dfm) - 1); + AddToIndexArray(&d->upl, &d->upCount, NumberOfRows(supervisRes.Dfm) - 1); + AddToIndexArray(&d->cpl, &d->cpCount, NumberOfRows(supervisRes.Dfm) - 1); + /*Dm and Dp should be set to the supervised net Dfm and Dfp.*/ + UpdateDPData(d, "Dm Dp", &supervisRes); + memset(&supervisRes, 0, sizeof(supervis_r)); + /*Add to the constraints. Make a copy of l first so that we can do + optimized row-adds and not do too many allocations.*/ + AllocateMatrixType(2, &l2, 1, NumberOfColumns(l)); + CopyMatrix(&l, &l2); + AddToArray(&d->B, NumberOfRows(d->L), b); + AddToArray(&d->G, NumberOfRows(d->L), b); + InsertRows(&d->L, &l, -1, -1); + InsertRows(&d->M, &l2, -1, -1); + /*Add a null row to the end of S and allocate enough space for the + new siphon array.*/ + InsertNullRows(&d->S, -1, 1, -1); + int *newCSiphon = tcalloc(NumberOfRows(d->S), sizeof(int)); + memcpy(newCSiphon, currentSiphon, sizeof(int) * (NumberOfRows(d->S) - 1)); + free(currentSiphon); + currentSiphon = newCSiphon; + } + else + { + /*Add the built constraint to the initial marking constraints.*/ + if (d->log) PrintConstraints(d, &l, b, currentSiphon, 0, x); + AddToArray(&d->B0, NumberOfRows(d->L0), b); + InsertRows(&d->L0, &l, -1, -1); + } + } + else + { + /*If the constraints were redundant, just do a constraint printing + with no new constraints. Also deallocate l.*/ + DeallocateMatrix(&l); + if (d->log) PrintConstraints(d, 0, 0, currentSiphon, -1, x); + d->upd = 0; + /*Add some indices to X: those transitions such that they have nonzero + output arcs from at least one of the places in the current siphon.*/ + AddSiphonExclusions(d, currentSiphon); + d->state.perm = d->state.perm > 1 ? 2 : 0; + d->restart = 1; + d->terminate = 1; + } + /*Deallocate the supervis result if it still needs to be deallocated.*/ + DeallocateSupervis(&supervisRes); + } + else + { + /*If admcon could not find admissible constraints, add to the excluded + transition list in the same way we did earlier.*/ + AddSiphonExclusions(d, currentSiphon); + d->uci = 1; + d->state.perm = 0; + d->upd = 0; + if (d->log) PrintConstraints(d, 0, 0, currentSiphon, -2, 1); + } + DeallocateAdmcon(&admconRes); + } + else + { + if (d->log) PrintConstraints(d, 0, 0, currentSiphon, -1, 0); + } + /*If l has not been absorbed into something else, deallocate it here.*/ + if (l.type) DeallocateMatrix(&l); + if (NumberOfRows(cons.L)) + { + DeallocateMatrix(&cons.L); + free(cons.B); + } + } + DeallocateMatrix(&a); + free(currentSiphon); +} + +/******************************************************************************* +CleanupSiphonChanges is a subroutine of EnforceSiphonConstraints. It performs a +transition split and an eac-net conversion on the net, then updates the active +subnet listing.*/ +void CleanupSiphonChanges(dpData* d) +{ + int i, j, k; + + /*Transition split.*/ + msplit_r msplitRes = msplit(&d->Dm, &d->Dp, 0, &d->M, &d->L0, &d->L, d->ipl, d->ipCount, d->dpl, d->dpCount, 0, 0); + UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount free TD free intarray", &msplitRes); + + /*If we are doing any kind of liveness enforcement, convert the net to an + eac-net.*/ + if (d->state.dptype) + { + /*We need a flag array for the new control places.*/ + int *ncp = tcalloc(NumberOfRows(d->Dm), sizeof(int)); + for (i = 0; i < d->cpCount; i++) + { + ncp[d->cpl[i]] = 1; + } + /* For debugging purposes, we replace the pn2eacpn call with a pn2acpn call.*/ + pn2eacpn_r pn2eacpnRes = pn2eacpn(&d->Dm, &d->Dp, ncp, &d->M, &d->L0, &d->L, d->ipl, d->ipCount, d->dpl, d->dpCount, 0, 0); + UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount free TD free intarray", &pn2eacpnRes); + /* + pn2acpn_r pn2acpnRes = pn2acpn(&d->Dm, &d->Dp, ncp, &d->M, &d->L0, &d->L, d->ipl, d->ipCount, d->dpl, d->dpCount); + UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount", &pn2acpnRes);*/ + + free(ncp); + } + + tactn_r tactnRes; + actn_r actnRes; + /*Update the active subnet.*/ + if (is_verbose() >= VRB_DP) + { + PrintMessage(d, "Updating the active subnet..."); + } + if (d->state.dptype) + { + if (d->upd) + { + tactnRes = tactn(&d->Dm, &d->Dp, d->IncludeT, d->IncludeCount, d->ExcludeT, d->ExcludeCount, &d->Dcm, &d->Dcp, 0); + UpdateDPData(d, "Dcm Dcp free matrix free matrix TA TACount", &tactnRes); + } + else + { + tactnRes = tactn(&d->Dm, &d->Dp, d->IncludeT, d->IncludeCount, d->ExcludeT, d->ExcludeCount, 0, 0, 1); + d->state.unique = tactnRes.unique; + UpdateDPData(d, "Dcm Dcp free matrix free matrix TA TACount", &tactnRes); + } + } + else + { + if (d->upd) + { + actnRes = actn(&d->Dm, &d->Dp, d->ExcludeT, d->ExcludeCount, &d->Dcm, &d->Dcp, 1, 0); + UpdateDPData(d, "Dcm Dcp free matrix free matrix TA TACount", &actnRes); + } + else + { + actnRes = actn(&d->Dm, &d->Dp, d->ExcludeT, d->ExcludeCount, &d->Dcm, &d->Dcp, 0, 1); + d->state.unique = actnRes.unique; + UpdateDPData(d, "Dcm Dcp free matrix free matrix TA TACount", &actnRes); + } + } + /*Update the exclusion list. It should include all transitions which are + inactive. We can build this list from the active transition list already + computed.*/ + free(d->ExcludeT); + d->ExcludeCount = NumberOfColumns(d->Dm) - d->TACount; + if (d->ExcludeCount) + { + d->ExcludeT = tcalloc(d->ExcludeCount, sizeof(int)); + j = 0; + k = 0; + for (i = 0; i < d->TACount; i++) + { + while (j < d->TA[i]) + { + d->ExcludeT[k++] = j++; + } + j++; + } + while (k < d->ExcludeCount) + { + d->ExcludeT[k++] = j++; + } + } + else + { + d->ExcludeT = 0; + } + /*If there are no active transitions, set failure and termination flags.*/ + if (! d->TACount) + { + d->terminate = 1; + d->restart = 0; + d->status = HOW_FAILED; + if (d->firstpass && (! d->uci) && ((! d->state.dptype) || d->state.unique)) + { + d->status = HOW_IMPOSSIBLE; + } + } + /*Update the useful places list. It should be all independent places with + indices valid for the target net and all dependent places.*/ + if (d->upd) + { + /*Find the number of independent places to use.*/ + for (i = 0; i < d->ipCount; i++) + { + if (d->ipl[i] >= d->targetRows) break; + } + /*i now contains the number of independent places that we want to use. + Update the total count and allocate memory.*/ + free(d->upl); + d->upCount = i + d->dpCount; + d->upl = tcalloc(d->upCount, sizeof(int)); + /*Fill in the independent places.*/ + for (j = 0; j < i; j++) + { + d->upl[j] = d->ipl[j]; + } + /*Fill in the dependent places*/ + for (j = 0; j < d->dpCount; j++) + { + d->upl[i + j] = d->dpl[j]; + } + /*Sort the list.*/ + if (d->upCount) Sort(d->upl, d->upCount); + } +} + +/******************************************************************************* +DoConstraintsApplyToAll is a subroutine of EnforceSiphonConstraints. It +determines if a set of constraints generated in an admcon call should be added +as constraints on marking at any time or only on initial marking. It returns +nonzero to indicate the former and zero to indicate the latter.*/ +int DoConstraintsApplyToAll(dpData *d, supervis_r* supervisRes, matrix* a, int *siphon) +{ + int flag = 0, i, j; + /*Iterate through transitions*/ + for (i = 0; i < NumberOfColumns(supervisRes->Dfm); i++) + { + /*Is there an output arc from the new place and no input arc to the + new place?*/ + if (GetMatrixEl(&supervisRes->Dfm, NumberOfRows(supervisRes->Dfm) - 1, i) && ! GetMatrixEl(&supervisRes->Dfp, NumberOfRows(supervisRes->Dfp) - 1, i)) + { + /*Check to make sure there are no input arcs to any transitions in + the siphon.*/ + for (j = 0; j < NumberOfRows(d->S); j++) + { + if (GetMatrixEl(&supervisRes->Dfp, j, i) && siphon[j]) break; + } + /*If there were none, set the flag and break out of the loop.*/ + if (j == NumberOfRows(d->S)) + { + flag = 1; + break; + } + } + } + /*If the flag has no yet been set, it may be set if there are any + elements of a such that they are not equal to the corresponding + elements in the current siphon.*/ + if (! flag) + { + for (i = 0; i < NumberOfColumns(*a); i++) + { + if (GetMatrixEl(a, 0, i) != siphon[i]) + { + flag = 1; + break; + } + } + } + return flag; +} + +/******************************************************************************* +BuildAdmconParams is a subroutine of EnforceSiphonConstraints. It fills an +admcon_p structure with the parameters necessary to make the admcon call.*/ +admcon_p BuildAdmconParams(dpData* d, int* siphon) +{ + /*We'll need an updated copy of the active place list. Build it now.*/ + int *newApl = tcalloc(NumberOfRows(d->Dcm), sizeof(int)); + int newApCount = 0, i, j; + for (i = 0; i < NumberOfRows(d->Dcm); i++) + { + for (j = 0; j < NumberOfColumns(d->Dcm); j++) + { + if (GetMatrixEl(&d->Dcm, i, j) || GetMatrixEl(&d->Dcp, i, j)) + { + break; + } + } + if (j != NumberOfColumns(d->Dcm)) newApl[newApCount++] = i; + } + free(d->apl); + d->apl = newApl; + d->apCount = newApCount; + + /*Transform the siphon row to an admissible constraint using admcon. + Start by building the admcon call parameters:*/ + admcon_p admconP; + /*Most of the parameters come straight from the problem data.*/ + admconP.siphon = siphon; + admconP.Dm = d->Dm; + admconP.Dp = d->Dp; + admconP.DI = d->DI; + admconP.M = d->M; + admconP.ipl = d->ipl; + admconP.dpl = d->dpl; + admconP.opl = d->opl; + admconP.apl = d->apl; + admconP.Tuc = d->Tuc; + admconP.Tuo = d->Tuo; + admconP.ipCount = d->ipCount; + admconP.dpCount = d->dpCount; + admconP.opCount = d->opCount; + admconP.apCount = d->apCount; + admconP.TucCount = d->TucCount; + admconP.TuoCount = d->TuoCount; + /*For ntr, we build a list of all transitions not part of the original + matrix.*/ + if (NumberOfColumns(d->Dm) - d->targetCols) + { + admconP.ntCount = NumberOfColumns(d->Dm) - d->targetCols; + admconP.ntr = tcalloc(admconP.ntCount, sizeof(int)); + for (i = d->targetCols; i < NumberOfColumns(d->Dm); i++) + { + admconP.ntr[i - d->targetCols] = i; + } + } + else + { + admconP.ntCount = 0; + admconP.ntr = 0; + } + /*We know these parameters are well formed. Skip the (time-consuming) + parameter check.*/ + admconP.skipParamCheck = 1; + return admconP; +} + +/******************************************************************************* +AddSiphonExclusions is called as a subroutine of EnforceSiphonConstraints. It +is used under certain circumstances when a siphon does not result in an +admissible constraint set. It adds to the excluded transition list those +transitions such that they have nonzero output arcs from at least one of the +places in the current siphon.*/ +void AddSiphonExclusions(dpData* d, int* siphon) +{ + /*Build a flag array to indicate the transitions we'll have to add.*/ + int *ExcludeFlag = tcalloc(NumberOfColumns(d->Dm), sizeof(int)); + int i, j, k; + for (i = 0; i < d->ExcludeCount; i++) + { + ExcludeFlag[d->ExcludeT[i]] = 1; + } + /*Find the new transitions.*/ + k = d->ExcludeCount; + for (j = 0; j < NumberOfColumns(d->Dm); j++) + { + for (i = 0; i < NumberOfRows(d->S); i++) + { + if (GetMatrixEl(&d->Dm, i, j) && siphon[i] && ! ExcludeFlag[j]) + { + ExcludeFlag[j] = 1; + k++; + } + } + } + /*Now convert the flag array to an index list. Use the same memory; + this is a waste of memory but avoids an allocation.*/ + free(d->ExcludeT); + d->ExcludeCount = k; + d->ExcludeT = ExcludeFlag; + k = 0; + for (i = 0; i < NumberOfColumns(d->Dm); i++) + { + if (d->ExcludeT[i]) d->ExcludeT[k++] = i; + } +} + +/******************************************************************************* +BuildSiphonConstraint is called as a subroutine of EnforceSiphonConstraints. It +builds a single constraint (a row vector and a constant) based on either the row +vector in matrix form in a or the row vector in array form in siphon. It will +use a if it is present (pointer is non-null).*/ +void BuildSiphonConstraint(dpData *d, matrix* l, int* b, matrix* a, int *siphon) +{ + int i, j; + /*Build a constraint row (l and b) ignoring M.*/ + for (i = 0; i < d->ipCount; i++) + { + SetMatrixEl(l, 0, i, a ? GetMatrixEl(a, 0, d->ipl[i]) : siphon[d->ipl[i]]); + } + *b = 1; + /*Take into account M if it exists.*/ + if (d->M.type && NumberOfRows(d->M) && NumberOfColumns(d->M)) + { + /*Add to each element of l the matrix product of the rows of the siphon + corresponding to dependent places and the transformation matrix M. The + siphon matrix is all 1s and 0s, so we can skip actual multiplication and + just do a test for zero.*/ + for (i = 0; i < NumberOfColumns(d->M); i++) + { + for (j = 0; j < d->dpCount; j++) + { + if (a ? GetMatrixEl(a, 0, d->dpl[j]) : siphon[d->dpl[j]]) + { + SetMatrixEl(l, 0, i, GetMatrixEl(l, 0, i) + GetMatrixEl(&d->M, j, i)); + } + } + } + /*Add to b the matrix product of the column vector G (transposed) and those + elements of the current siphon which correspond to dependent places. Again, + we don't have to actually multiply but merely test for nonzero.*/ + for (i = 0; i < d->dpCount; i++) + { + if (a ? GetMatrixEl(a, 0, d->dpl[i]) : siphon[d->dpl[i]]) *b += d->G[i]; + } + } +} +/******************************************************************************* +This functions prints constraints to the log files during the building and +enforcement of constraints based on siphons.*/ +void PrintConstraints(dpData *d, matrix *l, int b, int *siphon, int cpl, int wn) +{ + int i; + /*Print the siphon*/ + fprintf(d->log, "\nSiphon %s", fvpr(siphon, NumberOfRows(d->S), DISPLAY_INTS, 2)); + switch(cpl) + { + case 0: + /*Display.*/ + fprintf(d->log, "\nNo control places needed. Constraints below added to (L0, B0):"); + fprintf(d->log, "\n%s >= %d", avpr(l, NumberOfColumns(*l), DISPLAY_MATRIX | DISPLAY_OFFSET, 0, 0), b); + break; + case -1: + fprintf(d->log, "\nNo constraints added."); + break; + case -2: + fprintf(d->log, "\nInadmissible constraint."); + break; + default: + fprintf(d->log, "\nPlace %d added to control the siphon and enforce:", cpl); + fprintf(d->log, "\n%s >= %d", avpr(l, NumberOfColumns(*l), DISPLAY_MATRIX | DISPLAY_OFFSET, 0, 0), b); + break; + } + if (wn == 1) fprintf(d->log, "\nSiphon control failure occurred."); + else if (wn == 2) fprintf(d->log, "\nSuboptimal admissibility transformation."); + fprintf(d->log, "\n"); + fflush(d->log); +} + +/******************************************************************************* +ComputeSiphons finds the minimal active siphons for an iteration. It returns the +number of new siphons.*/ +int ComputeSiphons(dpData* d) +{ + /*A status message.*/ + if (is_verbose() > VRB_DP) + { + PrintMessage(d, "Computing the minimal active siphons..."); + } + + /*We'll needs lists of active transitions and places. TA will have just been + updated before this function call. Update apl. To avoid having to iterate + through the whole matrix twice, preallocate newApl to its maximum possible + size.*/ + int *newApl = tcalloc(NumberOfRows(d->Dcm), sizeof(int)); + int i, j; + d->apCount = 0; + for (i = 0; i < NumberOfRows(d->Dcm); i++) + { + for (j = 0; j < NumberOfColumns(d->Dcm); j++) + { + if (GetMatrixEl(&d->Dcm, i, j) || GetMatrixEl(&d->Dcp, i, j)) + { + newApl[d->apCount++] = i; + break; + } + } + } + free(d->apl); + d->apl = newApl; + + /*Build a list of places that will be considered for siphon computation. This + is any place such that it is present in both the useful and the active place + lists.*/ + int* possibleSiphons = tcalloc(d->apCount < d->upCount ? d->apCount : d->upCount, sizeof(int)); + int possibleSiphonCount = 0; + j = 0; + for (i = 0; i < d->apCount && j < d->upCount; i++) + { + while (j < d->upCount && d->upl[j] < d->apl[i]) j++; + if (j < d->upCount && d->upl[j] == d->apl[i]) + { + possibleSiphons[possibleSiphonCount++] = d->apl[i]; + } + } + + /*Make sure TSIPH is the right size.*/ + if (NumberOfRows(d->TSIPH) < NumberOfRows(d->Dm)) + { + InsertNullRows(&d->TSIPH, -1, NumberOfRows(d->Dm) - NumberOfRows(d->TSIPH), -1); + } + /*Remove any columns from TSIPH such that they have no nonzero entries in rows + corresponding to active places.*/ + j = 0; + while (j < NumberOfColumns(d->TSIPH)) + { + for (i = 0; i < d->apCount; i++) + { + if (GetMatrixEl(&d->TSIPH, d->apl[i], j)) break; + } + if (i == d->apCount) + { + RemoveColumns(&d->TSIPH, j, 1, -1); + } + else + { + j++; + } + } + + /*Minimal active siphon computation.*/ + asiph_r asiphRes = asiph(&d->Dm, &d->Dp, possibleSiphons, possibleSiphonCount, &d->TSIPH, &d->Dcm, &d->Dcp); + UpdateDPData(d, "TSIPH S", &asiphRes); + + /*Remove from the new siphons list those siphons which contain no useful + places.*/ + free(possibleSiphons); + j = 0; + while (j < NumberOfColumns(d->S)) + { + for (i = 0; i < d->upCount; i++) + { + if (GetMatrixEl(&d->S, d->upl[i], j)) break; + } + if (d->upCount == i) + { + RemoveColumns(&d->S, j, 1, -1); + } + else + { + j++; + } + } + + /*Get the new siphon count.*/ + int newSiphons = NumberOfColumns(d->S); + + /*Make sure that ll the new siphons are in fact siphons.*/ + issiph_r issiphRes = issiph(&d->Dm, &d->Dp, &d->S, 1); + + if (issiphRes.flx) + { + DeallocateIssiph(&issiphRes); + merror(0, "Siphon Computation Error"); + } + + DeallocateIssiph(&issiphRes); + + /*Do printing.*/ + if (d->log) + { + if (d->firstpass) + { + fprintf(d->log, "\nIteration %d - %d new minimum siphons", d->iteration, newSiphons); + } + else + { + fprintf(d->log, "\nRun %d, iteration %d - %d new minimum siphons", d->run, d->iteration, newSiphons); + } + PrintState(d); + fflush(d->log); + } + return newSiphons; +} + +/******************************************************************************* +UpdateActiveNet updates the active subnet as appropriate for the type of +enforcement we are doing.*/ +void UpdateActiveNet(dpData* d) +{ + int i, j, flag; + if (d->state.dptype) + { + /*If we get here we are doing (T-)liveness enforcement. + Transform the net to an EAC net.*/ + pn2eacpn_r pn2eacpnRes = pn2eacpn(&d->Dm, &d->Dp, 0, &d->M, &d->L0, &d->L, d->ipl, d->ipCount, d->dpl, d->dpCount, 0, 0); + UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount free TD free intarray", &pn2eacpnRes); + /*pn2acpn_r pn2acpnRes = pn2acpn(&d->Dm, &d->Dp, 0, &d->M, &d->L0, &d->L, d->ipl, d->ipCount, d->dpl, d->dpCount); + UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount", &pn2acpnRes);*/ + + /*Find the t-minimal active subnet.*/ + tactn_r tactnRes = tactn(&d->Dm, &d->Dp, d->IncludeT, d->IncludeCount, d->ExcludeT, d->ExcludeCount, 0, 0, 1); + d->state.unique = tactnRes.unique; + UpdateDPData(d, "Dcm Dcp free matrix free matrix TA TACount", &tactnRes); + + /*Check to make sure that all required transitions are present in the + subnet. We assume that TA and IncludeT entries have been properly sorted, + from lowest to highest. Let i be the index in IncludeT and j be the index + in TA.*/ + j = 0; + flag = ! d->TACount; + for (i = 0; i < d->IncludeCount && ! flag; i++) + { + while(j < d->TACount - 1 && d->TA[j] < d->IncludeT[i]) j++; + if (d->TA[j] != d->IncludeT[i]) + { + flag = 1; + break; + } + } + if (flag) + { + d->state.anetfail = 1; + if (d->firstpass) + { + if (d->state.dptype == 2) d->state.noTlive = 1; + else d->state.nolive = 1; + } + } + } + else + { + /*If we get here, we are doing deadlock prevention, not (T-)liveness + enforcement. Begin with active subnet finding.*/ + actn_r actnRes = actn(&d->Dm, &d->Dp, d->ExcludeT, d->ExcludeCount, 0, 0, 0, 1); + d->state.unique = actnRes.unique; + UpdateDPData(d, "Dcm Dcp free matrix free matrix TA TACount", &actnRes); + /*Same test as above - make sure that all required transitions are + present in the active subnet.*/ + j = 0; + flag = ! d->TACount; + for (i = 0; i < d->IncludeCount && ! flag; i++) + { + while(j < d->TACount - 1 && d->TA[j] < d->IncludeT[i]) j++; + if (d->TA[j] != d->IncludeT[i]) + { + flag = 1; + break; + } + } + if (flag) + { + d->state.anetfail = 1; + } + } + /*Check to see if the task is impossible.*/ + if (! d->TACount) + { + d->terminate = 1; + if (d->firstpass) + { + d->status = HOW_IMPOSSIBLE; + } + else + { + d->status = HOW_FAILED; + } + d->state.incon = 0; + } +} + +/******************************************************************************* +EnforceMarkingConstraints enforces the present marking constraints on the net.*/ +void EnforceMarkingConstraints(dpData* d) +{ + if (NumberOfRows(d->L)) + { + supervis_r supervisRes = supervis(&d->Dp, &d->Dm, &d->L); + UpdateDPData(d, "Dm Dp", &supervisRes); + /*Create the dependent place list.*/ + d->dpCount = NumberOfRows(d->Dm) - d->targetRows; + d->dpl = tcalloc(d->dpCount, sizeof(int)); + int i; + for (i = d->targetRows; i < NumberOfRows(d->Dm); i++) + { + d->dpl[i - d->targetRows] = i; + } + /*Setup M = L, G = B. Optimize for row operations.*/ + AllocateMatrixType(2, &d->M, NumberOfRows(d->L), NumberOfColumns(d->L)); + CopyMatrix(&d->L, &d->M); + d->G = tcalloc(NumberOfRows(d->L), sizeof(int)); + memcpy(d->G, d->B, NumberOfRows(d->L) * sizeof(int)); + } +} + +/******************************************************************************* +asbnmessage prints a per-major-iteration message.*/ +void asbnmessage(dpData *d) +{ + if (d->run < 2) + { + printf("\nI"); + } + else + { + printf("\nRun %d, i", d->run); + } + if (d->state.dptype < 2) + { + printf("teration 1: Computing the maximal active subnet...\n"); + } + else + { + printf("teration 1: Computing a T-minimal active subnet...\n"); + } +} + +/******************************************************************************* +This function prints the current state to the data and log files.*/ +void PrintState(dpData *d) +{ + fprintf(d->log, "\nThe Petri net has %d places and %d transitions", NumberOfRows(d->Dm), NumberOfColumns(d->Dm)); + if (d->ExcludeT) fprintf(d->log, "\nThe current active subnet excludes the transitions %s", fvpr(d->ExcludeT, d->ExcludeCount, DISPLAY_INTS | DISPLAY_OFFSET, 2)); + + int i, j; + /*Build a list of the original places for vector display.*/ + if (d->targetRows) + { + int *originalPlaces = tcalloc(d->targetRows, sizeof(int)); + for (i = 1; i < d->targetRows; i++) + { + originalPlaces[i] = i; + } + /*Display it.*/ + fprintf(d->log, "\n %d original places: %s", d->targetRows, fvpr(originalPlaces, d->targetRows, DISPLAY_INTS | DISPLAY_OFFSET, 2)); + free(originalPlaces); + } + + /*We need a list of all the dependent and independent places that have been + added so far, that is, all those with indices greater than the maximum present + in the original net.*/ + int firstNewInd = -1, firstNewDep = -1; + for (i = 0; i < d->ipCount; i++) + { + if (d->ipl[i] >= d->targetRows) + { + firstNewInd = i; + break; + } + } + for (i = 0; i < d->dpCount; i++) + { + if (d->dpl[i] >= d->targetRows) + { + firstNewDep = i; + break; + } + } + if (firstNewInd != -1) + { + if (d->ipCount - firstNewInd == 1) + { + fprintf(d->log, "\n One split place: %s", fvpr(d->ipl + firstNewInd, d->ipCount - firstNewInd, DISPLAY_INTS | DISPLAY_OFFSET, 2)); + } + else if (d->ipCount - firstNewInd > 1) + { + fprintf(d->log, "\n %d split places: %s", d->ipCount - firstNewInd, fvpr(d->ipl + firstNewInd, d->ipCount - firstNewInd, DISPLAY_INTS | DISPLAY_OFFSET, 2)); + } + } + if (firstNewDep != -1) + { + if (d->dpCount - firstNewDep == 1) + { + fprintf(d->log, "\n One control place: %s", fvpr(d->dpl + firstNewDep, d->dpCount - firstNewDep, DISPLAY_INTS | DISPLAY_OFFSET, 2)); + } + else if (d->dpCount - firstNewDep > 1) + { + fprintf(d->log, "\n %d control places: %s", d->dpCount - firstNewDep, fvpr(d->dpl + firstNewDep, d->dpCount - firstNewDep, DISPLAY_INTS | DISPLAY_OFFSET, 2)); + } + } + fprintf(d->log, "\n"); + + /*We want to display a modified version of M - one with null columns in place + for each of the non-independent places, so that it has a column for each + column of the net. Do this one row at a time. Allocate the row.*/ + int *MRow = tcalloc(NumberOfRows(d->Dm), sizeof(int)); + for (i = 0; i < NumberOfRows(d->M); i++) + { + memset(MRow, 0, sizeof(int) * NumberOfRows(d->Dm)); + for (j = 0; j < d->ipCount; j++) + { + MRow[d->ipl[j]] = GetMatrixEl(&d->M, i, j); + } + /*Display the row.*/ + fprintf(d->log, "\n %d --> %s >= %d", d->dpl[i], avpr(MRow, NumberOfRows(d->Dm), DISPLAY_INTS | DISPLAY_OFFSET, 0, 0), d->G[i]); + } + free(MRow); + + /*Build a Petri net object we can use with displaypn to print the current net + to the dat file.*/ + pns currentPn = createpn("mDm mDp", d->Dm, d->Dp); + /*Do the display.*/ + fprintf(d->dat, "\n"); + displaypn(currentPn, d->dat); + fprintf(d->dat, "\n"); + deallocpn(¤tPn); + fflush(d->log); + fflush(d->dat); +} + +/******************************************************************************* +This function prints a status message with information about current run and +iteration.*/ +void PrintMessage(dpData* d, char* message) +{ + if (d->iteration > 0) + { + if (d->run < 2) + { + printf("Iteration %d: %s\n", d->iteration, message); + } + else + { + printf("Run %d, iteration %d: %s\n", d->run, d->iteration, message); + } + } + else + { + printf("%s\n", message); + } +} + +/******************************************************************************* +This function modifies the dpData structure passed to it to set it up for a +single run. It examines the firstpass bit to determine whether or not certain +matrices have already been set up correctly.*/ +void InitDpData(dp_p *p, dpData* d) +{ + /*If this is the first pass, then the matrices have been properly initialized. + Otherwise, make them new copies of the original parameter matrices.*/ + if (! d->firstpass) + { + DeallocateMatrix(&d->Dm); + AllocateMatrixType(2, &d->Dm, NumberOfRows(p->Dm), NumberOfColumns(p->Dm)); + CopyMatrix(&p->Dm, &d->Dm); + DeallocateMatrix(&d->Dp); + AllocateMatrixType(2, &d->Dp, NumberOfRows(p->Dp), NumberOfColumns(p->Dp)); + CopyMatrix(&p->Dp, &d->Dp); + DeallocateMatrix(&d->DI); + d->DI = SubtractMatrix(&d->Dp, &d->Dm, (matrix*) 2); + /*If either of the constraint matrices is not present, initialize it to have + the right number of columns and zero rows so that it can be concatenated with + the other to form the total constraint matrix.*/ + if (p->L.type) + { + DeallocateMatrix(&d->L); + AllocateMatrixType(2, &d->L, NumberOfRows(p->L), NumberOfColumns(p->L)); + CopyMatrix(&p->L, &d->L); + } + else + { + DeallocateMatrix(&d->L); + AllocateMatrixType(2, &d->L, 0, NumberOfRows(p->Dm)); + } + if (p->L0.type) + { + DeallocateMatrix(&d->L0); + AllocateMatrixType(2, &d->L0, NumberOfRows(p->L0), NumberOfColumns(p->L0)); + CopyMatrix(&p->L0, &d->L0); + } + else + { + DeallocateMatrix(&d->L0); + AllocateMatrixType(2, &d->L0, 0, NumberOfRows(p->Dm)); + } + if (p->B) + { + free(d->B); + d->B = tcalloc(NumberOfRows(d->L), sizeof(int)); + memcpy(d->B, p->B, NumberOfRows(d->L) * sizeof(int)); + } + if (p->B0) + { + free(d->B0); + d->B0 = tcalloc(NumberOfRows(d->L0), sizeof(int)); + memcpy(d->B0, p->B0, NumberOfRows(d->L0) * sizeof(int)); + } + } + + /*Initialize the original, independent, and dependent place lists.*/ + d->opCount = d->targetRows; + d->ipCount = d->targetRows; + d->dpCount = 0; + if (d->opl) free(d->opl); + if (d->ipl) free(d->ipl); + if (d->dpl) free(d->dpl); + d->opl = tcalloc(d->opCount, sizeof(int)); + d->ipl = tcalloc(d->ipCount, sizeof(int)); + d->dpl = 0; + int i; + for (i = 0; i < d->targetRows; i++) + { + d->opl[i] = i; + d->ipl[i] = i; + } + + /*Empty G and M.*/ + if (d->G) free(d->G); + d->G = 0; + if (d->M.type) DeallocateMatrix(&d->M); + + /*Initialize M to be the right size for an msplit.*/ + AllocateMatrix(&d->M, 0, d->targetRows); + + /*Remove from the exclusion list any transitions beyond those of the original + matrices. This can be done by finding the index of the first list element that + is too high and marking this as the list length.*/ + for (i = 0; i < d->ExcludeCount; i++) + { + if (d->ExcludeT[i] >= d->targetCols) break; + } + d->ExcludeCount = i; + d->state.perm = 1; + d->status = HOW_OK; +} + +/******************************************************************************* +This function fills in the dpData structure containing information for a dp run +prior to the first run.*/ +dpData CreateDpData(dp_p *p) +{ + dpData d; + memset(&d, 0, sizeof(dpData)); + /*Copy matrices*/ + AllocateMatrixType(2, &d.Dm, NumberOfRows(p->Dm), NumberOfColumns(p->Dm)); + CopyMatrix(&p->Dm, &d.Dm); + AllocateMatrixType(2, &d.Dp, NumberOfRows(p->Dp), NumberOfColumns(p->Dp)); + CopyMatrix(&p->Dp, &d.Dp); + /*Get the target matrix DI.*/ + d.DI = SubtractMatrix(&d.Dp, &d.Dm, (matrix*) 2); + int i; + + /*If either of the constraint matrices is not present, initialize it to have + the right number of columns and zero rows so that it can be concatenated with + the other to form the total constraint matrix.*/ + if (p->L.type) + { + AllocateMatrixType(2, &d.L, NumberOfRows(p->L), NumberOfColumns(p->L)); + CopyMatrix(&p->L, &d.L); + } + else + { + AllocateMatrixType(2, &d.L, 0, NumberOfRows(p->Dm)); + } + if (p->L0.type) + { + AllocateMatrixType(2, &d.L0, NumberOfRows(p->L0), NumberOfColumns(p->L0)); + CopyMatrix(&p->L0, &d.L0); + } + else + { + AllocateMatrixType(2, &d.L0, 0, NumberOfRows(p->Dm)); + } + d.targetRows = NumberOfRows(p->Dm); + d.targetCols = NumberOfColumns(p->Dm); + /*Copy index lists (and fill in the corresponding flags).*/ + if (p->Tuc && p->TucCount) + { + d.Tuc = tcalloc(p->TucCount, sizeof(int)); + d.TucCount = p->TucCount; + memcpy(d.Tuc, p->Tuc, sizeof(int) * p->TucCount); + /*Make sure the index array is sorted. This will allow us to speed up + certain processing later.*/ + Sort(d.Tuc, d.TucCount); + } + if (p->Tuo && p->TuoCount) + { + d.Tuo = tcalloc(p->TuoCount, sizeof(int)); + d.TuoCount = p->TuoCount; + memcpy(d.Tuo, p->Tuo, sizeof(int) * p->TuoCount); + /*Make sure the index array is sorted. This will allow us to speed up + certain processing later.*/ + Sort(d.Tuo, d.TuoCount); + } + if (p->ExcludeT && p->ExcludeCount) + { + d.ExcludeT = tcalloc(p->ExcludeCount, sizeof(int)); + d.ExcludeCount = p->ExcludeCount; + memcpy(d.ExcludeT, p->ExcludeT, sizeof(int) * p->ExcludeCount); + /*Make sure the index array is sorted. This will allow us to speed up + certain processing later.*/ + Sort(d.ExcludeT, d.ExcludeCount); + } + if (p->IncludeT && p->IncludeCount) + { + d.IncludeT = tcalloc(p->IncludeCount, sizeof(int)); + d.IncludeCount = p->IncludeCount; + memcpy(d.IncludeT, p->IncludeT, sizeof(int) * p->IncludeCount); + /*Make sure the index array is sorted. This will allow us to speed up + certain processing later.*/ + Sort(d.IncludeT, d.IncludeCount); + } + else + { + /*If IncludeT is not present, it defaults to including all transitions.*/ + d.IncludeT = tcalloc(d.targetCols, sizeof(int)); + d.IncludeCount = d.targetCols; + for (i = 0; i < d.targetCols; i++) + { + d.IncludeT[i] = i; + } + } + /*Copy the constraint vectors*/ + if (p->B) + { + d.B = tcalloc(NumberOfRows(d.L), sizeof(int)); + memcpy(d.B, p->B, NumberOfRows(d.L) * sizeof(int)); + } + if (p->B0) + { + d.B0 = tcalloc(NumberOfRows(d.L0), sizeof(int)); + memcpy(d.B0, p->B0, NumberOfRows(d.L0) * sizeof(int)); + } + /*The only one of the state flags that does not default to zero is perm.*/ + d.state.perm = 1; + /*If the DP_OPT_ENFORCELIVE option bit is set, we are doing liveness + enforcement. If the IncludeT count is less than the total number of + transitions, we are doing T-liveness enforcement.*/ + if (p->option & DP_OPT_ENFORCELIVE) + { + if (d.targetCols > d.IncludeCount) + { + d.state.dptype = 2; + } + else + { + d.state.dptype = 1; + } + } + /*If Tuc or Tuo are present, set the uncontro state bit.*/ + if (d.Tuc || d.Tuo) + { + d.state.uncontro = 1; + } + /*If L or L0 are present (have at least one row), set the initial conditions + (incon) state bit.*/ + if (d.L.nr || d.L0.nr) + { + d.state.incon = 1; + d.consis = 1; + } + /*If the DP_OPT_WRITELOG bit is set, attempt to open the log files. If either + open fails, revert to no logging and issue a warning if verbosity is turned on.*/ + if (p->option & DP_OPT_WRITELOG) + { + char *mode = (p->option & DP_OPT_APPENDLOGS) ? "a" : "w"; + char *name = (p->option & DP_OPT_APPENDLOGS) ? "append" : "write"; + if (d.log = fopen("dp.log", mode)) + { + if (! (d.dat = fopen("dp.dat", mode))) + { + if (is_verbose() >= VRB_DP) printf("Warning: Could not open file \"dp.dat\" for %s access. Logging disabled.\n", name); + fclose(d.log); + d.log = 0; + } + } + else if (is_verbose() >= VRB_DP) printf("Warning: Could not open file \"dp.log\" for %s access. Logging disabled.\n", name); + } + /*If logging is enabled go ahead and write the log headers.*/ + if (d.log) + { + char timeString[64]; + /*Matlab date format example: 24-Oct-2003 13:45:07*/ + time_t tm = time(0); + strftime(timeString, 64, "%d-%b-%Y %H:%M:%S", localtime(&tm)); + fprintf(d.log, "\n%s -- DP.log -- Generated by DP\n", timeString); + fprintf(d.dat, "\n%s -- DP.DAT -- Generated by DP\n", timeString); + fflush(d.log); + fflush(d.dat); + } + /*Set firstpass to 1 and leave restart as 0.*/ + d.firstpass = 1; + return d; +} + +/******************************************************************************* +This function checks the constraints given in L/B and L0/B0 of the dpData +structure and builds the set of complete marking constraints from them, returning +it in the MarkingConstraints structure.*/ +Marking... [truncated message content] |
From: <Ste...@us...> - 2009-08-17 02:22:23
|
Revision: 218 http://pntool.svn.sourceforge.net/pntool/?rev=218&view=rev Author: StephenCamp Date: 2009-08-17 02:22:15 +0000 (Mon, 17 Aug 2009) Log Message: ----------- Dp now uses pn2eacpn instead of pn2acpn. Bug corrected: pn2eacpn previously failed to modify L0 and M if they had no rows, even if they had columns. Modified Paths: -------------- spnbox/dp.c spnbox/pn2eacpn.c spnbox/tests/Makefile Modified: spnbox/dp.c =================================================================== --- spnbox/dp.c 2009-08-14 22:27:49 UTC (rev 217) +++ spnbox/dp.c 2009-08-17 02:22:15 UTC (rev 218) @@ -890,12 +890,12 @@ { ncp[d->cpl[i]] = 1; } - /* For debugging purposes, we replace the pn2eacpn call with a pn2acpn call. + /* For debugging purposes, we replace the pn2eacpn call with a pn2acpn call.*/ pn2eacpn_r pn2eacpnRes = pn2eacpn(&d->Dm, &d->Dp, ncp, &d->M, &d->L0, &d->L, d->ipl, d->ipCount, d->dpl, d->dpCount, d->TD, d->TDCount); UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount TD TDCount", &pn2eacpnRes); - */ + /* pn2acpn_r pn2acpnRes = pn2acpn(&d->Dm, &d->Dp, ncp, &d->M, &d->L0, &d->L, d->ipl, d->ipCount, d->dpl, d->dpCount); - UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount", &pn2acpnRes); + UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount", &pn2acpnRes);*/ free(ncp); } @@ -1362,10 +1362,10 @@ { /*If we get here we are doing (T-)liveness enforcement. Transform the net to an EAC net.*/ - /*pn2eacpn_r pn2eacpnRes = pn2eacpn(&d->Dm, &d->Dp, 0, &d->M, &d->L0, &d->L, d->ipl, d->ipCount, d->dpl, d->dpCount, d->TD, d->TDCount); - UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount TD TDCount", &pn2eacpnRes);*/ - pn2acpn_r pn2acpnRes = pn2acpn(&d->Dm, &d->Dp, 0, &d->M, &d->L0, &d->L, d->ipl, d->ipCount, d->dpl, d->dpCount); - UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount", &pn2acpnRes); + pn2eacpn_r pn2eacpnRes = pn2eacpn(&d->Dm, &d->Dp, 0, &d->M, &d->L0, &d->L, d->ipl, d->ipCount, d->dpl, d->dpCount, d->TD, d->TDCount); + UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount TD TDCount", &pn2eacpnRes); + /*pn2acpn_r pn2acpnRes = pn2acpn(&d->Dm, &d->Dp, 0, &d->M, &d->L0, &d->L, d->ipl, d->ipCount, d->dpl, d->dpCount); + UpdateDPData(d, "free matrix Dm Dp M L0 L ipl ipCount", &pn2acpnRes);*/ /*Find the t-minimal active subnet.*/ tactn_r tactnRes = tactn(&d->Dm, &d->Dp, d->IncludeT, d->IncludeCount, d->ExcludeT, d->ExcludeCount, 0, 0, 1); Modified: spnbox/pn2eacpn.c =================================================================== --- spnbox/pn2eacpn.c 2009-08-14 22:27:49 UTC (rev 217) +++ spnbox/pn2eacpn.c 2009-08-17 02:22:15 UTC (rev 218) @@ -167,7 +167,7 @@ /*We will be adding new columns to MX and L0. Reseve space and copy existing columns.*/ - if (NumberOfRows(result->MXF)) + if (NumberOfColumns(result->MXF)) { AllocateMatrixType(2, &MX, NumberOfRows(result->MXF), NumberOfColumns(result->MXF) + ToAdd); CopyBlock(NumberOfRows(result->MXF), NumberOfColumns(result->MXF), &result->MXF, 0, 0, &MX, 0, 0); @@ -177,7 +177,7 @@ /*Zero MX.*/ AllocateMatrix(&MX, 0, 0); } - if (NumberOfRows(result->L0F)) + if (NumberOfColumns(result->L0F)) { AllocateMatrixType(2, &L0, NumberOfRows(result->L0F), NumberOfColumns(result->L0F) + ToAdd); CopyBlock(NumberOfRows(result->L0F), NumberOfColumns(result->L0F), &result->L0F, 0, 0, &L0, 0, 0); @@ -245,7 +245,7 @@ interest.*/ SetMatrixEl(&Dmf, Rows + j, Transition, GetMatrixEl(Dm, i, Transition)); /*Modify MX and L0 if they exist.*/ - if (NumberOfRows(MX) || NumberOfRows(L0)) + if (NumberOfColumns(MX) || NumberOfColumns(L0)) { /*Find out if the current place is independent..*/ for (x = 0; x < ipCount; x++) @@ -260,11 +260,11 @@ place just found. (if they exist)*/ if (x < ipCount) { - if (NumberOfRows(MX)) + if (NumberOfColumns(MX)) { CopyBlock(NumberOfRows(MX), 1, &MX, 0, x, &MX, 0, NumberOfColumns(MX) - ToAdd + j); } - if (NumberOfRows(L0)) + if (NumberOfColumns(L0)) { CopyBlock(NumberOfRows(L0), 1, &L0, 0, x, &L0, 0, NumberOfColumns(L0) - ToAdd + j); } @@ -292,12 +292,12 @@ result->Dmf = Dmf; DeallocateMatrix(&result->Dpf); result->Dpf = Dpf; - if (NumberOfRows(MX)) + if (NumberOfColumns(MX)) { DeallocateMatrix(&result->MXF); result->MXF = MX; } - if (NumberOfRows(L0)) + if (NumberOfColumns(L0)) { DeallocateMatrix(&result->L0F); result->L0F = L0; Modified: spnbox/tests/Makefile =================================================================== --- spnbox/tests/Makefile 2009-08-14 22:27:49 UTC (rev 217) +++ spnbox/tests/Makefile 2009-08-17 02:22:15 UTC (rev 218) @@ -46,7 +46,7 @@ PN2EACPN=pn2eacpn.o $(NLTRANS) REDUCE=reduce.o chkcons.o $(IPSOLVE) TACTN=tactn.o $(IPSOLVE) -DP=dp.o tactn.o reduce.o chkcons.o pn2acpn.o nltrans.o asiph.o actn.o admcon.o supervis.o msplit.o issiph.o fvpr.o avpr.o $(EXTENDEDMATRIX) $(IPSOLVE) +DP=dp.o tactn.o reduce.o chkcons.o pn2eacpn.o nltrans.o asiph.o actn.o admcon.o supervis.o msplit.o issiph.o fvpr.o avpr.o $(EXTENDEDMATRIX) $(IPSOLVE) #Common test header dependencies. COMMONHEADER=../spnbox.h test.h ../../pnheaders/pns.h ../../pnheaders/matrix.h ../matrixmath.h ../MemoryManager.h StructuredIO.h This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ste...@us...> - 2009-08-14 22:27:55
|
Revision: 217 http://pntool.svn.sourceforge.net/pntool/?rev=217&view=rev Author: StephenCamp Date: 2009-08-14 22:27:49 +0000 (Fri, 14 Aug 2009) Log Message: ----------- Modified the makefile: the memwatch test routines can now be included or excluded by setting a single variable in the makefile. Updated the readme to describe the new makefile usage. Modified Paths: -------------- spnbox/README.txt spnbox/tests/Makefile Modified: spnbox/README.txt =================================================================== --- spnbox/README.txt 2009-08-14 21:47:00 UTC (rev 216) +++ spnbox/README.txt 2009-08-14 22:27:49 UTC (rev 217) @@ -11,14 +11,14 @@ The makefile within the directory will make any of the test programs. To generate the test program for a particular function, use a command of the form: make <functionname> This will generate an executable called <functionname>.exe. +Note that the makefile can be configured to include a set of debugging routines from the third-party library memwatch that will aid in debugging memory errors. See MEMORY DEBUGGING later in this file for more information. To include this library, the "USEMEMWATCH" variable in the test makefile should be set to "yes". If it is set to anything else the memory debugging routines will not be included. make all will generate test executables for all spnbox functions. To test the various functions in the matrixmath.c file, use make matrixmath. To test the functions in the extendedmatrix.c file, use make extendedmatrix. -The test makefile includes in each source file it compiles the header files and definitions needed to use the memory debugging routines in the memwatch third-party library. (see pntool/third-party/memwatch-2.71). It also compiles and links the file memwatch.c from the library in all test executables. For all with such test programs except that ipslv, the test program is implemented as a program that will read from an input stream containing text in a human-readable format, interpret the text as parameters to the function, make a function call, and display the results. For format specifications, see the comments in StructuredIO.c/h. The programs may be invoked with a single command line argument, which will be taken as the name of a text file from which to read the input. If no command line argument is used the test programs will take input from the console. -Pre-formatted test scripts with problems to test each part of a function have been provided. These are named in the form test-<functionname>.txt. +Pre-formatted test scripts with problems to test each part of a function have been provided. These are named in the form test-<functionname>.txt. There is no test script for admcon.c as the admcon function is thoroughly tested by its use within the dp function. Thus, to test ipsolve with the default test script the following command sequence might be issued: @@ -26,6 +26,14 @@ make ipsolve ./ipsolve test-ipsolve.txt +#MEMORY DEBUGGING +The test makefile can compile and link the spnbox files so that their test routines will make use of the "memwatch" memory debugger. Memwatch is a set of routines, declared in memwatch.h in the pntool/third-party/memwatch-2.71/ directory, that overrides the standard memory allocation and deallocation functions with its own wrappers. +Memwatch keeps track of allocations and deallocations through its routines. It can detect some but not all array overwrites, underwrites, wild pointer writes, deallocations of invalid pointers, and various other potential errors related to dynamically allocated memory. +When a program that contains the Memwatch routines runs it will create a text file in the current directory, titled memwatch.log by default, that lists any errors or anomalies detected by the memwatch routines. +Note that the memwatch routines slow memory-related operations drastically. +See pntool/third-party/memwatch-2.71/USING for more information. +memwatch is licensed under the GNU public license, present in the file pntool/third-party/memwatch-2.71/gpl.txt. + #FILES Main directory: - spnbox.h: This is the header file containing the definitions for all the SPNBOX @@ -59,5 +67,4 @@ - Makefile: This is the test makefile. It is responsible for building various test routines and takes targets as described above in #TESTING. - All other files are the source files for the test executables for various - functions. - + functions or the test scripts intended to be used with various text executables. Modified: spnbox/tests/Makefile =================================================================== --- spnbox/tests/Makefile 2009-08-14 21:47:00 UTC (rev 216) +++ spnbox/tests/Makefile 2009-08-14 22:27:49 UTC (rev 217) @@ -4,14 +4,27 @@ #clean cleans the test routine executables and intermediate files. #<functionname> is the name of an spnbox function. This builds the test routines for that function. -#To remove the memwatch memory debugging routines: -#Make MEMWCOMP equal to COMPILER (removing the include and define options) -#Remove "memwatch.o" from the list of COMMON dependencies. +#This variable controls whether or not the memwatch memory debugging routines are included in +#compilation. Set to "yes" to include them and "no" to leave them out. +USEMEMWATCH = no +#Assign the default compiler call and options. COMPILER=gcc -g + +#Assign the compiler call that will affect the inclusion or exclusion of the memwatch routines. +ifeq ($(USEMEMWATCH),yes) MEMWCOMP=$(COMPILER) -include string.h -include ../../third-party/memwatch-2.71/memwatch.h -DMEMWATCH -DMEMWATCH_STDIO -#The dependencies common to all test executables. +else +MEMWCOMP=$(COMPILER) +endif + +#The dependencies common to all test executables. Include memwatch.o only if the memwatch routines should +# be included. +ifeq ($(USEMEMWATCH),yes) COMMON=StructuredIO.o test.o MemoryManager.o general.o pns.o matrix.o matrixmath.o deallocation.o memwatch.o +else +COMMON=StructuredIO.o test.o MemoryManager.o general.o pns.o matrix.o matrixmath.o deallocation.o +endif #These symbols define the dependencies of various test executables. AVPR=avpr.o This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <Ste...@us...> - 2009-08-14 21:47:13
|
Revision: 216 http://pntool.svn.sourceforge.net/pntool/?rev=216&view=rev Author: StephenCamp Date: 2009-08-14 21:47:00 +0000 (Fri, 14 Aug 2009) Log Message: ----------- Corrected minor bugs and memory leaks in most of the spnbox files. All files are now reported memory-leak-free after being run with the memwatch functions linked, except for a memory leak possibly related to type-3 matrix storage only. This leak is still under investigation. Modified Paths: -------------- spnbox/MemoryManager.c spnbox/asiph.c spnbox/avpr.c spnbox/deallocation.c spnbox/dp.c spnbox/extendedmatrix.c spnbox/fvpr.c spnbox/ilpadm.c spnbox/ipsolve.c spnbox/linenf.c spnbox/nltrans.c spnbox/reduce.c spnbox/tactn.c spnbox/tests/Makefile spnbox/tests/StructuredIO.c spnbox/tests/test-avpr.c spnbox/tests/test-dp.c spnbox/tests/test-extendedmatrix.txt spnbox/tests/test-fvpr.c spnbox/tests/test-linenf.c spnbox/tests/test-msplit.c Modified: spnbox/MemoryManager.c =================================================================== --- spnbox/MemoryManager.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/MemoryManager.c 2009-08-14 21:47:00 UTC (rev 216) @@ -78,7 +78,7 @@ int i; for (i = 0; i < mgr->nextm; i++) { - DeallocateMatrix(mgr->matrices[i]); + if (mgr->matrices[i]->type) DeallocateMatrix(mgr->matrices[i]); } free(mgr->matrices); mgr->matrices = 0; Modified: spnbox/asiph.c =================================================================== --- spnbox/asiph.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/asiph.c 2009-08-14 21:47:00 UTC (rev 216) @@ -102,6 +102,7 @@ } /*If MNS is empty, build it based on if there are any source transitions.*/ result = BuildResult(Dm, Dp, &data, newIndex); + FreeMemory(&mem); return result; } @@ -188,6 +189,8 @@ } if (data->MNS.type) DeallocateMatrix(&data->MNS); if (data->NS.type) DeallocateMatrix(&data->NS); + free(sourceF); + free(index); return result; } @@ -688,6 +691,7 @@ if (! newCount) { memset(&sx, 0, sizeof(matrix)); + FreeMemory(&memory); return sx; } /*Otherwise, build the actual list of non-null Dma/Dpa row indices.*/ @@ -797,6 +801,7 @@ AllocateMatrixType(2, &data->MNS, 0, NumberOfRows(*Dm)); } AllocateMatrixType(2, &data->NS, 0, NumberOfRows(*Dm)); + FreeMemory(&memory); return sx; } @@ -880,8 +885,6 @@ { actn_r result; result = actn(Dm, Dp, 0, 0, 0, 0, 0, 0); - ManageMatrix(mem, &result.Dma); - ManageMatrix(mem, &result.Dpa); if (result.Dmra.type) DeallocateMatrix(&result.Dmra); if (result.Dpra.type) DeallocateMatrix(&result.Dpra); @@ -889,6 +892,9 @@ **Dma = result.Dma; *Dpa = mmalloc(mem, sizeof(matrix)); **Dpa = result.Dpa; + ManageMatrix(mem, *Dma); + ManageMatrix(mem, *Dpa); + if (result.TA) free(result.TA); } return 1; Modified: spnbox/avpr.c =================================================================== --- spnbox/avpr.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/avpr.c 2009-08-14 21:47:00 UTC (rev 216) @@ -13,6 +13,7 @@ static int CheckParams(int* vector, int length, int mode, char** chr); static int GetVectorEl(void* vector, int i, int mode); static int GetBufferLength(void* vector, int length, int mode, char* chr, char* bl, char* el); +static void FinalFree(); char* avpr(void *vector, int length, int mode, char* chr, int option) { Modified: spnbox/deallocation.c =================================================================== --- spnbox/deallocation.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/deallocation.c 2009-08-14 21:47:00 UTC (rev 216) @@ -143,7 +143,7 @@ void DeallocateTactn(tactn_r *data) { - DeallocateTactn(data); + DeallocateActn(data); } void DeallocateIssiph(issiph_r *data) Modified: spnbox/dp.c =================================================================== --- spnbox/dp.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/dp.c 2009-08-14 21:47:00 UTC (rev 216) @@ -162,6 +162,8 @@ /*Mark for termination.*/ d.terminate = 1; } + DeallocateMatrix(&cons.L); + free(cons.B); DeallocateChkcons(&chkconsRes); } @@ -181,6 +183,7 @@ EnforceMarkingConstraints(&d); /*Build the useful places list: include all places initially.*/ + if (d.upl) free(d.upl); d.upCount = NumberOfRows(d.Dm); d.upl = tcalloc(d.upCount, sizeof(int)); for (i = 0; i < d.upCount; i++) @@ -464,7 +467,7 @@ fprintf(d->log, "The set Tx is:\nTx = %s", ListTransitions(d->TA, d->TACount)); } } - else if (d->state.perm) + else { fprintf(d->log, "guaranteed to enforce"); if (d->state.anetfail) @@ -480,7 +483,7 @@ } fprintf(d->log, "and may not be the least restrictive"); } - else if (d->state.unique) + if (d->state.perm && ! d->state.unique) { fprintf(d->log, "\nThe supervisor is the least restrictive Ta-liveness "); fprintf(d->log, "enforcing supervisor for\nTa = %s", ListTransitions(d->TA, d->TACount)); @@ -781,6 +784,7 @@ L, B or L0, B0.*/ if (chkconsRes.resCount) { + DeallocateChkcons(&chkconsRes); /*Find out whether these constraints should apply to the marking at all times or just to the initial marking.*/ if (DoConstraintsApplyToAll(d, &supervisRes, &a, currentSiphon)) @@ -852,12 +856,16 @@ { if (d->log) PrintConstraints(d, 0, 0, currentSiphon, -1, 0); } + /*If l has not been absorbed into something else, deallocate it here.*/ + if (l.type) DeallocateMatrix(&l); if (NumberOfRows(cons.L)) { DeallocateMatrix(&cons.L); free(cons.B); } } + DeallocateMatrix(&a); + free(currentSiphon); } /******************************************************************************* @@ -972,7 +980,7 @@ /*Find the number of independent places to use.*/ for (i = 0; i < d->ipCount; i++) { - if (d->ipl[i] > d->targetRows) break; + if (d->ipl[i] >= d->targetRows) break; } /*i now contains the number of independent places that we want to use. Update the total count and allocate memory.*/ @@ -1295,6 +1303,7 @@ /*Remove from the new siphons list those siphons which contain no useful places.*/ + free(possibleSiphons); j = 0; while (j < NumberOfColumns(d->S)) { @@ -1666,6 +1675,7 @@ /*Empty G and M.*/ if (d->G) free(d->G); + d->G = 0; if (d->M.type) DeallocateMatrix(&d->M); /*Initialize M to be the right size for an msplit.*/ @@ -2040,7 +2050,7 @@ void AddToIndexArray(int** array, int* length, int item) { int *newArray = tcalloc(*length + 1, sizeof(int)); - memcpy(newArray, *array, sizeof(int) * (*length)); + if (length) memcpy(newArray, *array, sizeof(int) * (*length)); newArray[(*length)++] = item; free(*array); *array = newArray; @@ -2052,7 +2062,7 @@ void AddToArray(int** array, int length, int item) { int* newArray = tcalloc(length + 1, sizeof(int)); - memcpy(newArray, *array, sizeof(int) * length); + if (length) memcpy(newArray, *array, sizeof(int) * length); newArray[length] = item; free(*array); *array = newArray; Modified: spnbox/extendedmatrix.c =================================================================== --- spnbox/extendedmatrix.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/extendedmatrix.c 2009-08-14 21:47:00 UTC (rev 216) @@ -260,6 +260,12 @@ m->ar[i - rows] = m->ar[i]; } m->nr -= rows; + /*If we have removed all rows, deallocate the ar pointer.*/ + if (! m->nr) + { + free(m->ar); + m->ar = 0; + } } else { Modified: spnbox/fvpr.c =================================================================== --- spnbox/fvpr.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/fvpr.c 2009-08-14 21:47:00 UTC (rev 216) @@ -56,7 +56,7 @@ { free(buffer); bufferLength = newBufferLength; - buffer = calloc(bufferLength, sizeof(char)); + buffer = tcalloc(bufferLength, sizeof(char)); } buffer[0] = '\0'; if (! length) return buffer; Modified: spnbox/ilpadm.c =================================================================== --- spnbox/ilpadm.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/ilpadm.c 2009-08-14 21:47:00 UTC (rev 216) @@ -124,6 +124,7 @@ an additional constraint. Test for them.*/ if (RedoLP1(L, b, &LPSolution, i)) { + DeallocateIpsolve(&LPSolution); /*Build the alternate linear programming problem and solve it.*/ BuildLP1Alternate(&M2, &CDeltas, L, Tuc, TucCount, Tuo, TuoCount, i); LPSolution = ipsolve(&M2, N2, Cost, 0, 0, LoBounds, CType2); Modified: spnbox/ipsolve.c =================================================================== --- spnbox/ipsolve.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/ipsolve.c 2009-08-14 21:47:00 UTC (rev 216) @@ -118,7 +118,7 @@ { lp.Cost[i] = 0; } - free(lpresult.solution); + free(lpresult.solution); lpresult = ipslv(lp.Cost, lp.L, lp.B, lp.Constraints, lp.Variables, lp.IntList, lp.HiBound, lp.LoBound, lp.ctype); } @@ -136,6 +136,7 @@ } } } + if (lpresult.solution) free(lpresult.solution); } else { @@ -253,7 +254,7 @@ *ColKeys = mcalloc(mem, Cols, sizeof(int)); HiBoundF = tcalloc(Cols, sizeof(int)); LoBoundF = tcalloc(Cols, sizeof(int)); - result->res = tcalloc(Cols, sizeof(double)); + result->res = tcalloc(Cols, sizeof(double)); for (i = 0; i < Cols; i++) { /*Fill the finite bounds indicators with the appropriate value. We reserve a Modified: spnbox/linenf.c =================================================================== --- spnbox/linenf.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/linenf.c 2009-08-14 21:47:00 UTC (rev 216) @@ -277,15 +277,12 @@ /*Enforce the constraints.*/ EnfResult = linenf(&NewDm, &NewDp, &AdmResult.La, b ? AdmResult.ba : 0, Newm0, &NewF, 0, 0, 0, 0, 0); - ManageMatrix(&RowMemory, &EnfResult.Dfm); - ManageMatrix(&RowMemory, &EnfResult.Dfp); - ManageMemory(&RowMemory, EnfResult.ms0); - ManageMemory(&RowMemory, EnfResult.dhow); - if (b) ManageMemory(&RowMemory, EnfResult.bf); /*Collapse the enforced net back to applying to the original problem and store the results in the return structure.*/ CollapseNet(i, &EnfResult, &Transform, &Ret, Places, Transitions); + + DeallocateLinenf(&EnfResult); } else { @@ -304,15 +301,10 @@ /*Enforce the constraints.*/ EnfResult = linenf(Dm, Dp, &NewL, b ? b + i : 0, m0, &NewF, &NewC, 0, 0, 0, 0); - ManageMatrix(&RowMemory, &EnfResult.Dfm); - ManageMatrix(&RowMemory, &EnfResult.Dfp); - ManageMatrix(&RowMemory, &EnfResult.Cf); - ManageMemory(&RowMemory, EnfResult.ms0); - ManageMemory(&RowMemory, EnfResult.dhow); - if (b) ManageMemory(&RowMemory, EnfResult.bf); /*Copy the enforced constraints into the appropriate places.*/ - CollapseNet(i, &EnfResult, 0, &Ret, Places, Transitions); + CollapseNet(i, &EnfResult, 0, &Ret, Places, Transitions); + DeallocateLinenf(&EnfResult); } //Free memory FreeMemory(&RowMemory); Modified: spnbox/nltrans.c =================================================================== --- spnbox/nltrans.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/nltrans.c 2009-08-14 21:47:00 UTC (rev 216) @@ -65,7 +65,7 @@ { cov[i] = 1; } - } + } /*Check. If all elements of cov are nonzero, we want to exit the loop.*/ fContinue = 0; for (i = 0; i < covCount; i++) @@ -77,6 +77,7 @@ } } } + DeallocateIpsolve(&solution); } while (fContinue); /*The return value is the logic inverse of cov.*/ Modified: spnbox/reduce.c =================================================================== --- spnbox/reduce.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/reduce.c 2009-08-14 21:47:00 UTC (rev 216) @@ -65,6 +65,7 @@ KeepRow[i] = 1; Rows++; } + DeallocateChkcons(&ChkResult); /*Otherwise the row is redundant. Leave it nulled out.*/ } Modified: spnbox/tactn.c =================================================================== --- spnbox/tactn.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/tactn.c 2009-08-14 21:47:00 UTC (rev 216) @@ -181,12 +181,17 @@ /*If we get a valid solution, then free memory and return false.*/ if (! strcmp(result.mhow, HOW_OK)) { + DeallocateIpsolve(&result); free(IntList); free(B); DeallocateMatrix(&Dx); DeallocateMatrix(&dx); return 0; } + else + { + DeallocateIpsolve(&result); + } } //If we get through all transition without returning false, return true. free(IntList); Modified: spnbox/tests/Makefile =================================================================== --- spnbox/tests/Makefile 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/tests/Makefile 2009-08-14 21:47:00 UTC (rev 216) @@ -4,6 +4,10 @@ #clean cleans the test routine executables and intermediate files. #<functionname> is the name of an spnbox function. This builds the test routines for that function. +#To remove the memwatch memory debugging routines: +#Make MEMWCOMP equal to COMPILER (removing the include and define options) +#Remove "memwatch.o" from the list of COMMON dependencies. + COMPILER=gcc -g MEMWCOMP=$(COMPILER) -include string.h -include ../../third-party/memwatch-2.71/memwatch.h -DMEMWATCH -DMEMWATCH_STDIO #The dependencies common to all test executables. @@ -42,8 +46,8 @@ $(COMPILER) -o extendedmatrix.exe test-extendedmatrix.o $(EXTENDEDMATRIX) $(COMMON) fvpr: test-fvpr.o $(FVPR) $(COMMON) $(COMPILER) -o fvpr.exe test-fvpr.o $(FVPR) $(COMMON) -ipslv: test-ipslv.o $(IPSLV) - $(COMPILER) -o ipslv.exe test-ipslv.o $(IPSLV) +ipslv: test-ipslv.o $(IPSLV) $(COMMON) + $(COMPILER) -o ipslv.exe test-ipslv.o $(IPSLV) $(COMMON) ipsolve: test-ipsolve.o $(COMMON) $(IPSOLVE) $(COMPILER) -o ipsolve.exe test-ipsolve.o $(COMMON) $(IPSOLVE) isadm: test-isadm.o $(ISADM) Modified: spnbox/tests/StructuredIO.c =================================================================== --- spnbox/tests/StructuredIO.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/tests/StructuredIO.c 2009-08-14 21:47:00 UTC (rev 216) @@ -380,6 +380,7 @@ } } va_end(args); + FreeMemory(&memory); } int* ReadIntArray(FILE* file, int* length) Modified: spnbox/tests/test-avpr.c =================================================================== --- spnbox/tests/test-avpr.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/tests/test-avpr.c 2009-08-14 21:47:00 UTC (rev 216) @@ -58,6 +58,7 @@ ShowOffset[0] = '\0'; printf("-------------------------------------------------------------------------------\n"); } + FreeMemory(&mem); return 1; } \ No newline at end of file Modified: spnbox/tests/test-dp.c =================================================================== --- spnbox/tests/test-dp.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/tests/test-dp.c 2009-08-14 21:47:00 UTC (rev 216) @@ -67,5 +67,6 @@ WriteLog[0] = '\0'; EnforceLive[0] = '\0'; } + FreeMemory(&mem); return 0; } Modified: spnbox/tests/test-extendedmatrix.txt =================================================================== --- spnbox/tests/test-extendedmatrix.txt 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/tests/test-extendedmatrix.txt 2009-08-14 21:47:00 UTC (rev 216) @@ -138,7 +138,7 @@ columns 1 optimization yes done - +quit echo Problem 13. Null row insertion, unoptimized speedtest. operation InsertNullRows size 20 Modified: spnbox/tests/test-fvpr.c =================================================================== --- spnbox/tests/test-fvpr.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/tests/test-fvpr.c 2009-08-14 21:47:00 UTC (rev 216) @@ -59,5 +59,6 @@ printf("-------------------------------------------------------------------------------\n"); } + FreeMemory(&mem); return 0; } Modified: spnbox/tests/test-linenf.c =================================================================== --- spnbox/tests/test-linenf.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/tests/test-linenf.c 2009-08-14 21:47:00 UTC (rev 216) @@ -40,9 +40,6 @@ /*Do the constraint enforcement.*/ sol = linenf(IFilled[1] ? &Dm : 0, IFilled[2] ? &Dp : 0, IFilled[5] ? &L : 0, IFilled[8] ? b : 0, IFilled[9] ? m0 : 0, IFilled[6] ? &F : 0, IFilled[7] ? &C : 0, IFilled[3] ? TucCount : 0, Tuc, IFilled[4] ? TuoCount : 0, Tuo); - ManageMatrix(&memory, &sol.Dfm); - ManageMatrix(&memory, &sol.Dfp); - /*Get the list of which output parameters are present for display. Also manage memory. (Defaults to nothing present)*/ memset(OFilled, 0, sizeof(int) * 8); Modified: spnbox/tests/test-msplit.c =================================================================== --- spnbox/tests/test-msplit.c 2009-08-14 08:10:08 UTC (rev 215) +++ spnbox/tests/test-msplit.c 2009-08-14 21:47:00 UTC (rev 216) @@ -60,14 +60,16 @@ int* Ret = 0; /*Clear the mask initially*/ memset(Mask, 0, sizeof(int) * 9); - /*Manage the memory and prepare the display mask while we're at it.*/ - ManageMatrix(mem, &Data->Dfm); - ManageMatrix(mem, &Data->Dfp); - ManageMatrix(mem, &Data->Df); - Mask[0] = 1; - Mask[1] = 1; - Mask[2] = 1; - CleanUpIncidence(mem, &Data->Df, &Data->Dfm, &Data->Dfp, Mask); + /*Prepare the display mask while we're at it.*/ + if (HasSelfLoops(&Data->Dfm, &Data->Dfp)) + { + Mask[1] = 1; + Mask[2] = 1; + } + else + { + Mask[0] = 1; + } if (NumberOfRows(Data->Mf)) { Mask[3] = 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |