[Pntool-developers] SF.net SVN: pntool:[228] spnbox
Brought to you by:
compaqdrew,
miordache
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. |