├── .idea ├── .name ├── copyright │ └── profiles_settings.xml ├── scopes │ └── scope_settings.xml ├── encodings.xml ├── modules.xml ├── libraries │ └── Maven__junit_junit_3_8_1.xml ├── misc.xml └── compiler.xml ├── dot-examples ├── gpm.mdg ├── samba.mdg ├── openssh.mdg ├── tcpdump.mdg ├── squid.mdg ├── rnd2.bunch ├── netkit-ping.mdg ├── nss_ldap.mdg ├── netkit-tftpd.mdg ├── netkit-inetd.mdg ├── regexp ├── sharutils.mdg ├── compiler ├── random ├── xtell.mdg ├── rnd39s ├── sysklogd-1.mdg ├── bootp.mdg ├── telnetd.mdg ├── netkit-ftp.mdg ├── tcsh.mdg ├── stunnel.mdg ├── telnet2.mdg ├── cyrus-sasl.mdg ├── crond.mdg ├── dhcpd-2.mdg ├── rnd39a ├── micq.mdg ├── net-tools.mdg ├── bison ├── bip-100-5.mdg ├── rnd-100-5.mdg ├── wu-ftpd-1.mdg └── php.mdg ├── .gitignore ├── BunchStats.log ├── src ├── main │ └── java │ │ └── bunch │ │ ├── gxl │ │ └── proxy │ │ │ └── IMDGtoGXL.java │ │ ├── WorkFinishedEvent.java │ │ ├── ObjectiveFunctionCalculator.java │ │ ├── api │ │ ├── ProgressCallback.java │ │ ├── ProgressCallbackInterface.java │ │ ├── BunchAsyncNotifyTest.java │ │ ├── BunchAsyncNotify.java │ │ ├── BunchAPITestCallback.java │ │ ├── BunchEdge.java │ │ ├── BunchMDG.java │ │ ├── BunchMDGDependency.java │ │ ├── BunchNode.java │ │ ├── BunchCluster.java │ │ └── BunchStatsTest.java │ │ ├── LoadBalancer │ │ ├── ServerStats.java │ │ └── Manager.java │ │ ├── WorkRequestEvent.java │ │ ├── IterationListener.java │ │ ├── BunchServer │ │ ├── BunchSvrMsg.java │ │ ├── DistribInit.java │ │ ├── ServerProperties.java │ │ ├── IterationManager.java │ │ ├── ServerClusteringEngine.java │ │ ├── FindNeighbor.java │ │ ├── BunchServer.java │ │ ├── BSTextServer.java │ │ ├── BSWindow_AboutBox.java │ │ ├── ServerSteepestAscentClusteringMethod.java │ │ └── _BunchSvrMsgImpl_Tie.java │ │ ├── ManagementEvent.java │ │ ├── ServerStats.java │ │ ├── Feature.java │ │ ├── BunchCliMsg.java │ │ ├── GeneralHillClimbingClusteringMethod.java │ │ ├── ParserFactory.java │ │ ├── Callback.java │ │ ├── SATechniqueFactory.java │ │ ├── BunchPreferencesDialog.java │ │ ├── BunchCliMsgImpl.java │ │ ├── BunchTest.java │ │ ├── GAMethodFactory.java │ │ ├── util │ │ └── MQCalculator.java │ │ ├── GraphOutputFactory.java │ │ ├── NAHCConfiguration.java │ │ ├── Population.java │ │ ├── IterationEvent.java │ │ ├── SATechnique.java │ │ ├── GridBagConstraints2.java │ │ ├── HillClimbingConfiguration.java │ │ ├── GATournamentMethod.java │ │ ├── ClusteringMethodFactory.java │ │ ├── SteepestAscentHillClimbingClusteringMethod2.java │ │ ├── ObjectiveFunctionCalculatorFactory.java │ │ ├── BunchEvent.java │ │ ├── SynchronizedEventQueue.java │ │ ├── Parser.java │ │ ├── Bunch.java │ │ ├── MQCalculatorUtil.java │ │ ├── stats │ │ └── StatsManager.java │ │ ├── _CallbackImpl_Tie.java │ │ ├── HillClimbingClusteringConfigurationDialog.java │ │ ├── BunchFrame_AboutBox.java │ │ ├── ClusterFileParser.java │ │ ├── SASimpleTechniqueDialog.java │ │ └── BunchPreferences.java └── test │ └── java │ └── edu │ └── drexel │ └── bunch4 │ └── AppTest.java ├── readme.md ├── Bunch.iml ├── pom.xml └── nbactions.xml /.idea/.name: -------------------------------------------------------------------------------- 1 | Bunch -------------------------------------------------------------------------------- /dot-examples/gpm.mdg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dot-examples/samba.mdg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dot-examples/openssh.mdg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /dot-examples/tcpdump.mdg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /src/main/java/bunch/CVS/ 2 | /target/ -------------------------------------------------------------------------------- /dot-examples/squid.mdg: -------------------------------------------------------------------------------- 1 | getopt helpers 4 2 | helpers getopt 1 3 | -------------------------------------------------------------------------------- /BunchStats.log: -------------------------------------------------------------------------------- 1 | Total MQ Calculations: 1760 2 | Simulated Annealing Overrides: 0 3 | -------------------------------------------------------------------------------- /.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /dot-examples/rnd2.bunch: -------------------------------------------------------------------------------- 1 | SS(M2.ss) = M6, M2 2 | SS(M11.ss) = M5, M11, M1 3 | SS(M7.ss) = M7, M13 4 | SS(M12.ss) = M8, M12 5 | SS(M4.ss) = M10, M4 6 | SS(M9.ss) = M9, M3 7 | -------------------------------------------------------------------------------- /.idea/scopes/scope_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | -------------------------------------------------------------------------------- /.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /dot-examples/netkit-ping.mdg: -------------------------------------------------------------------------------- 1 | ping ctype 1 2 | ping stdlib 12 3 | ping netdb 6 4 | ping unistd 9 5 | unistd ping 1 6 | ping errno 1 7 | ping signal 3 8 | ping select 1 9 | ping getopt 17 10 | ping time 2 11 | ping socket 7 12 | ping inet 7 13 | ping in 4 14 | ping stdio 31 15 | ping string 6 16 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /dot-examples/nss_ldap.mdg: -------------------------------------------------------------------------------- 1 | pam_ldap errno 1 2 | pam_ldap syslog 10 3 | pam_ldap crypt 2 4 | pam_ldap time 7 5 | md5 string 1 6 | pam_ldap ldap 73 7 | pam_ldap pam_modules 16 8 | pam_ldap stdio 9 9 | md5 pam_ldap 7 10 | pam_ldap string 47 11 | pam_ldap _pam_types 13 12 | pam_ldap unistd 9 13 | pam_ldap stdlib 31 14 | pam_ldap netdb 1 15 | pam_ldap md5 3 16 | pam_ldap lber 8 17 | -------------------------------------------------------------------------------- /dot-examples/netkit-tftpd.mdg: -------------------------------------------------------------------------------- 1 | stat tftpd 2 2 | tftpd pwd 2 3 | tftpd signal 2 4 | tftpd stat 1 5 | tftpd stdio 4 6 | tftpsubs ioctl 1 7 | tftpsubs socket 1 8 | tftpsubs libio 3 9 | tftpd string 8 10 | tftpd errno 4 11 | tftpd stdlib 4 12 | tftpsubs unistd 3 13 | tftpd tftpsubs 12 14 | tftpd ioctl 1 15 | tftpd fcntl 2 16 | tftpd setjmp 3 17 | tftpd syslog 6 18 | tftpd socket 14 19 | tftpd ctype 3 20 | tftpd in 12 21 | tftpd unistd 11 22 | tftpsubs tftpd 12 23 | tftpsubs stdio 4 24 | -------------------------------------------------------------------------------- /dot-examples/netkit-inetd.mdg: -------------------------------------------------------------------------------- 1 | inetd libio 2 2 | inetd fcntl 1 3 | inetd signal 7 4 | inetd resource 4 5 | daemon unistd 6 6 | inetd getopt 7 7 | inetd wait 2 8 | daemon fcntl 2 9 | inetd ctype 1 10 | inetd pwd 2 11 | inetd time 2 12 | inetd string 30 13 | inetd inet 2 14 | inetd stdlib 21 15 | inetd pmap_clnt 3 16 | inetd in 4 17 | inetd grp 4 18 | inetd daemon 1 19 | inetd select 2 20 | inetd stdio 25 21 | inetd syslog 11 22 | inetd socket 19 23 | inetd netdb 6 24 | inetd errno 2 25 | inetd unistd 28 26 | -------------------------------------------------------------------------------- /.idea/libraries/Maven__junit_junit_3_8_1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /src/main/java/bunch/gxl/proxy/IMDGtoGXL.java: -------------------------------------------------------------------------------- 1 | package bunch.gxl.proxy; 2 | 3 | /** 4 | * Title: Bunch Clustering Tool 5 | * Description: 6 | * Copyright: Copyright (c) 2000 7 | * Company: Drexel University 8 | * @author 9 | * @version 1.0 10 | */ 11 | 12 | public interface IMDGtoGXL { 13 | public boolean convert(); 14 | public void setOptions(String mdgF, String gxlF); 15 | public void setOptions(String mdgF, String gxlF, boolean embed); 16 | public void setOptions(String mdgF, String gxlF, String gxlPath); 17 | public void setOptions(String mdgF, String gxlF, String gxlPath, boolean embed); 18 | } -------------------------------------------------------------------------------- /src/main/java/bunch/WorkFinishedEvent.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: WorkFinishedEvent.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:59 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:12 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | public class WorkFinishedEvent { 21 | 22 | public int[] clusterVector; 23 | public int svrID; 24 | 25 | public WorkFinishedEvent() { 26 | } 27 | } -------------------------------------------------------------------------------- /dot-examples/regexp: -------------------------------------------------------------------------------- 1 | CharacterArrayCharacterIterator CharacterIterator 1 2 | RE RECompiler 2 3 | RE REProgram 6 4 | RE StringCharacterIterator 1 5 | ReaderCharacterIterator CharacterIterator 1 6 | recompile RECompiler 2 7 | recompile REProgram 1 8 | RECompiler REProgram 1 9 | RECompiler RESyntaxException 1 10 | REDebugCompiler RECompiler 11 11 | REDemo RE 7 12 | REDemo RECompiler 1 13 | REDemo REDebugCompiler 2 14 | RETest RE 24 15 | RETest RECompiler 2 16 | RETest REDebugCompiler 4 17 | RETest REProgram 2 18 | REUtil RE 3 19 | StreamCharacterIterator CharacterIterator 1 20 | StringCharacterIterator CharacterIterator 1 21 | -------------------------------------------------------------------------------- /src/main/java/bunch/ObjectiveFunctionCalculator.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: ObjectiveFunctionCalculator.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:53 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:10 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | public 21 | interface ObjectiveFunctionCalculator extends java.io.Serializable 22 | { 23 | public void calculate(); 24 | public void init(Graph g); 25 | public double calculate(Cluster c); 26 | } 27 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /src/main/java/bunch/api/ProgressCallback.java: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Title: Bunch Project

4 | * Description:

5 | * Copyright: Copyright (c) Brian Mitchell

6 | * Company: Drexel University - SERG

7 | * @author Brian Mitchell 8 | * @version 1.0 9 | */ 10 | 11 | /**** 12 | * 13 | * $Log: ProgressCallback.java,v $ 14 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 15 | * CVS Import 16 | * 17 | * Revision 3.0 2000/10/22 16:14:01 bsmitc 18 | * Changed version number to 3.0 to sync with rest of project 19 | * 20 | * Revision 1.1.1.1 2000/10/22 16:05:58 bsmitc 21 | * Initial Version 22 | * 23 | * 24 | */ 25 | package bunch.api; 26 | 27 | public class ProgressCallback { 28 | 29 | public ProgressCallback() { 30 | } 31 | } -------------------------------------------------------------------------------- /dot-examples/sharutils.mdg: -------------------------------------------------------------------------------- 1 | xmalloc error 1 2 | error stdio 10 3 | md5 string 2 4 | error errno 1 5 | xmalloc string 1 6 | whoami pwd 3 7 | xmalloc stdlib 8 8 | xgetcwd unistd 2 9 | uudecode libintl 6 10 | xstrdup string 2 11 | whoami utsname 1 12 | whoami unistd 2 13 | uudecode stdio 18 14 | error string 2 15 | uudecode pwd 2 16 | error stdlib 2 17 | uudecode errno 2 18 | xmalloc libintl 1 19 | xgetcwd stdlib 1 20 | whoami string 2 21 | error uudecode 2 22 | uudecode string 8 23 | uudecode stdlib 2 24 | uudecode locale 1 25 | xgetcwd errno 2 26 | xgetcwd xmalloc 4 27 | error libio 2 28 | xmalloc xstrdup 1 29 | error xmalloc 1 30 | xmalloc xgetcwd 3 31 | error libintl 1 32 | uudecode getopt 6 33 | uudecode error 4 34 | xstrdup xmalloc 1 35 | md5 stdio 3 36 | uudecode stat 1 37 | -------------------------------------------------------------------------------- /src/main/java/bunch/LoadBalancer/ServerStats.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: ServerStats.java,v $ 4 | * Revision 1.1.1.1 2002/02/03 18:30:06 bsmitc 5 | * CVS Import 6 | * 7 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 8 | * Imported CVS Sources 9 | * 10 | * 11 | */ 12 | 13 | /** 14 | * Title: Bunch Version 1.2 Base

15 | * Description: Your description

16 | * Copyright: Copyright (c) 1999

17 | * Company:

18 | * @author Brian Mitchell 19 | * @version 20 | */ 21 | package bunch.LoadBalancer; 22 | 23 | public class ServerStats { 24 | 25 | public int svrID = -1; 26 | public int totalWork = 0; 27 | public int currUOWSz = -1; 28 | public int workSinceLastAdjustment = 0; 29 | 30 | public ServerStats() { 31 | } 32 | } -------------------------------------------------------------------------------- /src/main/java/bunch/WorkRequestEvent.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: WorkRequestEvent.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:59 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:12 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | public class WorkRequestEvent { 21 | 22 | public int [] workToDo = null; 23 | public int [] workPerformed = null; 24 | public int requestWorkSz = 0; 25 | public int actualWorkSz = 0; 26 | public int svrID = -1; 27 | public String svrName = ""; 28 | public WorkRequestEvent() { 29 | } 30 | } -------------------------------------------------------------------------------- /src/main/java/bunch/IterationListener.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: IterationListener.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:52 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:10 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | /** 21 | * This interface is used to constrain event types to broadcast 22 | * iteration events 23 | * 24 | * @author Brian Mitchell 25 | */ 26 | public 27 | interface IterationListener 28 | { 29 | public void newIteration(IterationEvent e); 30 | public void newExperiment(IterationEvent e); 31 | } 32 | -------------------------------------------------------------------------------- /src/main/java/bunch/api/ProgressCallbackInterface.java: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Title: Bunch Project

4 | * Description:

5 | * Copyright: Copyright (c) Brian Mitchell

6 | * Company: Drexel University - SERG

7 | * @author Brian Mitchell 8 | * @version 1.0 9 | */ 10 | 11 | /**** 12 | * 13 | * $Log: ProgressCallbackInterface.java,v $ 14 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 15 | * CVS Import 16 | * 17 | * Revision 3.0 2000/10/22 16:14:01 bsmitc 18 | * Changed version number to 3.0 to sync with rest of project 19 | * 20 | * Revision 1.1.1.1 2000/10/22 16:05:58 bsmitc 21 | * Initial Version 22 | * 23 | * 24 | */ 25 | package bunch.api; 26 | 27 | import java.util.*; 28 | 29 | public interface ProgressCallbackInterface { 30 | 31 | public void stats(Hashtable h); 32 | } -------------------------------------------------------------------------------- /src/test/java/edu/drexel/bunch4/AppTest.java: -------------------------------------------------------------------------------- 1 | package edu.drexel.bunch4; 2 | 3 | import junit.framework.Test; 4 | import junit.framework.TestCase; 5 | import junit.framework.TestSuite; 6 | 7 | /** 8 | * Unit test for simple App. 9 | */ 10 | public class AppTest 11 | extends TestCase 12 | { 13 | /** 14 | * Create the test case 15 | * 16 | * @param testName name of the test case 17 | */ 18 | public AppTest( String testName ) 19 | { 20 | super( testName ); 21 | } 22 | 23 | /** 24 | * @return the suite of tests being tested 25 | */ 26 | public static Test suite() 27 | { 28 | return new TestSuite( AppTest.class ); 29 | } 30 | 31 | /** 32 | * Rigourous Test :-) 33 | */ 34 | public void testApp() 35 | { 36 | assertTrue( true ); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/bunch/BunchServer/BunchSvrMsg.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: BunchSvrMsg.java,v $ 4 | * Revision 3.0 2002/02/03 18:42:06 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:18 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch.BunchServer; 19 | 20 | import bunch.Callback; 21 | import java.rmi.Remote; 22 | import java.rmi.RemoteException; 23 | 24 | public interface BunchSvrMsg extends Remote{ 25 | 26 | boolean invokeMessage(String name, byte[] serializedClass) throws RemoteException; 27 | boolean registerCallback(Callback c) throws RemoteException; 28 | boolean doAction(String command) throws RemoteException; 29 | } 30 | -------------------------------------------------------------------------------- /src/main/java/bunch/api/BunchAsyncNotifyTest.java: -------------------------------------------------------------------------------- 1 | package bunch.api; 2 | 3 | /** 4 | * Title: Bunch Clustering Tool 5 | * Description: 6 | * Copyright: Copyright (c) 2000 7 | * Company: Drexel University 8 | * @author 9 | * @version 1.0 10 | */ 11 | 12 | public class BunchAsyncNotifyTest extends BunchAsyncNotify { 13 | 14 | Object monitor; 15 | 16 | public BunchAsyncNotifyTest() { 17 | monitor = new Object(); 18 | } 19 | 20 | public void notifyDone() { 21 | 22 | System.out.println("We are done"); 23 | synchronized(monitor) 24 | { monitor.notifyAll(); } 25 | } 26 | 27 | public void waitUntilDone() 28 | { 29 | System.out.println("Getting Ready To Wait"); 30 | try 31 | { 32 | synchronized(monitor) 33 | { monitor.wait(); } 34 | }catch(Exception e1) 35 | {e1.printStackTrace();} 36 | } 37 | } -------------------------------------------------------------------------------- /src/main/java/bunch/api/BunchAsyncNotify.java: -------------------------------------------------------------------------------- 1 | package bunch.api; 2 | 3 | /** 4 | * Title: Bunch Clustering Tool 5 | * Description: 6 | * Copyright: Copyright (c) 2000 7 | * Company: Drexel University 8 | * @author 9 | * @version 1.0 10 | */ 11 | 12 | public abstract class BunchAsyncNotify { 13 | 14 | public static final int STATUS_NONE = 1; 15 | public static final int STATUS_RUNNING = 2; 16 | public static final int STATUS_DONE = 3; 17 | 18 | public int status = STATUS_NONE; 19 | Thread th = null; 20 | 21 | public BunchAsyncNotify() { 22 | } 23 | 24 | public void setThread(Thread t) 25 | { th = t; } 26 | 27 | public Thread getThread() 28 | { return th; } 29 | 30 | public void setStatus(int s) 31 | { status = s; } 32 | 33 | public int getStatus() 34 | { return status; } 35 | 36 | public abstract void notifyDone(); 37 | } -------------------------------------------------------------------------------- /src/main/java/bunch/ManagementEvent.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: ManagementEvent.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:52 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:10 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | 19 | /** 20 | * Title: Bunch Version 1.2 Base

21 | * Description: Your description

22 | * Copyright: Copyright (c) 1999

23 | * Company:

24 | * @author Brian Mitchell 25 | * @version 26 | */ 27 | package bunch; 28 | 29 | /** 30 | * Not much functionality yet, but this clas is used to control management events 31 | */ 32 | public class ManagementEvent { 33 | 34 | boolean terminateThread = false; 35 | } -------------------------------------------------------------------------------- /dot-examples/compiler: -------------------------------------------------------------------------------- 1 | main declarations 2 | main parser 3 | main codeGenerator 4 | parser declarations 5 | parser scanner 6 | parser scopeController 7 | parser typeChecker 8 | parser codeGenerator 9 | codeGenerator declarations 10 | codeGenerator dictionary 11 | codeGenerator dictIdxStack 12 | codeGenerator scopeController 13 | codeGenerator addrStack 14 | scanner declarations 15 | scopeController declarations 16 | scopeController dictionary 17 | scopeController dictIdxStack 18 | scopeController dictStack 19 | typeChecker declarations 20 | typeChecker dictStack 21 | typeChecker dictionary 22 | typeChecker dictIdxStack 23 | typeChecker typeStack 24 | typeChecker argCntStack 25 | dictionary declarations 26 | dictionary dictStack 27 | dictIdxStack declarations 28 | dictIdxStack dictStack 29 | addrStack declarations 30 | dictStack declarations 31 | typeStack declarations 32 | argCntStack declarations 33 | -------------------------------------------------------------------------------- /src/main/java/bunch/BunchServer/DistribInit.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: DistribInit.java,v $ 4 | * Revision 3.0 2002/02/03 18:42:06 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:18 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch.BunchServer; 19 | 20 | import bunch.*; 21 | 22 | public class DistribInit implements java.io.Serializable{ 23 | 24 | public String svrName; 25 | public int svrID; 26 | public Graph theGraph; 27 | public String clusteringTechnique; 28 | public String objFunction; 29 | public Configuration config; 30 | public BunchPreferences bp; 31 | public boolean adaptiveEnabled; 32 | 33 | public DistribInit() { 34 | } 35 | } -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # Bunch 2 | 3 | This is a project that I built as part of my Ph.D. research in Computer Science at [Drexel University](http://drexel.edu/cci/). 4 | 5 | The project has been recently updated to use Maven as the build system, and to take advantage of JDK/JRE 8 optimizers. 6 | 7 | The code was actively developed from 1998-2001, and has been lightly patched since then. Its a goal of mine to update the code base to modern Java standards, and even reimplment part of the code in Scala. 8 | 9 | More information on the Bunch tool and my research into software clustering can be found on my [webpage](https://www.cs.drexel.edu/~bmitchell/new/#/research) 10 | 11 | I'd welcome pull requests if you would like to contribute towards modernizing the codebase. 12 | 13 | ### Licensing 14 | 15 | The source code is licensed under GPL v3. License is available [here](https://www.gnu.org/licenses/gpl-3.0.en.html). 16 | -------------------------------------------------------------------------------- /src/main/java/bunch/ServerStats.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: ServerStats.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:55 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:11 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | 19 | /** 20 | * Title: Bunch Version 1.2 Base

21 | * Description: Your description

22 | * Copyright: Copyright (c) 1999

23 | * Company:

24 | * @author Brian Mitchell 25 | * @version 26 | */ 27 | package bunch; 28 | 29 | public class ServerStats { 30 | 31 | public ServerStats() { 32 | } 33 | 34 | public void registerServer(int serverID) 35 | {} 36 | 37 | public void updateServerWork(int work) 38 | {} 39 | 40 | 41 | } -------------------------------------------------------------------------------- /src/main/java/bunch/Feature.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: Feature.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:48 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:03 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:09 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | /** 21 | * An interface used to create procedures that can extend other processes 22 | * generically. The objects that implement this interface will be serializable. 23 | * 24 | * @author Brian Mitchell 25 | * 26 | * @see bunch.Configuration 27 | */ 28 | public 29 | interface Feature 30 | extends java.io.Serializable 31 | { 32 | /** 33 | * The method to be implemented by classes that use this interface. 34 | */ 35 | public 36 | void 37 | apply(Object o); 38 | } 39 | -------------------------------------------------------------------------------- /src/main/java/bunch/BunchCliMsg.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: BunchCliMsg.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:43 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:03 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:07 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:33 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | 19 | /** 20 | * This interface is used by the Bunch client in distributed node as the 21 | * callback entry point. All messages received have a name to identify thier 22 | * type, and a serialized class to contain the resultant class. 23 | * 24 | * @author Brian Mitchell 25 | */ 26 | package bunch; 27 | 28 | import java.rmi.Remote; 29 | import java.rmi.RemoteException; 30 | 31 | public interface BunchCliMsg extends Remote{ 32 | 33 | boolean recvMessage(String name, byte[] serializedClass) throws RemoteException; 34 | } 35 | -------------------------------------------------------------------------------- /src/main/java/bunch/api/BunchAPITestCallback.java: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Title: Bunch Project

4 | * Description:

5 | * Copyright: Copyright (c) Brian Mitchell

6 | * Company: Drexel University - SERG

7 | * @author Brian Mitchell 8 | * @version 1.0 9 | */ 10 | 11 | /**** 12 | * 13 | * $Log: BunchAPITestCallback.java,v $ 14 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 15 | * CVS Import 16 | * 17 | * Revision 3.0 2000/10/22 16:14:01 bsmitc 18 | * Changed version number to 3.0 to sync with rest of project 19 | * 20 | * Revision 1.1.1.1 2000/10/22 16:05:57 bsmitc 21 | * Initial Version 22 | * 23 | * 24 | */ 25 | package bunch.api; 26 | 27 | import java.util.*; 28 | 29 | public class BunchAPITestCallback implements ProgressCallbackInterface { 30 | 31 | public BunchAPITestCallback() { 32 | } 33 | 34 | public void stats(Hashtable h) 35 | { 36 | System.out.println("Callback executed"); 37 | System.err.flush(); 38 | } 39 | } -------------------------------------------------------------------------------- /Bunch.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /src/main/java/bunch/GeneralHillClimbingClusteringMethod.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: GeneralHillClimbingClusteringMethod.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:49 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:03 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.1 2000/10/22 17:49:14 bsmitc 11 | * This class is starting basicly as an alias for the NAHC clustering method 12 | * 13 | * 14 | */ 15 | /** 16 | * Title: Bunch Project

17 | * Description:

18 | * Copyright: Copyright (c) Brian Mitchell

19 | * Company: Drexel University - SERG

20 | * @author Brian Mitchell 21 | * @version 1.0 22 | */ 23 | package bunch; 24 | 25 | /** 26 | * This class was used to alias the general hill climbing method with the 27 | * NAHC method 28 | */ 29 | public class GeneralHillClimbingClusteringMethod extends NextAscentHillClimbingClusteringMethod { 30 | 31 | public GeneralHillClimbingClusteringMethod() { 32 | super(); 33 | } 34 | } -------------------------------------------------------------------------------- /src/main/java/bunch/api/BunchEdge.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: BunchEdge.java,v $ 4 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 5 | * CVS Import 6 | * 7 | * Revision 3.1 2000/11/26 15:45:34 bsmitc 8 | * Initial Version - support for the BunchGraph api interface 9 | * 10 | * 11 | */ 12 | /** 13 | * Title: Bunch Project

14 | * Description:

15 | * Copyright: Copyright (c) Brian Mitchell

16 | * Company: Drexel University - SERG

17 | * @author Brian Mitchell 18 | * @version 1.0 19 | */ 20 | package bunch.api; 21 | 22 | public class BunchEdge { 23 | 24 | int weight; 25 | BunchNode srcNode; 26 | BunchNode destNode; 27 | 28 | public BunchEdge(int w, BunchNode src, BunchNode dest) { 29 | weight = w; 30 | srcNode = src; 31 | destNode = dest; 32 | } 33 | 34 | public int getWeight() 35 | { return weight; } 36 | 37 | public BunchNode getSrcNode() 38 | { return srcNode; } 39 | 40 | public BunchNode getDestNode() 41 | { return destNode; } 42 | } -------------------------------------------------------------------------------- /dot-examples/random: -------------------------------------------------------------------------------- 1 | typeChecker dictionary 1 2 | argCntStack parser 1 3 | dictStack typeStack 1 4 | scanner parser 1 5 | declarations argCntStack 1 6 | main dictStack 1 7 | typeChecker scanner 1 8 | codeGenerator dictIdxStack 1 9 | codeGenerator argCntStack 1 10 | dictIdxStack typeChecker 1 11 | parser addrStack 1 12 | scanner scopeController 1 13 | codeGenerator declarations 1 14 | dictStack parser 1 15 | dictionary typeChecker 1 16 | scanner codeGenerator 1 17 | main codeGenerator 1 18 | scanner scopeController 1 19 | typeChecker addrStack 1 20 | codeGenerator argCntStack 1 21 | codeGenerator dictionary 1 22 | dictIdxStack scanner 1 23 | dictionary codeGenerator 1 24 | parser typeChecker 1 25 | dictIdxStack main 1 26 | declarations codeGenerator 1 27 | addrStack parser 1 28 | typeChecker typeStack 1 29 | codeGenerator scanner 1 30 | dictStack main 1 31 | argCntStack codeGenerator 1 32 | dictStack dictionary 1 33 | -------------------------------------------------------------------------------- /src/main/java/bunch/BunchServer/ServerProperties.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: ServerProperties.java,v $ 4 | * Revision 3.0 2002/02/03 18:42:07 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:18 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch.BunchServer; 19 | 20 | import bunch.*; 21 | 22 | public class ServerProperties { 23 | 24 | public String svrName = null; 25 | public int svrID = -1; 26 | public Graph theGraph = null; 27 | public String clusteringMethod = null; 28 | public String objFn = null; 29 | public Configuration cfg = null; 30 | public BunchPreferences bp = null; 31 | public Callback clientCB = null; 32 | public boolean adaptiveEnabled = true; 33 | public String jndiName = ""; 34 | public double bestObjFnValue = -1.0; 35 | 36 | public ServerProperties() { 37 | } 38 | } -------------------------------------------------------------------------------- /dot-examples/xtell.mdg: -------------------------------------------------------------------------------- 1 | daemon xtelld 4 2 | child errno 1 3 | child string 3 4 | stat tty 2 5 | child inet 1 6 | common child 4 7 | tty time 4 8 | child stdlib 1 9 | daemon unistd 5 10 | tty common 2 11 | stat common 2 12 | common string 5 13 | common stdlib 3 14 | child tty 1 15 | child socket 2 16 | xtelld common 1 17 | xtelld daemon 1 18 | xtelld syslog 3 19 | common stat 1 20 | common socket 1 21 | daemon string 2 22 | tty utmp 4 23 | daemon stdlib 2 24 | xtelld stdio 6 25 | xtelld unistd 2 26 | child ident 2 27 | daemon in 2 28 | tty stdio 6 29 | daemon stdio 4 30 | xtelld errno 1 31 | child netdb 2 32 | tty string 18 33 | daemon socket 7 34 | xtelld child 3 35 | tty stdlib 3 36 | daemon errno 2 37 | common tty 1 38 | tty child 5 39 | daemon child 2 40 | common pwd 2 41 | xtelld string 4 42 | child daemon 2 43 | xtelld stdlib 8 44 | daemon signal 2 45 | child common 3 46 | child syslog 1 47 | common daemon 2 48 | daemon wait 1 49 | child xtelld 3 50 | child unistd 1 51 | xtelld socket 1 52 | tty stat 1 53 | common unistd 2 54 | common stdio 2 55 | daemon common 3 56 | daemon syslog 4 57 | xtelld signal 1 58 | -------------------------------------------------------------------------------- /src/main/java/bunch/ParserFactory.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: ParserFactory.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:54 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:11 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | /** 21 | * A factory for parsers of different kinds 22 | * 23 | * @author Diego Doval 24 | * @version 1.0 25 | * @see bunch.Parser 26 | * @see bunch.GenericFactory 27 | */ 28 | public 29 | class ParserFactory 30 | extends GenericFactory 31 | { 32 | 33 | public 34 | ParserFactory() 35 | { 36 | super(); 37 | setFactoryType("Parser"); 38 | addItem("dependency", "bunch.DependencyFileParser"); 39 | addItem("gxl", "bunch.gxl.parser.GXLGraphParser"); 40 | addItem("cluster", "bunch.ClusterFileParser"); 41 | } 42 | 43 | public 44 | Parser 45 | getParser(String name) 46 | { 47 | return (Parser)getItemInstance(name); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /src/main/java/bunch/Callback.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: Callback.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:45 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:03 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:07 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:33 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | import java.rmi.Remote; 21 | import java.rmi.RemoteException; 22 | 23 | /** 24 | * This interface is used to wrapper the various types of callbacks from the 25 | * client or server that must be handled. At the minimum each method in the 26 | * implementation has at lease a string input indicating the message type. 27 | * 28 | * @author Brian Mitchell 29 | * @see CallbackImpl 30 | */ 31 | public interface Callback extends Remote 32 | { 33 | byte[] callFromServer(String input) throws RemoteException; 34 | byte[] callFromServerWithObj(String input, byte[]so) throws RemoteException; 35 | boolean bCallFromServerWithObj(String input, byte[]so) throws RemoteException; 36 | boolean bCallFromServer(String input) throws RemoteException; 37 | } 38 | -------------------------------------------------------------------------------- /src/main/java/bunch/BunchServer/IterationManager.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: IterationManager.java,v $ 4 | * Revision 3.0 2002/02/03 18:42:07 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:18 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch.BunchServer; 19 | 20 | import bunch.*; 21 | 22 | public class IterationManager implements java.io.Serializable{ 23 | public static final int DIR_TO_CLIENT = 1; 24 | public static final int DIR_TO_SERVER = 2; 25 | 26 | public static final String MSG_GET_CLUSTER_VECTOR = "GET_CLUSTER_VECTOR"; 27 | public static final String MSG_SEND_CLUSTER_VECTOR = "SEND_CLUSTER_VECTOR"; 28 | 29 | public String msgType = null; 30 | public int msgID = -1; 31 | public String jndiServerName = null; 32 | public int svrID = -1; 33 | public int[] clusterVector = null; 34 | public int[] workVector = null; 35 | public int direction = -1; 36 | public int uowSz = -1; 37 | 38 | public IterationManager() { 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /src/main/java/bunch/SATechniqueFactory.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: SATechniqueFactory.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:55 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.2 2000/08/13 18:40:07 bsmitc 11 | * Added support for SA framework 12 | * 13 | * Revision 3.1 2000/08/12 22:58:26 bsmitc 14 | * Adding Simulated Annealing Support To Project 15 | * 16 | * 17 | */ 18 | 19 | /** 20 | * Title: Bunch Project

21 | * Description:

22 | * Copyright: Copyright (c) Brian Mitchell

23 | * Company: Drexel University - SERG

24 | * @author Brian Mitchell 25 | * @version 1.0 26 | */ 27 | package bunch; 28 | 29 | public class SATechniqueFactory 30 | extends GenericFactory{ 31 | 32 | String defaultFactoryItem = "Simple Algorithm"; 33 | 34 | public SATechniqueFactory() { 35 | super(); 36 | setFactoryType("SATechnique"); 37 | addItem("Simple Algorithm", "bunch.SASimpleTechnique"); 38 | } 39 | 40 | public String getDefaultTechnique() 41 | { 42 | return defaultFactoryItem; 43 | } 44 | 45 | public 46 | SATechnique 47 | getMethod(String name) 48 | { 49 | return (SATechnique)getItemInstance(name); 50 | } 51 | } -------------------------------------------------------------------------------- /src/main/java/bunch/BunchPreferencesDialog.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: BunchPreferencesDialog.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:44 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:03 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:07 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:33 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | import java.awt.*; 21 | import javax.swing.*; 22 | 23 | /** 24 | * Dialog that can be used in a future version to configure the preferences 25 | * and then store them. 26 | * 27 | * @author Brian Mitchell 28 | */ 29 | public 30 | class BunchPreferencesDialog 31 | extends JDialog 32 | { 33 | JPanel panel1 = new JPanel(); 34 | 35 | public 36 | BunchPreferencesDialog(Frame frame, String title, boolean modal) 37 | { 38 | super(frame, title, modal); 39 | try { 40 | jbInit(); 41 | pack(); 42 | } 43 | catch (Exception ex) { 44 | ex.printStackTrace(); 45 | } 46 | } 47 | 48 | public 49 | BunchPreferencesDialog() 50 | { 51 | this(null, "", false); 52 | } 53 | 54 | private 55 | void 56 | jbInit() throws Exception 57 | { 58 | getContentPane().add(panel1); 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /src/main/java/bunch/BunchCliMsgImpl.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: BunchCliMsgImpl.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:43 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:03 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:07 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:33 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | import java.rmi.RemoteException; 21 | import javax.rmi.PortableRemoteObject; 22 | import java.util.Properties; 23 | import javax.naming.*; 24 | import java.rmi.RMISecurityManager; 25 | 26 | /** 27 | * This class implements the BunchCliMsg interface. For the current distribtued 28 | * serivces of Bunch, this clss is not used. Instead of direct reverse calls the 29 | * Callback class is used. 30 | * 31 | * All distributed operations are initiated by the Bunch Client and all responses 32 | * are by asynchronous callback. 33 | * 34 | * @author Brian Mitchell 35 | */ 36 | public class BunchCliMsgImpl extends PortableRemoteObject implements BunchCliMsg{ 37 | 38 | public BunchCliMsgImpl() throws RemoteException { 39 | } 40 | 41 | public boolean recvMessage(String name, byte[] serializedClass) 42 | { 43 | return true; 44 | } 45 | } -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 32 | -------------------------------------------------------------------------------- /dot-examples/rnd39s: -------------------------------------------------------------------------------- 1 | M27 M38 1 2 | M37 M22 1 3 | M32 M16 1 4 | M27 M34 1 5 | M33 M18 1 6 | M39 M26 1 7 | M33 M16 1 8 | M38 M20 1 9 | M6 M29 1 10 | M39 M20 1 11 | M35 M18 1 12 | M25 M27 1 13 | M13 M31 1 14 | M26 M25 1 15 | M20 M14 1 16 | M10 M29 1 17 | M10 M28 1 18 | M20 M12 1 19 | M10 M26 1 20 | M5 M16 1 21 | M22 M14 1 22 | M19 M39 1 23 | M22 M10 1 24 | M18 M33 1 25 | M18 M2 1 26 | M17 M7 1 27 | M18 M1 1 28 | M28 M6 1 29 | M28 M5 1 30 | M17 M5 1 31 | M17 M4 1 32 | M16 M9 1 33 | M8 M19 1 34 | M27 M5 1 35 | M16 M6 1 36 | M15 M7 1 37 | M37 M4 1 38 | M15 M24 1 39 | M15 M21 1 40 | M16 M25 1 41 | M15 M1 1 42 | M36 M3 1 43 | M25 M3 1 44 | M29 M19 1 45 | M17 M24 1 46 | M14 M1 1 47 | M17 M20 1 48 | M34 M8 1 49 | M35 M2 1 50 | M23 M6 1 51 | M33 M9 1 52 | M32 M9 1 53 | M11 M3 1 54 | M10 M3 1 55 | M16 M14 1 56 | M19 M16 1 57 | M2 M7 1 58 | M1 M35 1 59 | M35 M32 1 60 | M31 M28 1 61 | M38 M39 1 62 | M20 M33 1 63 | M38 M37 1 64 | M3 M33 1 65 | M21 M32 1 66 | M21 M31 1 67 | M33 M24 1 68 | M23 M37 1 69 | M23 M34 1 70 | M25 M37 1 71 | M30 M17 1 72 | M25 M34 1 73 | M2 M23 1 74 | M9 M36 1 75 | -------------------------------------------------------------------------------- /src/main/java/bunch/BunchTest.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: BunchTest.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:45 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:03 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.1 2000/10/22 15:48:48 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 3.0 2000/07/26 22:46:07 bsmitc 14 | * *** empty log message *** 15 | * 16 | * Revision 1.1.1.1 2000/07/26 22:43:33 bsmitc 17 | * Imported CVS Sources 18 | * 19 | * 20 | */ 21 | package bunch; 22 | 23 | /** 24 | * This class is a small built in self test for the old Bunch API. By 25 | * ocassionally running this class we can ensure that other changes to the 26 | * base code still support the old API. 27 | * 28 | * @author Brian Mitchell 29 | */ 30 | public 31 | class BunchTest 32 | { 33 | 34 | public 35 | BunchTest() 36 | { 37 | } 38 | 39 | public static 40 | void 41 | main(String[] args) 42 | { 43 | try 44 | { 45 | System.out.println("TEST: Clustering bunch (need MDG file named bunch)..."); 46 | BunchAPIOld b = new BunchAPIOld("d:\\bunch\\mdgs\\random37.mdg"); 47 | b.runBatch(100); 48 | System.out.println("TEST Finished, check bunchTest.dot file for output!"); 49 | } 50 | catch (Exception e) { 51 | e.printStackTrace(); 52 | } 53 | 54 | } 55 | } 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | edu.drexel 6 | Bunch 7 | jar 8 | 9 | Bunch4 10 | http://maven.apache.org 11 | 12 | 13 | UTF-8 14 | 15 | 16 | 17 | 18 | junit 19 | junit 20 | 3.8.1 21 | test 22 | 23 | 24 | 3.5 25 | 26 | 27 | 28 | org.apache.maven.plugins 29 | maven-jar-plugin 30 | 3.0.2 31 | 32 | 33 | 34 | bunch.Bunch 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /dot-examples/sysklogd-1.mdg: -------------------------------------------------------------------------------- 1 | syslogd uio 2 2 | klogd pidfile 5 3 | ksym stdlib 8 4 | syslogd utmp 5 5 | syslogd unistd 18 6 | klogd stdio 28 7 | stat klogd 1 8 | ksym ksym_mod 6 9 | syslogd pidfile 1 10 | syslogd netdb 9 11 | syslog errno 2 12 | pidfile signal 1 13 | syslogd string 59 14 | syslog fcntl 2 15 | ksym_mod klogd 3 16 | pidfile stdio 14 17 | klogd syslogd 62 18 | klogd stdlib 7 19 | syslogd ctype 10 20 | klogd ksym_mod 2 21 | klogd socket 2 22 | syslogd wait 1 23 | klogd netdb 1 24 | stat syslogd 2 25 | pidfile unistd 6 26 | syslogd errno 11 27 | klogd signal 6 28 | klogd getopt 6 29 | ksym stdio 29 30 | syslogd fcntl 8 31 | ksym_mod errno 1 32 | ksym_mod stdlib 13 33 | syslog socket 3 34 | pidfile string 1 35 | klogd ctype 2 36 | ksym_mod fcntl 2 37 | ksym string 13 38 | klogd select 1 39 | klogd syslog 3 40 | pidfile syslogd 3 41 | syslog stdio 2 42 | pidfile file 1 43 | ksym utsname 2 44 | klogd errno 4 45 | klogd unistd 17 46 | klogd fcntl 2 47 | syslog time 3 48 | syslogd stdlib 19 49 | klogd stat 1 50 | syslogd setjmp 2 51 | klogd string 13 52 | syslogd socket 11 53 | ksym klogd 13 54 | syslog unistd 5 55 | pidfile errno 2 56 | klogd inet 1 57 | syslogd stat 2 58 | pidfile fcntl 3 59 | syslog uio 1 60 | ksym_mod unistd 2 61 | syslogd signal 6 62 | syslogd stdio 19 63 | syslogd getopt 1 64 | klogd klog 4 65 | syslog string 8 66 | syslogd time 11 67 | ksym_mod stdio 2 68 | syslogd inet 1 69 | syslog klogd 3 70 | ksym_mod ksym 6 71 | ksym_mod string 9 72 | syslogd select 1 73 | syslogd syslog 4 74 | klogd ksym 5 75 | -------------------------------------------------------------------------------- /dot-examples/bootp.mdg: -------------------------------------------------------------------------------- 1 | bootpd tzone 1 2 | dovend bootpd 8 3 | lookup string 1 4 | bootpd readfile 6 5 | report bootpd 4 6 | bootpd errno 1 7 | lookup netdb 2 8 | readfile string 14 9 | dumptab stdio 8 10 | dumptab hwaddr 3 11 | hwaddr report 2 12 | bootpd dumptab 1 13 | tzone report 2 14 | bootpd stat 1 15 | bootpd dovend 4 16 | dumptab stdlib 1 17 | readfile ctype 12 18 | report dovend 1 19 | bootpd hwaddr 6 20 | readfile bootpd 13 21 | getif report 1 22 | bootpd utsname 1 23 | bootpd in 11 24 | hwaddr string 2 25 | bootpd inet 3 26 | hash string 2 27 | readfile tzone 2 28 | bootpd hash 7 29 | bootpd stdlib 4 30 | bootpd getif 2 31 | stat bootpd 3 32 | bootpd socket 7 33 | readfile hwaddr 9 34 | hwaddr bootpd 14 35 | lookup readfile 8 36 | hash bootpd 16 37 | hwaddr dumptab 2 38 | bootpd stdio 6 39 | dovend in 4 40 | bootpd signal 2 41 | hwaddr stdio 1 42 | getif bootpd 2 43 | readfile stdlib 8 44 | dumptab report 2 45 | getif ioctl 2 46 | readfile stat 2 47 | tzone time 1 48 | hwaddr ioctl 1 49 | report stdio 3 50 | bootpd select 2 51 | readfile lookup 6 52 | hash hwaddr 1 53 | dovend report 1 54 | stat readfile 3 55 | bootpd report 8 56 | dumptab string 1 57 | stat stdio 1 58 | bootpd unistd 3 59 | hwaddr readfile 1 60 | readfile hash 9 61 | bootpd netdb 4 62 | readfile assert 3 63 | dumptab time 3 64 | readfile stdio 10 65 | hash stdlib 5 66 | dumptab inet 2 67 | dovend string 4 68 | bootpd string 21 69 | readfile in 2 70 | dumptab hash 4 71 | lookup report 1 72 | lookup in 4 73 | dumptab bootpd 6 74 | hash readfile 15 75 | readfile report 8 76 | -------------------------------------------------------------------------------- /src/main/java/bunch/GAMethodFactory.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: GAMethodFactory.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:49 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:03 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:09 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | /** 21 | * A factory for different kinds of methods for the GA 22 | * 23 | * @author Diego Doval / Brian Mitchell 24 | * @version 1.0 25 | * @see bunch.GAMethod 26 | * @see bunch.GenericFactory 27 | */ 28 | public 29 | class GAMethodFactory 30 | extends GenericFactory 31 | { 32 | 33 | /** 34 | * Class constructor, defines the objects that the factory will be able 35 | * to create 36 | */ 37 | public 38 | GAMethodFactory() 39 | { 40 | super(); 41 | setFactoryType("GAMethod"); 42 | addItem("tournament", "bunch.GATournamentMethod"); 43 | addItem("roulette wheel", "bunch.GARouletteWheelMethod"); 44 | } 45 | 46 | /** 47 | * Obtains the GA method corresponding to name passed as parameter. 48 | * Utility method that uses the #getItemInstance(java.lang.String) method 49 | * from GenericFactory and casts the object to a GAMethod object. 50 | * 51 | * @param the name for the desired method 52 | * @return the GA method corresponding to the name 53 | */ 54 | public 55 | GAMethod 56 | getMethod(String name) 57 | { 58 | return (GAMethod)getItemInstance(name); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /src/main/java/bunch/BunchServer/ServerClusteringEngine.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: ServerClusteringEngine.java,v $ 4 | * Revision 3.0 2002/02/03 18:42:07 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:18 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch.BunchServer; 19 | 20 | import bunch.*; 21 | 22 | public class ServerClusteringEngine { 23 | 24 | ServerProperties sProps; 25 | 26 | public ServerClusteringEngine(ServerProperties sp) { 27 | sProps = sp; 28 | } 29 | 30 | public boolean run() 31 | { 32 | sProps.theGraph.setRandom(new java.util.Random(10)); 33 | //ClusteringMethod2 cm = (ClusteringMethod2)new SteepestAscentHillClimbingClusteringMethod2(); 34 | ClusteringMethod2 cm = (ClusteringMethod2)new ServerSteepestAscentClusteringMethod(); 35 | 36 | HillClimbingConfiguration hcc = (HillClimbingConfiguration)cm.getConfiguration(); 37 | hcc.setNumOfIterations(1); 38 | hcc.setThreshold(1.0); 39 | ((GenericDistribHillClimbingClusteringMethod)cm).setConfiguration(hcc); 40 | 41 | cm.initialize(); 42 | cm.setGraph(sProps.theGraph.cloneGraph()); 43 | cm.run(); 44 | Cluster c = cm.getBestCluster(); 45 | Graph g = cm.getBestGraph(); 46 | 47 | sProps.theGraph = g.cloneGraph(); 48 | 49 | return true; 50 | } 51 | 52 | 53 | } -------------------------------------------------------------------------------- /src/main/java/bunch/api/BunchMDG.java: -------------------------------------------------------------------------------- 1 | package bunch.api; 2 | 3 | import java.util.*; 4 | 5 | /**** 6 | * 7 | * $Log: BunchMDG.java,v $ 8 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 9 | * CVS Import 10 | * 11 | * 12 | */ 13 | 14 | /** 15 | * Title: Bunch Clustering Tool 16 | * Description: 17 | * Copyright: Copyright (c) 2000 18 | * Company: Drexel University 19 | * @author 20 | * @version 1.0 21 | */ 22 | 23 | public class BunchMDG { 24 | ArrayList mdgEdges = null; 25 | 26 | public BunchMDG() { 27 | mdgEdges = new ArrayList(); 28 | } 29 | 30 | public boolean addMDGEdges(Collection c) 31 | { 32 | return mdgEdges.addAll(c); 33 | } 34 | 35 | public boolean setMDGEdges(Collection c) 36 | { 37 | mdgEdges.clear(); 38 | return addMDGEdges(c); 39 | } 40 | 41 | public boolean addMDGEdge(BunchMDGDependency d) 42 | { 43 | return mdgEdges.add(d); 44 | } 45 | 46 | public boolean addMDGEdge(String s, String d, int w, String r) 47 | { 48 | BunchMDGDependency bmd = new BunchMDGDependency(s,d,w,r); 49 | return addMDGEdge(bmd); 50 | } 51 | 52 | public boolean addMDGEdge(String s, String d, int w) 53 | { 54 | BunchMDGDependency bmd = new BunchMDGDependency(s,d,w); 55 | return addMDGEdge(bmd); 56 | } 57 | 58 | public boolean addMDGEdge(String s, String d) 59 | { 60 | BunchMDGDependency bmd = new BunchMDGDependency(s,d); 61 | return addMDGEdge(bmd); 62 | } 63 | 64 | public void clearMDG() 65 | { 66 | mdgEdges.clear(); 67 | } 68 | 69 | public Collection getMDGEdges() 70 | { 71 | return mdgEdges; 72 | } 73 | } -------------------------------------------------------------------------------- /src/main/java/bunch/api/BunchMDGDependency.java: -------------------------------------------------------------------------------- 1 | package bunch.api; 2 | 3 | /**** 4 | * 5 | * $Log: BunchMDGDependency.java,v $ 6 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 7 | * CVS Import 8 | * 9 | * 10 | */ 11 | 12 | /** 13 | * Title: Bunch Clustering Tool 14 | * Description: 15 | * Copyright: Copyright (c) 2000 16 | * Company: Drexel University 17 | * @author 18 | * @version 1.0 19 | */ 20 | 21 | public class BunchMDGDependency { 22 | 23 | String srcNode; 24 | String destNode; 25 | int edgeW; 26 | String relType; 27 | 28 | public BunchMDGDependency() { 29 | srcNode = null; 30 | destNode = null; 31 | edgeW = 0; 32 | relType = null; 33 | } 34 | 35 | public BunchMDGDependency(String s, String d, int w, String r) 36 | { 37 | srcNode = s; 38 | destNode = d; 39 | edgeW = w; 40 | relType = r; 41 | } 42 | 43 | public BunchMDGDependency(String s, String d, int w) 44 | { 45 | srcNode = s; 46 | destNode = d; 47 | edgeW = w; 48 | } 49 | 50 | public BunchMDGDependency(String s, String d) 51 | { 52 | srcNode = s; 53 | destNode = d; 54 | edgeW = 1; 55 | } 56 | 57 | public void setSrcNode(String n) 58 | { srcNode = n; } 59 | 60 | public String getSrcNode() 61 | { return srcNode; } 62 | 63 | public void setDestNode(String n) 64 | { destNode = n; } 65 | 66 | public String getDestNode() 67 | { return destNode; } 68 | 69 | public void setRelType(String t) 70 | { relType = t; } 71 | 72 | public String getRelType() 73 | { return relType; } 74 | 75 | public void setEdgeW(int w) 76 | { edgeW = w; } 77 | 78 | public int getEdgeW() 79 | { return edgeW; } 80 | } -------------------------------------------------------------------------------- /dot-examples/telnetd.mdg: -------------------------------------------------------------------------------- 1 | utility select 2 2 | telnetd state 5 3 | utility syslog 1 4 | telnetd unistd 7 5 | state termstat 1 6 | telnetd errno 3 7 | utility state 20 8 | utility errno 6 9 | telnetd fcntl 2 10 | state stdlib 6 11 | utility unistd 8 12 | telnetd string 11 13 | sys_term pty 1 14 | unistd stdlib 1 15 | termstat ioctl 1 16 | utility string 10 17 | termstat sys_term 8 18 | telnetd term 1 19 | setproctitle stdio 1 20 | ext utility 9 21 | utility telnet 5 22 | ext stdlib 1 23 | setproctitle stdlib 1 24 | sys_term termios 4 25 | sys_term stdlib 12 26 | state syslog 1 27 | sys_term stdio 4 28 | sys_term socket 1 29 | ext telnetd 5 30 | sys_term stat 1 31 | sys_term ioctl 2 32 | telnetd stdio 4 33 | ext getopt 2 34 | sys_term signal 1 35 | utility stdio 10 36 | state stdio 5 37 | state string 1 38 | telnetd ioctl 1 39 | telnetd setproctitle 2 40 | sys_term utility 4 41 | telnetd utility 18 42 | termstat state 4 43 | sys_term syslog 2 44 | telnetd stdlib 5 45 | unistd string 1 46 | unistd setproctitle 2 47 | state utility 18 48 | sys_term ext 13 49 | sys_term utmp 2 50 | ext sys_term 1 51 | ext unistd 2 52 | setproctitle unistd 1 53 | state sys_term 16 54 | utility stdlib 2 55 | sys_term unistd 10 56 | telnetd socket 9 57 | telnetd sys_term 8 58 | sys_term telnetd 2 59 | telnetd netdb 6 60 | utility socket 2 61 | ext string 3 62 | setproctitle string 12 63 | termstat utility 1 64 | telnetd signal 1 65 | setproctitle telnetd 3 66 | state telnetd 5 67 | telnetd getopt 7 68 | sys_term string 3 69 | utility ext 56 70 | utility telnetd 8 71 | telnetd ext 50 72 | sys_term termstat 6 73 | utility sys_term 2 74 | state ext 52 75 | ext state 12 76 | utility ctype 2 77 | state ctype 3 78 | termstat ext 1 79 | utility utsname 1 80 | telnetd select 2 81 | telnetd syslog 3 82 | -------------------------------------------------------------------------------- /dot-examples/netkit-ftp.mdg: -------------------------------------------------------------------------------- 1 | ftp inet 2 2 | cmds domacro 2 3 | domacro string 4 4 | domacro cmds 1 5 | cmds main 7 6 | glob main 1 7 | main unistd 6 8 | ftp pwd 2 9 | ruserpass libio 4 10 | ftp main 6 11 | main ftp 2 12 | ftp stdlib 3 13 | main stdio 15 14 | stat ftp 4 15 | ftp setjmp 7 16 | stat cmds 2 17 | ruserpass stat 1 18 | ftp socket 15 19 | main string 10 20 | main cmds 6 21 | glob errno 1 22 | main domacro 3 23 | ruserpass unistd 1 24 | main cmdtab 6 25 | cmds stdlib 16 26 | ruserpass stdio 10 27 | ftp netdb 3 28 | ftp signal 14 29 | cmds setjmp 7 30 | main readline 2 31 | stat glob 5 32 | cmds ctype 4 33 | stat ruserpass 2 34 | cmds socket 1 35 | ruserpass string 13 36 | main glob 1 37 | main history 1 38 | domacro main 4 39 | cmds ftp_var 241 40 | stat dirent 1 41 | ftp ctype 1 42 | cmds wait 1 43 | main netdb 2 44 | ftp select 1 45 | ftp domacro 1 46 | cmds signal 13 47 | domacro ftp 2 48 | ruserpass ftp 4 49 | cmds errno 2 50 | glob string 17 51 | domacro stdio 2 52 | ftp unistd 27 53 | ruserpass ftp_var 7 54 | ftp errno 5 55 | main pwd 4 56 | main ftp_var 38 57 | glob dirent 6 58 | ftp string 26 59 | cmds unistd 11 60 | ftp_var cmds 22 61 | ruserpass ctype 1 62 | ftp_var stdio 2 63 | cmds in 2 64 | ftp_var ftp 12 65 | main stdlib 2 66 | cmds string 32 67 | glob cmds 8 68 | main setjmp 3 69 | ftp ftp_var 96 70 | stat stdio 1 71 | ftp cmds 63 72 | main socket 1 73 | ruserpass errno 1 74 | ftp libio 9 75 | glob pwd 2 76 | cmds stat 4 77 | cmds glob 8 78 | cmds ftp 47 79 | ruserpass stdlib 6 80 | domacro ctype 1 81 | cmds readline 2 82 | glob stat 3 83 | main signal 2 84 | ftp_var ruserpass 1 85 | domacro ftp_var 9 86 | cmds stdio 91 87 | ftp stat 3 88 | cmds time 2 89 | ftp in 4 90 | ftp_var main 4 91 | ftp ruserpass 1 92 | glob stdlib 8 93 | ftp_var unistd 1 94 | ftp stdio 96 95 | ftp time 2 96 | -------------------------------------------------------------------------------- /nbactions.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | run 5 | 6 | process-classes 7 | org.codehaus.mojo:exec-maven-plugin:1.2:exec 8 | 9 | 10 | runtime 11 | -classpath %classpath bunch.Bunch 12 | java 13 | 14 | 15 | 16 | debug 17 | 18 | process-classes 19 | org.codehaus.mojo:exec-maven-plugin:1.2:exec 20 | 21 | 22 | runtime 23 | -Xdebug -Xrunjdwp:transport=dt_socket,server=n,address=${jpda.address} -classpath %classpath bunch.Bunch 24 | true 25 | java 26 | 27 | 28 | 29 | profile 30 | 31 | process-classes 32 | org.codehaus.mojo:exec-maven-plugin:1.1.1:exec 33 | 34 | 35 | ${profiler.args} -classpath %classpath bunch.Bunch 36 | profile 37 | ${profiler.java} 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/main/java/bunch/util/MQCalculator.java: -------------------------------------------------------------------------------- 1 | package bunch.util; 2 | 3 | /** 4 | * Title: Bunch Clustering Tool 5 | * Description: 6 | * Copyright: Copyright (c) 2000 7 | * Company: Drexel University 8 | * @author Brian Mitchell 9 | * @version 1.0 10 | */ 11 | 12 | import java.io.*; 13 | import bunch.*; 14 | 15 | public class MQCalculator { 16 | 17 | public MQCalculator() { 18 | } 19 | 20 | public static double CalcMQ(String mdgFileName, String silFileName, String calculatorName) 21 | { 22 | try 23 | { 24 | String mdg = mdgFileName; 25 | String sil = silFileName; 26 | 27 | Parser p = new DependencyFileParser(); 28 | p.setInput(mdg); 29 | p.setDelims(" \t"); 30 | 31 | Graph g = (Graph)p.parse(); 32 | ObjectiveFunctionCalculatorFactory ofc = new ObjectiveFunctionCalculatorFactory(); 33 | ofc.setCurrentCalculator((String)calculatorName); 34 | g.setObjectiveFunctionCalculatorFactory(ofc); 35 | 36 | g.setObjectiveFunctionCalculator((String)calculatorName); 37 | 38 | ClusterFileParser cfp = new ClusterFileParser(); 39 | cfp.setInput(sil); 40 | cfp.setObject(g); 41 | cfp.parse(); 42 | g.calculateObjectiveFunctionValue(); 43 | 44 | //figure out the total number of edges 45 | long edgeCnt = 0; 46 | Node[] n = g.getNodes(); 47 | for(int i = 0; i < n.length; i++) 48 | { 49 | if (n[i].dependencies != null) 50 | edgeCnt += n[i].dependencies.length; 51 | } 52 | 53 | //set output values 54 | return g.getObjectiveFunctionValue(); 55 | //System.out.println("Objective function value = " + g.getObjectiveFunctionValue()); 56 | 57 | } 58 | catch(Exception calcExcept) 59 | { 60 | calcExcept.printStackTrace(); 61 | return -1.0; 62 | } 63 | } 64 | } -------------------------------------------------------------------------------- /dot-examples/tcsh.mdg: -------------------------------------------------------------------------------- 1 | ed tc 186 2 | sh stdlib 31 3 | tw stdlib 6 4 | glob ctype 1 5 | stat tw 7 6 | tc vms 1 7 | sh termios 1 8 | tw stat 3 9 | sh setjmp 16 10 | tw setjmp 4 11 | tc netdb 3 12 | tc stat 2 13 | tc glob 6 14 | tc unistd 16 15 | ed unistd 8 16 | ed tw 23 17 | gethost pwd 1 18 | tw nl_types 9 19 | ed termios 8 20 | glob errno 2 21 | sh signal 85 22 | tw tc 203 23 | tw signal 25 24 | tc gethost 1 25 | tc ctype 11 26 | tw ed 36 27 | tc time 12 28 | tc inet 2 29 | gethost sh 127 30 | ed ioctl 4 31 | tc string 34 32 | ed string 17 33 | stat glob 4 34 | gethost ctype 2 35 | tw ctype 19 36 | tc sh 836 37 | tc errno 4 38 | sh wait 2 39 | ed nl_types 17 40 | sh unistd 103 41 | tc fcntl 6 42 | tw unistd 8 43 | gethost stdlib 2 44 | sh nl_types 27 45 | glob string 2 46 | gethost errno 1 47 | tw errno 2 48 | gethost setjmp 1 49 | gethost tc 61 50 | gethost fcntl 2 51 | gethost time 1 52 | gethost ed 5 53 | tw fcntl 2 54 | sh string 36 55 | tw string 3 56 | sh locale 2 57 | tw grp 4 58 | sh resource 7 59 | glob dirent 4 60 | ed ctype 35 61 | gethost signal 5 62 | tc ed 209 63 | glob sh 8 64 | gethost nl_types 1 65 | tc nl_types 25 66 | gethost tw 1 67 | sh dirent 8 68 | tw dirent 33 69 | stat sh 29 70 | sh grp 3 71 | sh tc 1272 72 | sh ctype 35 73 | tc ma 1 74 | sh ed 60 75 | ed errno 3 76 | tc tw 137 77 | tw pwd 5 78 | tc mi 1 79 | tc stdlib 23 80 | ed sh 203 81 | ed stdlib 15 82 | gethost unistd 12 83 | sh stat 13 84 | sh glob 4 85 | tc setjmp 4 86 | ed setjmp 2 87 | sh errno 23 88 | glob tc 5 89 | sh tw 72 90 | sh pwd 4 91 | glob stat 2 92 | tc socket 1 93 | sh fcntl 18 94 | stat tc 5 95 | tc ioctl 1 96 | gethost stdio 10 97 | sh time 9 98 | gethost string 7 99 | gethost locale 1 100 | tc signal 33 101 | tc pwd 4 102 | ed signal 9 103 | glob stdlib 1 104 | tw sh 198 105 | gethost grp 1 106 | -------------------------------------------------------------------------------- /dot-examples/stunnel.mdg: -------------------------------------------------------------------------------- 1 | stunnel errno 4 2 | sthreads stunnel 2 3 | ssl ctype 1 4 | pty fcntl 2 5 | stunnel options 1 6 | ssl stdlib 2 7 | stunnel fcntl 3 8 | stunnel string 7 9 | client tcpd 4 10 | sthreads pthread 9 11 | stunnel ssl 2 12 | stunnel stat 2 13 | options in 3 14 | client stdlib 5 15 | client err 1 16 | client stunnel 13 17 | stunnel pty 1 18 | client ssl 33 19 | options inet 2 20 | pty stunnel 2 21 | stunnel client 17 22 | client socket 19 23 | options stunnel 5 24 | ssl stat 1 25 | stunnel inet 2 26 | client pty 1 27 | options netdb 4 28 | log sthreads 2 29 | client x509 4 30 | protocol log 12 31 | stat stunnel 3 32 | ssl time 1 33 | ssl rand 8 34 | pty unistd 3 35 | options stdlib 16 36 | log stdio 6 37 | ssl err 3 38 | client stdio 3 39 | options ctype 1 40 | ssl sthreads 2 41 | sthreads signal 2 42 | stat client 1 43 | options socket 3 44 | client select 4 45 | pty string 1 46 | stunnel stdio 2 47 | log syslog 3 48 | protocol select 1 49 | client unistd 20 50 | options errno 1 51 | options getopt 2 52 | client protocol 19 53 | stunnel sthreads 6 54 | ssl rsa 3 55 | sthreads sigthread 1 56 | stunnel stdlib 6 57 | pty client 3 58 | stunnel log 11 59 | stunnel grp 3 60 | client string 7 61 | sthreads unistd 2 62 | client netdb 2 63 | ssl x509 3 64 | stunnel socket 7 65 | log time 3 66 | client log 13 67 | stunnel wait 2 68 | protocol string 6 69 | pty stat 1 70 | ssl client 13 71 | sthreads crypto 2 72 | pty stropts 1 73 | stunnel signal 3 74 | client ctype 4 75 | ssl x509_vfy 1 76 | client options 6 77 | pty log 2 78 | log client 4 79 | stunnel pwd 2 80 | options log 3 81 | client in 11 82 | protocol client 13 83 | options string 16 84 | protocol stunnel 1 85 | ssl log 10 86 | stat ssl 2 87 | sthreads client 1 88 | client errno 6 89 | client sthreads 10 90 | stunnel unistd 13 91 | client fcntl 1 92 | stunnel in 2 93 | log stunnel 1 94 | client inet 3 95 | options stdio 10 96 | pty errno 1 97 | options client 11 98 | -------------------------------------------------------------------------------- /dot-examples/telnet2.mdg: -------------------------------------------------------------------------------- 1 | utility select 2 | telnetd state 3 | utility syslog 4 | telnetd unistd 5 | state termstat 6 | telnetd errno 7 | utility state 8 | utility errno 9 | telnetd fcntl 10 | state stdlib 11 | utility unistd 12 | telnetd string 13 | sys_term pty 14 | unistd stdlib 15 | termstat ioctl 16 | utility string 17 | termstat sys_term 18 | telnetd term 19 | setproctitle stdio 20 | ext utility 21 | utility telnet 22 | ext stdlib 23 | setproctitle stdlib 24 | sys_term termios 25 | sys_term stdlib 26 | state syslog 27 | sys_term stdio 28 | sys_term socket 29 | ext telnetd 30 | sys_term stat 31 | sys_term ioctl 32 | telnetd stdio 33 | ext getopt 34 | sys_term signal 35 | utility stdio 36 | state stdio 37 | state string 38 | telnetd ioctl 39 | telnetd setproctitle 40 | sys_term utility 41 | telnetd utility 42 | termstat state 43 | sys_term syslog 44 | telnetd stdlib 45 | unistd string 46 | unistd setproctitle 47 | state utility 48 | sys_term ext 49 | sys_term utmp 50 | ext sys_term 51 | ext unistd 52 | setproctitle unistd 53 | state sys_term 54 | utility stdlib 55 | sys_term unistd 56 | telnetd socket 57 | telnetd sys_term 58 | sys_term telnetd 59 | telnetd netdb 60 | utility socket 61 | ext string 62 | setproctitle string 63 | termstat utility 64 | telnetd signal 65 | setproctitle telnetd 66 | state telnetd 67 | telnetd getopt 68 | sys_term string 69 | utility ext 70 | utility telnetd 71 | telnetd ext 72 | sys_term termstat 73 | utility sys_term 74 | state ext 75 | ext state 76 | utility ctype 77 | state ctype 78 | termstat ext 79 | utility utsname 80 | telnetd select 81 | telnetd syslog 82 | -------------------------------------------------------------------------------- /src/main/java/bunch/GraphOutputFactory.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: GraphOutputFactory.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:51 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.2 2000/08/18 21:09:59 bsmitc 11 | * Removed text tree and tom sawyer from the output factory 12 | * 13 | * Revision 3.1 2000/07/28 14:26:19 bsmitc 14 | * Added support for the TXTTree Graph output option 15 | * 16 | * Revision 3.0 2000/07/26 22:46:10 bsmitc 17 | * *** empty log message *** 18 | * 19 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 20 | * Imported CVS Sources 21 | * 22 | * 23 | */ 24 | package bunch; 25 | 26 | /** 27 | * A factory for graph output generators 28 | * 29 | * @author Brian Mitchell 30 | * @version 1.0 31 | * @see bunch.GraphOutput 32 | * @see bunch.GenericFactory 33 | */ 34 | public 35 | class GraphOutputFactory 36 | extends GenericFactory 37 | { 38 | 39 | public String defaultOption = "Dotty"; 40 | /** 41 | * Class constructor, defines the objects that the factory will be able 42 | * to create 43 | */ 44 | public 45 | GraphOutputFactory() 46 | { 47 | super(); 48 | setFactoryType("GraphOutput"); 49 | addItem("Dotty", "bunch.DotGraphOutput"); 50 | addItem("Text", "bunch.TXTGraphOutput"); 51 | addItem("GXL","bunch.gxl.io.GXLGraphOutput"); 52 | //addItem("Tom Sawyer", "bunch.TSGraphOutput"); 53 | //addItem("Text Tree","bunch.TXTTreeGraphOutput"); 54 | } 55 | 56 | /** 57 | * Obtains the graph output generator corresponding to name passed as parameter. 58 | * Utility method that uses the #getItemInstance(java.lang.String) method 59 | * from GenericFactory and casts the object to a GraphOutput object. 60 | * 61 | * @param the name for the desired output generator 62 | * @return the graph output generator corresponding to the name 63 | */ 64 | public 65 | GraphOutput 66 | getOutput(String name) 67 | { 68 | return (GraphOutput)getItemInstance(name); 69 | } 70 | 71 | public String getDefaultMethod() 72 | { 73 | return this.defaultOption; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /src/main/java/bunch/NAHCConfiguration.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: NAHCConfiguration.java,v $ 4 | * Revision 3.1 2002/02/03 18:56:15 bsmitc 5 | * Updated documentation 6 | * 7 | * Revision 3.0 2002/02/03 18:41:53 bsmitc 8 | * Retag starting at 3.0 9 | * 10 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 11 | * CVS Import 12 | * 13 | * Revision 3.3 2000/08/19 00:44:39 bsmitc 14 | * Added support for configuring the amount of randomization performed when 15 | * the user adjusts the "slider" feature of NAHC. 16 | * 17 | * Revision 3.2 2000/08/15 02:52:18 bsmitc 18 | * Implemented adjustable NAHC feature. This feature allows the user to set 19 | * a minimum search threshold so that NAHC will not just take the first thing 20 | * that it finds. 21 | * 22 | * Revision 3.1 2000/08/13 18:40:06 bsmitc 23 | * Added support for SA framework 24 | * 25 | * 26 | */ 27 | 28 | /** 29 | * Title: Bunch Project

30 | * Description:

31 | * Copyright: Copyright (c) Brian Mitchell

32 | * Company: Drexel University - SERG

33 | * @author Brian Mitchell 34 | * @version 1.0 35 | */ 36 | package bunch; 37 | 38 | /** 39 | * A basic class to hold all of the configuration information for the NAHC 40 | * clustering algorithm. This class inherits all configuration information 41 | * from the basic hill climbing class. 42 | * 43 | * @author Brian Mitchell 44 | * 45 | */ 46 | public class NAHCConfiguration 47 | extends HillClimbingConfiguration{ 48 | 49 | SATechnique saTechnique = null; 50 | int minPctToConsider = 0; 51 | int randomizePct = 0; 52 | 53 | public NAHCConfiguration() { 54 | } 55 | 56 | public int getRandomizePct() 57 | { return randomizePct; } 58 | 59 | public void setRandomizePct(int pct) 60 | { randomizePct = pct; } 61 | 62 | public void setSATechnique(SATechnique t) 63 | { saTechnique = t; } 64 | 65 | public SATechnique getSATechnique() 66 | { return saTechnique; } 67 | 68 | public int getMinPctToConsider() 69 | { return minPctToConsider; } 70 | 71 | public void setMinPctToConsider(int pct) 72 | { minPctToConsider = pct; } 73 | } -------------------------------------------------------------------------------- /src/main/java/bunch/Population.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: Population.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:54 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.2 2000/11/26 15:48:14 bsmitc 11 | * Fixed various bugs 12 | * 13 | * Revision 3.1 2000/10/22 15:48:49 bsmitc 14 | * *** empty log message *** 15 | * 16 | * Revision 3.0 2000/07/26 22:46:11 bsmitc 17 | * *** empty log message *** 18 | * 19 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 20 | * Imported CVS Sources 21 | * 22 | * 23 | */ 24 | package bunch; 25 | 26 | import java.util.Vector; 27 | import java.util.Enumeration; 28 | 29 | public class Population { 30 | 31 | Vector pop = new Vector(); 32 | static Graph g = null; 33 | Cluster bestCluster = null; 34 | 35 | public Population(Graph graph) { 36 | g = graph.cloneGraph(); 37 | } 38 | 39 | public void shuffle() 40 | { 41 | for(int i = 0; i < pop.size(); i++) 42 | { 43 | Cluster c = (Cluster)pop.elementAt(i); 44 | g.setClusters(c.getClusterVector()); 45 | g.shuffleClusters(); 46 | c.setClusterVector(g.getClusters()); 47 | c.setConverged(false); 48 | } 49 | 50 | } 51 | 52 | public void genPopulation(int howMany) 53 | { 54 | pop.removeAllElements(); 55 | for(int i = 0; i < howMany; i++) 56 | { 57 | //UNCOMMENT THE BELOW LINE FOR ORIGIONAL FUNCTION 58 | //int [] clusterV = g.getRandomCluster(); 59 | 60 | //COMMENT THE BELOW LINE TO REMOVE THE EXPIREMENTAL FUNCTION 61 | int [] clusterV = g.genRandomClusterSize(); 62 | Cluster c = new Cluster(g,clusterV); 63 | pop.addElement(c); 64 | } 65 | } 66 | 67 | public int size() 68 | { 69 | return pop.size(); 70 | } 71 | 72 | public Cluster getCluster(int whichOne) 73 | { 74 | if ((whichOne >= 0) && (whichOne < size())) 75 | return (Cluster)pop.elementAt(whichOne); 76 | else 77 | return null; 78 | } 79 | 80 | public Enumeration elements() 81 | { 82 | return pop.elements(); 83 | } 84 | } -------------------------------------------------------------------------------- /src/main/java/bunch/IterationEvent.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: IterationEvent.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:52 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:10 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | import java.util.*; 21 | 22 | /** 23 | * Event type defined for the IterationListener objects. An IterationEvent 24 | * carries information of not only the object that originated the 25 | * event but also the iteration number for the algorithm the object is running 26 | * 27 | * @author Brian Mitchell 28 | * 29 | * @see bunch.IterationListener 30 | */ 31 | public 32 | class IterationEvent 33 | extends EventObject 34 | { 35 | int iteration_d, overallIteration_d, expNum; 36 | 37 | /** 38 | * This is a specific event type...nothing special is needed for processing 39 | * but we will call the parent class 40 | */ 41 | public 42 | IterationEvent(Object source) 43 | { 44 | super(source); 45 | } 46 | 47 | /** 48 | * Sets the current iteration number 49 | */ 50 | public 51 | void 52 | setIteration(int num) 53 | { 54 | iteration_d = num; 55 | } 56 | 57 | /** 58 | * Sets the current experiment number 59 | */ 60 | public 61 | void 62 | setExpNum(int num) 63 | { 64 | expNum = num; 65 | } 66 | 67 | /** 68 | * Gets the specific experiment number 69 | */ 70 | public 71 | int 72 | getExpNum() 73 | { 74 | return expNum; 75 | } 76 | 77 | /** 78 | * Gets the current iteration number 79 | */ 80 | public 81 | int 82 | getIteration() 83 | { 84 | return iteration_d; 85 | } 86 | 87 | /** 88 | * Sets the overall iteration progress 89 | */ 90 | public 91 | void 92 | setOverallIteration(int num) 93 | { 94 | overallIteration_d = num; 95 | } 96 | 97 | /** 98 | * Gets the overall iteration process 99 | */ 100 | public 101 | int 102 | getOverallIteration() 103 | { 104 | return overallIteration_d; 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java/bunch/SATechnique.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: SATechnique.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:55 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.3 2000/08/14 18:33:26 bsmitc 11 | * Fixed bug where the SA configuration information was not being saved 12 | * bewteen runs of Bunch 13 | * 14 | * Revision 3.2 2000/08/13 18:40:07 bsmitc 15 | * Added support for SA framework 16 | * 17 | * Revision 3.1 2000/08/12 22:58:26 bsmitc 18 | * Adding Simulated Annealing Support To Project 19 | * 20 | * 21 | */ 22 | 23 | /** 24 | * Title: Bunch Project

25 | * Description:

26 | * Copyright: Copyright (c) Brian Mitchell

27 | * Company: Drexel University - SERG

28 | * @author Brian Mitchell 29 | * @version 1.0 30 | */ 31 | package bunch; 32 | 33 | import java.util.*; 34 | 35 | public abstract class SATechnique { 36 | 37 | protected Hashtable SAargs = new Hashtable(); 38 | protected Random rndNum = new Random(); 39 | protected bunch.stats.StatsManager stats = bunch.stats.StatsManager.getInstance(); 40 | 41 | public SATechnique() { 42 | rndNum.setSeed(System.currentTimeMillis()); 43 | } 44 | 45 | public abstract boolean init(Hashtable h); 46 | 47 | public abstract String getConfigDialogName(); 48 | 49 | public abstract boolean configure(); 50 | 51 | public abstract boolean changeTemp(Hashtable h); 52 | 53 | public boolean configureUsingDialog(java.awt.Frame parent) 54 | { return false; } 55 | 56 | public boolean accept() 57 | { return false; } 58 | 59 | public boolean accept(Hashtable args) 60 | { return false; } 61 | 62 | public boolean accept(double dMQ) 63 | { return false; } 64 | 65 | public Hashtable getConfig() 66 | { return null; } 67 | 68 | public boolean setConfig(Hashtable h) 69 | { return false; } 70 | 71 | public double getNextRndNumber() 72 | { 73 | return rndNum.nextDouble(); 74 | } 75 | 76 | public void reset() 77 | {} 78 | 79 | public static String getDescription() 80 | { return ""; } 81 | 82 | public String getObjectDescription() 83 | { return this.getDescription(); } 84 | 85 | public abstract String getWellKnownName(); 86 | } -------------------------------------------------------------------------------- /dot-examples/cyrus-sasl.mdg: -------------------------------------------------------------------------------- 1 | dlopen client 3 2 | checkpw client 2 3 | saslutil time 6 4 | db_berkeley db 2 5 | config common 3 6 | db_gdbm saslint 2 7 | common string 21 8 | db_none common 1 9 | db_ndbm common 4 10 | checkpw pam_appl 5 11 | dlopen common 3 12 | db_gdbm gdbm 3 13 | checkpw common 9 14 | db_none db_ndbm 7 15 | saslutil checkpw 4 16 | db_berkeley server 1 17 | db_berkeley db_ndbm 12 18 | server config 2 19 | db_ndbm saslint 6 20 | common client 23 21 | common saslint 42 22 | checkpw saslint 8 23 | config stdlib 1 24 | db_ndbm db_berkeley 35 25 | client server 7 26 | config stdio 4 27 | saslutil common 2 28 | saslutil stdio 5 29 | db_ndbm stdlib 1 30 | db_ndbm ndbm 10 31 | config server 1 32 | saslint client 2 33 | md5 checkpw 7 34 | server string 16 35 | db_gdbm db_ndbm 2 36 | db_none db_gdbm 6 37 | checkpw pwd 2 38 | client saslint 15 39 | server saslint 23 40 | db_berkeley db_gdbm 10 41 | server db_none 2 42 | dlopen server 4 43 | saslutil stdlib 3 44 | config saslint 2 45 | common errno 1 46 | checkpw server 7 47 | server errno 1 48 | md5 in 4 49 | db_berkeley string 5 50 | db_ndbm assert 1 51 | saslint common 8 52 | checkpw assert 1 53 | common md5 16 54 | common stdlib 4 55 | server client 21 56 | common db_ndbm 8 57 | client string 7 58 | server dlopen 3 59 | db_ndbm gdbm 7 60 | config ctype 4 61 | common checkpw 20 62 | checkpw md5 3 63 | dlopen saslint 1 64 | saslutil assert 1 65 | saslutil saslint 3 66 | common server 36 67 | checkpw unistd 4 68 | config string 1 69 | common saslutil 10 70 | client ctype 1 71 | server common 31 72 | db_none saslint 1 73 | db_none db_berkeley 7 74 | db_ndbm string 10 75 | db_berkeley saslint 2 76 | common config 6 77 | client dlopen 3 78 | db_none stdio 1 79 | dlopen string 6 80 | checkpw string 10 81 | db_berkeley common 3 82 | saslutil unistd 2 83 | checkpw shadow 2 84 | common db_berkeley 5 85 | common syslog 1 86 | db_ndbm db_gdbm 40 87 | getsubopt string 1 88 | common db_gdbm 8 89 | dlopen dlfcn 7 90 | saslint server 2 91 | client checkpw 3 92 | server checkpw 2 93 | client common 21 94 | common unistd 1 95 | dlopen dirent 5 96 | common stdio 1 97 | db_gdbm string 3 98 | server stdio 1 99 | checkpw saslutil 4 100 | saslutil string 3 101 | -------------------------------------------------------------------------------- /dot-examples/crond.mdg: -------------------------------------------------------------------------------- 1 | job do_command 1 2 | misc crontab 7 3 | user database 5 4 | do_command stdio 10 5 | database misc 2 6 | popen string 3 7 | misc database 2 8 | cron crontab 3 9 | stat crontab 2 10 | misc entry 10 11 | database stat 2 12 | popen do_command 2 13 | job cron 4 14 | entry stdlib 6 15 | cron job 4 16 | user entry 3 17 | crontab stdlib 10 18 | misc stat 2 19 | crontab misc 17 20 | cron env 2 21 | env user 5 22 | crontab ctype 1 23 | crontab stat 2 24 | entry stdio 6 25 | do_command wait 2 26 | job stdlib 3 27 | misc do_command 6 28 | do_command stdlib 2 29 | misc time 4 30 | database stdlib 1 31 | entry misc 12 32 | env string 14 33 | stat misc 1 34 | popen stdio 6 35 | crontab time 3 36 | do_command cron 4 37 | misc env 7 38 | crontab signal 1 39 | crontab getopt 5 40 | user stdlib 3 41 | crontab errno 3 42 | crontab fcntl 2 43 | database fcntl 2 44 | misc stdlib 8 45 | do_command signal 1 46 | misc ctype 1 47 | env stdio 7 48 | env cron 4 49 | database user 4 50 | do_command ctype 4 51 | cron stdio 2 52 | database pwd 3 53 | do_command job 2 54 | cron misc 2 55 | env entry 5 56 | crontab unistd 20 57 | do_command env 4 58 | misc file 1 59 | do_command syslog 1 60 | crontab database 1 61 | misc errno 4 62 | misc getopt 1 63 | popen wait 2 64 | cron getopt 1 65 | popen stdlib 2 66 | misc fcntl 6 67 | entry ctype 1 68 | do_command unistd 16 69 | crontab libio 2 70 | database unistd 3 71 | do_command misc 6 72 | entry string 4 73 | crontab string 3 74 | crontab pwd 5 75 | entry user 4 76 | crontab locale 1 77 | cron time 8 78 | user cron 1 79 | env crontab 2 80 | entry pwd 2 81 | misc syslog 2 82 | crontab utime 1 83 | do_command string 2 84 | database string 3 85 | database cron 3 86 | crontab wait 2 87 | popen signal 3 88 | stat database 5 89 | cron unistd 4 90 | misc unistd 10 91 | env stdlib 8 92 | misc cron 11 93 | env misc 5 94 | crontab stdio 60 95 | database stdio 4 96 | user env 7 97 | user string 2 98 | crontab cron 27 99 | misc libio 2 100 | entry crontab 4 101 | database dirent 5 102 | crontab env 3 103 | misc string 8 104 | crontab entry 2 105 | do_command libio 3 106 | entry env 6 107 | entry cron 11 108 | popen unistd 9 109 | do_command popen 4 110 | misc stdio 31 111 | env do_command 1 112 | user stdio 5 113 | -------------------------------------------------------------------------------- /src/main/java/bunch/BunchServer/FindNeighbor.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: FindNeighbor.java,v $ 4 | * Revision 3.0 2002/02/03 18:42:06 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:18 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch.BunchServer; 19 | 20 | import bunch.*; 21 | 22 | public class FindNeighbor { 23 | 24 | public FindNeighbor() { 25 | } 26 | 27 | public 28 | Cluster 29 | clusterWorklist(Cluster c, Cluster maxC, int[] clustNames, boolean[] locks, int[] workList) 30 | { 31 | //c.force(); //set the cluster vector dirty 32 | double maxOF = c.getObjFnValue(); 33 | double originalMax = maxOF; 34 | 35 | //int[] clustNames = c.getClusterNames(); 36 | 37 | int[] clusters = c.getClusterVector(); 38 | 39 | int[] maxClust = maxC.getClusterVector(); 40 | //boolean[] locks = c.getLocks(); 41 | 42 | //SRC DEST 43 | //System.arraycopy(clusters, 0, maxClust, 0, clusters.length); 44 | 45 | for (int i=0; i maxOF) { 56 | maxC.copyFromCluster(c); 57 | //System.arraycopy(clusters, 0, maxClust, 0, clusters.length); 58 | maxOF = c.getObjFnValue(); 59 | } 60 | } 61 | } 62 | c.relocate(currNode,currClust); 63 | //clusters[currNode] = currClust; 64 | } 65 | 66 | //if (maxOF > originalMax) { 67 | // System.arraycopy(maxClust, 0, clusters, 0, clusters.length); 68 | //} 69 | //else { 70 | // //we didn't find a better max partition then it's a maximum 71 | // c.setConverged(true); 72 | //} 73 | //maxC.calcObjFn(); 74 | return maxC; 75 | } 76 | 77 | } -------------------------------------------------------------------------------- /src/main/java/bunch/GridBagConstraints2.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: GridBagConstraints2.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:51 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:10 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | /* 19 | * Copyright (c) 1997-1998 Borland International, Inc. All Rights Reserved. 20 | * 21 | * This SOURCE CODE FILE, which has been provided by Borland as part 22 | * of a Borland product for use ONLY by licensed users of the product, 23 | * includes CONFIDENTIAL and PROPRIETARY information of Borland. 24 | * 25 | * USE OF THIS SOFTWARE IS GOVERNED BY THE TERMS AND CONDITIONS 26 | * OF THE LICENSE STATEMENT AND LIMITED WARRANTY FURNISHED WITH 27 | * THE PRODUCT. 28 | * 29 | * IN PARTICULAR, YOU WILL INDEMNIFY AND HOLD BORLAND, ITS RELATED 30 | * COMPANIES AND ITS SUPPLIERS, HARMLESS FROM AND AGAINST ANY CLAIMS 31 | * OR LIABILITIES ARISING OUT OF THE USE, REPRODUCTION, OR DISTRIBUTION 32 | * OF YOUR PROGRAMS, INCLUDING ANY CLAIMS OR LIABILITIES ARISING OUT OF 33 | * OR RESULTING FROM THE USE, MODIFICATION, OR DISTRIBUTION OF PROGRAMS 34 | * OR FILES CREATED FROM, BASED ON, AND/OR DERIVED FROM THIS SOURCE 35 | * CODE FILE. 36 | */ 37 | //-------------------------------------------------------------------------------------------------- 38 | // Copyright (c) 1996-1998 Borland International, Inc. All Rights Reserved. 39 | //-------------------------------------------------------------------------------------------------- 40 | 41 | package bunch; //borland.jbcl.layout; 42 | 43 | import java.awt.*; 44 | 45 | public class GridBagConstraints2 extends GridBagConstraints implements java.io.Serializable 46 | { 47 | public GridBagConstraints2(int gridx, int gridy, int gridwidth, int gridheight, 48 | double weightx, double weighty, int anchor, int fill, 49 | Insets insets, int ipadx, int ipady) { 50 | this.gridx = gridx; 51 | this.gridy = gridy; 52 | this.gridwidth = gridwidth; 53 | this.gridheight = gridheight; 54 | this.fill = fill; 55 | this.ipadx = ipadx; 56 | this.ipady = ipady; 57 | this.insets = insets; 58 | this.anchor = anchor; 59 | this.weightx = weightx; 60 | this.weighty = weighty; 61 | } 62 | 63 | public String toString() { 64 | return ": " + gridx + "," + gridy+ "," + gridwidth + "," + gridheight; //NORES 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /dot-examples/dhcpd-2.mdg: -------------------------------------------------------------------------------- 1 | daemon main 2 2 | hostinfo if 3 3 | socket-if error-handler 5 4 | client arp 3 5 | hostinfo memory 3 6 | signal-handler if 2 7 | client main 4 8 | signal-handler error-handler 2 9 | hostinfo wait 1 10 | error-handler stdio 12 11 | arp time 2 12 | if hostinfo 1 13 | hostinfo in 2 14 | error-handler syslog 4 15 | main unistd 2 16 | client dhcp 69 17 | dhcp main 1 18 | stat hostinfo 2 19 | socket-if if 1 20 | hostinfo error-handler 7 21 | socket-if options 1 22 | signal-handler unistd 1 23 | if error-handler 8 24 | if ioctl 4 25 | main stdio 9 26 | client stdlib 14 27 | socket-if string 2 28 | main if 1 29 | socket-if arp 2 30 | socket-if in 9 31 | daemon stdlib 4 32 | dhcp stdlib 1 33 | main string 4 34 | client socket-if 19 35 | if stdlib 1 36 | memory stdlib 2 37 | client socket 6 38 | arp dhcp 1 39 | hostinfo stdlib 4 40 | daemon stdio 1 41 | memory hostinfo 2 42 | client hostinfo 6 43 | error-handler string 8 44 | if time 2 45 | if inet 3 46 | if socket 8 47 | socket-if client 29 48 | main stat 1 49 | daemon signal 1 50 | hostinfo stdio 4 51 | options dhcp 1 52 | main client 3 53 | client stdio 1 54 | if main 1 55 | socket-if time 2 56 | signal-handler client 2 57 | string error-handler 2 58 | arp socket 3 59 | if in 8 60 | client error-handler 16 61 | string if 1 62 | main time 1 63 | if dhcp 4 64 | string in 1 65 | string inet 1 66 | arp socket-if 2 67 | main daemon 2 68 | client unistd 11 69 | hostinfo stat 3 70 | swab byteorder 14 71 | socket-if dhcp 7 72 | string hostinfo 5 73 | daemon unistd 11 74 | main error-handler 3 75 | main dhcp 1 76 | if unistd 7 77 | hostinfo unistd 13 78 | daemon error-handler 6 79 | error-handler errno 4 80 | hostinfo inet 8 81 | string dhcp 2 82 | client string 16 83 | arp select 1 84 | if fcntl 2 85 | daemon string 1 86 | arp unistd 1 87 | if string 11 88 | client utsname 1 89 | hostinfo main 1 90 | main stdlib 6 91 | hostinfo string 16 92 | main signal-handler 1 93 | options socket-if 2 94 | signal-handler stdlib 1 95 | socket-if socket 13 96 | hostinfo dhcp 6 97 | client if 21 98 | error-handler stdlib 4 99 | daemon errno 1 100 | arp string 7 101 | daemon stat 1 102 | arp error-handler 2 103 | arp if 3 104 | daemon fcntl 4 105 | dhcp client 15 106 | client in 36 107 | error-handler options 1 108 | options string 6 109 | options error-handler 1 110 | if client 4 111 | hostinfo client 4 112 | dhcp in 4 113 | byteorder swab 24 114 | arp in 4 115 | signal-handler signal 2 116 | hostinfo errno 1 117 | memory error-handler 1 118 | client fcntl 2 119 | client time 7 120 | hostinfo fcntl 6 121 | client inet 3 122 | socket-if select 1 123 | -------------------------------------------------------------------------------- /src/main/java/bunch/HillClimbingConfiguration.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: HillClimbingConfiguration.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:52 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:10 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | /** 21 | * A subclass of Configuration with specific parameters used by the Hill Climbing 22 | * Algorithms. 23 | * 24 | * @author Brian Mitchell 25 | * 26 | * @see bunch.HillClimbingClusteringConfigurationDialog 27 | * @see bunch.GenericHillClimbingClusteringMethod 28 | */ 29 | public 30 | class HillClimbingConfiguration 31 | extends Configuration 32 | { 33 | double threshold_d=0.1; 34 | 35 | /** 36 | * Parameterless class constructor. 37 | */ 38 | public 39 | HillClimbingConfiguration() 40 | { 41 | } 42 | 43 | /** 44 | * Utility class constructor that receives a graph, and calls #init(bunch.Graph). 45 | * 46 | * @param g the graph used to set the default values 47 | * @see #init(bunch.Graph) 48 | */ 49 | public 50 | HillClimbingConfiguration(Graph g) 51 | { 52 | init(g); 53 | } 54 | 55 | /** 56 | * Initializes this HillClimbingConfiguration object with values appropriate 57 | * to the characteristics of the graph passed as parameter. 58 | * 59 | * @param g the graph that will be used to create the default values for the 60 | * configuration object 61 | */ 62 | public 63 | void 64 | init(Graph g) 65 | { 66 | int nodes = g.getNumberOfNodes(); 67 | super.init(g); 68 | } 69 | 70 | /** 71 | * Define the threshold that determines when no further improvement can be 72 | * expected. This threshold is a percentage of the total number of 73 | * generations the algorithm will run. If that percentage of generations 74 | * has elapsed without change in the best graph found, the algorithm is 75 | * considered finished. 76 | * 77 | * @param t the threshold percentage expressed as a real value 78 | * @see #getThreshold() 79 | */ 80 | public 81 | void 82 | setThreshold(double t) 83 | { 84 | threshold_d = t; 85 | } 86 | 87 | /** 88 | * Obtain the threshold that determines when no further improvement can be 89 | * expected by running the hill climbing algorithm 90 | * 91 | * @return the threshold percentage expressed as a real (double) value 92 | * @see #setThreshold(double) 93 | */ 94 | public 95 | double 96 | getThreshold() 97 | { 98 | return threshold_d; 99 | } 100 | } 101 | 102 | -------------------------------------------------------------------------------- /src/main/java/bunch/GATournamentMethod.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: GATournamentMethod.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:49 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:03 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:09 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | /** 21 | * A Genetic Algorithm that usues tournament selection, as described 22 | * in Golberg's book, plus elitism. 23 | * 24 | * @author Brian Mitchell 25 | */ 26 | public 27 | class GATournamentMethod 28 | extends GAMethod 29 | { 30 | protected int[] tempArray_d; 31 | 32 | public 33 | GATournamentMethod() 34 | { 35 | } 36 | 37 | public 38 | void 39 | init() 40 | { 41 | setIncrementCounter(1); 42 | setInitCounter(0); 43 | setMaxCounter(currentPopulation_d.length); 44 | tempArray_d = new int[currentPopulation_d[0].getClusters().length]; 45 | } 46 | 47 | /** 48 | * Selection, crossover and reproduction (including mutation) for tournament 49 | * selection. 50 | */ 51 | public 52 | void 53 | selectReproduceCrossAndMutate(int pos) 54 | { 55 | //selection 56 | Graph parent1 = currentPopulation_d[(int)((currentPopulation_d.length-1) * randomGenerator_d.nextFloat())]; 57 | Graph parent2 = currentPopulation_d[(int)((currentPopulation_d.length-1) * randomGenerator_d.nextFloat())]; 58 | 59 | int[] p1c = parent1.getClusters(); 60 | int[] p2c = parent2.getClusters(); 61 | 62 | if (parent1.getObjectiveFunctionValue() 63 | < parent2.getObjectiveFunctionValue()) { 64 | p1c = parent2.getClusters(); 65 | p2c = parent1.getClusters(); 66 | } 67 | 68 | int[] np1c = newPopulation_d[pos].getClusters(); 69 | 70 | System.arraycopy(p1c, 0, np1c, 0, p1c.length); 71 | 72 | //crossover 73 | if (randomGenerator_d.nextFloat() screenSize.height) 77 | frameSize.height = screenSize.height; 78 | if (frameSize.width > screenSize.width) 79 | frameSize.width = screenSize.width; 80 | frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); 81 | frame.setVisible(true); 82 | } 83 | 84 | //Main method 85 | public static void main(String[] args) { 86 | boolean startGuiMode = true; 87 | 88 | try { 89 | UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); 90 | } 91 | catch(Exception e) { 92 | } 93 | 94 | 95 | if(args.length == 0) 96 | startGuiMode = true; 97 | else 98 | startGuiMode = false; 99 | 100 | BunchServer theServer = new BunchServer(); 101 | theServer.setStartupParms(args,startGuiMode); 102 | theServer.start(); 103 | } 104 | } -------------------------------------------------------------------------------- /src/main/java/bunch/api/BunchNode.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: BunchNode.java,v $ 4 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 5 | * CVS Import 6 | * 7 | * Revision 3.4 2000/11/30 01:49:21 bsmitc 8 | * Added support for various tests and statistical gathering 9 | * 10 | * Revision 3.3 2000/11/26 20:39:26 bsmitc 11 | * Added support for precision and recall calculations by using the 12 | * BunchGraph API suite 13 | * 14 | * Revision 3.2 2000/11/26 15:48:30 bsmitc 15 | * Fixed various bugs 16 | * 17 | * Revision 3.1 2000/11/26 15:45:35 bsmitc 18 | * Initial Version - support for the BunchGraph api interface 19 | * 20 | * 21 | */ 22 | /** 23 | * Title: Bunch Project

24 | * Description:

25 | * Copyright: Copyright (c) Brian Mitchell

26 | * Company: Drexel University - SERG

27 | * @author Brian Mitchell 28 | * @version 1.0 29 | */ 30 | package bunch.api; 31 | 32 | import java.util.*; 33 | 34 | public class BunchNode { 35 | 36 | static public final int NOT_A_MEMBER_OF_A_CLUSTER = -1; 37 | 38 | String nodeName = ""; 39 | int nodeIndex = -1; 40 | int nodeCluster = -1; 41 | BunchCluster memberCluster = null; 42 | boolean isNodeCluster = false; 43 | ArrayList deps = null; 44 | ArrayList backDeps = null; 45 | HashMap clusterMemberships = null; 46 | 47 | //public BunchNode() 48 | //{ 49 | // BunchNode("",-1,-1); 50 | //} 51 | 52 | public BunchNode(String name, int index, int cluster, boolean isCluster) 53 | { 54 | nodeName = name; 55 | nodeIndex = index; 56 | nodeCluster = cluster; 57 | isNodeCluster = isCluster; 58 | clusterMemberships = new HashMap(); 59 | } 60 | 61 | public void subscribeToCluster(BunchCluster bc) 62 | { 63 | if(bc != null) 64 | clusterMemberships.put(bc.getName(),bc); 65 | } 66 | 67 | public boolean isAMemberOfCluster(String name) 68 | { return clusterMemberships.containsKey(name); } 69 | 70 | public boolean isAMemberOfCluster(BunchCluster bc) 71 | { return isAMemberOfCluster(bc.getName()); } 72 | 73 | public int memberOfHowManyClusters() 74 | { return clusterMemberships.size(); } 75 | public void setDeps(ArrayList deps, ArrayList backDeps) 76 | { 77 | this.deps = deps; 78 | this.backDeps = backDeps; 79 | } 80 | 81 | public String getName() 82 | { return nodeName; } 83 | 84 | public int getCluster() 85 | { return nodeCluster; } 86 | 87 | public void resetCluster(int newClustNumber) 88 | { nodeCluster = newClustNumber; } 89 | 90 | public Collection getDeps() 91 | { return deps; } 92 | 93 | public Collection getBackDeps() 94 | { return backDeps; } 95 | 96 | public boolean isCluster() 97 | { return isNodeCluster; } 98 | 99 | public BunchCluster getMemberCluster() 100 | { return memberCluster; } 101 | 102 | public void setMemberCluster(BunchCluster bc) 103 | { 104 | memberCluster = bc; 105 | subscribeToCluster(bc); 106 | } 107 | } -------------------------------------------------------------------------------- /src/main/java/bunch/ClusteringMethodFactory.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: ClusteringMethodFactory.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:46 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:03 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.2 2000/11/26 15:48:12 bsmitc 11 | * Fixed various bugs 12 | * 13 | * Revision 3.1 2000/10/22 17:47:02 bsmitc 14 | * Collapsed NAHC and SAHC into a generic hill climbing method 15 | * 16 | * Revision 3.0 2000/07/26 22:46:08 bsmitc 17 | * *** empty log message *** 18 | * 19 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 20 | * Imported CVS Sources 21 | * 22 | * 23 | */ 24 | package bunch; 25 | 26 | import java.util.*; 27 | 28 | /** 29 | * A factory for different kinds of objects that calculate the 30 | * optimum clustering for a graph 31 | * 32 | * @author Brian Mitchell 33 | * 34 | * @see bunch.ClusteringMethod 35 | * @see bunch.GenericFactory 36 | */ 37 | public 38 | class ClusteringMethodFactory 39 | extends GenericFactory 40 | { 41 | 42 | String defaultMethod = "Hill Climbing"; 43 | 44 | /** 45 | * Class constructor, defines the objects that the factory will be able 46 | * to create 47 | */ 48 | public 49 | ClusteringMethodFactory() 50 | { 51 | super(); 52 | setFactoryType("ClusteringMethod"); 53 | addItem("Hill Climbing", "bunch.GeneralHillClimbingClusteringMethod"); 54 | addItem("NAHC", "bunch.NextAscentHillClimbingClusteringMethod"); 55 | addItem("SAHC", "bunch.SteepestAscentHillClimbingClusteringMethod"); 56 | addItem("GA", "bunch.GAClusteringMethod"); 57 | addItem("Exhaustive", "bunch.OptimalClusteringMethod"); 58 | } 59 | 60 | /** 61 | * This method returns the default clustering method. It is used in the GUI and 62 | * API when the clustering algorithm is not explicitly specified. 63 | */ 64 | public String getDefaultMethod() 65 | { 66 | return defaultMethod; 67 | } 68 | 69 | /** 70 | * This method returns a list of items in the factory. 71 | * 72 | * @return A string array containing the keys in the factory. 73 | */ 74 | public String[] getItemList() 75 | { 76 | String[] masterList = super.getItemList(); 77 | String[] resList = new String[masterList.length-2]; 78 | 79 | int resPos = 0; 80 | for(int i = 0; i < masterList.length; i++) 81 | { 82 | String item = masterList[i]; 83 | if ((item.equals("SAHC")) || (item.equals("NAHC"))) 84 | continue; 85 | else 86 | resList[resPos++] = item; 87 | } 88 | 89 | return resList; 90 | } 91 | 92 | /** 93 | * Obtains the clustering method corresponding to name passed as parameter. 94 | * Utility method that uses the #getItemInstance(java.lang.String) method 95 | * from GenericFactory and casts the object to a ClusteringMethod object. 96 | * 97 | * @param the name for the desired method 98 | * @return the clustering method corresponding to the name 99 | */ 100 | public 101 | ClusteringMethod 102 | getMethod(String name) 103 | { 104 | return (ClusteringMethod)getItemInstance(name); 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /src/main/java/bunch/SteepestAscentHillClimbingClusteringMethod2.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: SteepestAscentHillClimbingClusteringMethod2.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:56 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:11 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | import java.util.*; 21 | import javax.swing.*; 22 | 23 | public 24 | class SteepestAscentHillClimbingClusteringMethod2 25 | extends GenericDistribHillClimbingClusteringMethod 26 | { 27 | 28 | public 29 | SteepestAscentHillClimbingClusteringMethod2() 30 | { 31 | } 32 | 33 | protected 34 | Cluster 35 | getLocalMaxGraph(Cluster c) 36 | { 37 | System.out.print("IN: " + c.getObjFnValue() + " "); 38 | double maxOF = c.getObjFnValue(); 39 | double originalMax = maxOF; 40 | 41 | int[] clustNames = c.getClusterNames(); 42 | 43 | int[] clusters = c.getClusterVector(); 44 | 45 | int[] maxClust = new int[clusters.length]; 46 | boolean[] locks = c.getLocks(); 47 | 48 | //SRC DEST 49 | System.arraycopy(clusters, 0, maxClust, 0, clusters.length); 50 | 51 | for (int i=0; i maxOF) { 59 | System.arraycopy(clusters, 0, maxClust, 0, clusters.length); 60 | maxOF = c.getObjFnValue(); 61 | } 62 | } 63 | } 64 | clusters[i] = currClust; 65 | } 66 | 67 | if (maxOF > originalMax) { 68 | System.arraycopy(maxClust, 0, clusters, 0, clusters.length); 69 | } 70 | else { 71 | //we didn't find a better max partition then it's a maximum 72 | c.setConverged(true); 73 | } 74 | c.calcObjFn(); 75 | 76 | System.out.println("OUT: " + c.getObjFnValue() + " "); 77 | 78 | return c; 79 | } 80 | 81 | public 82 | Configuration 83 | getConfiguration() 84 | { 85 | boolean reconf=false; 86 | if (configuration_d == null) { 87 | reconf = true; 88 | } 89 | 90 | HillClimbingConfiguration hc = (HillClimbingConfiguration)super.getConfiguration(); 91 | 92 | if (reconf) { 93 | hc.setThreshold(0.1); 94 | hc.setNumOfIterations(100); 95 | hc.setPopulationSize(5); 96 | } 97 | return hc; 98 | } 99 | 100 | public void 101 | setDefaultConfiguration() 102 | { 103 | HillClimbingConfiguration hc = (HillClimbingConfiguration)super.getConfiguration(); 104 | 105 | hc.setThreshold(0.1); 106 | hc.setNumOfIterations(100); 107 | hc.setPopulationSize(5); 108 | 109 | setConfiguration(hc); 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /src/main/java/bunch/BunchServer/BSTextServer.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: BSTextServer.java,v $ 4 | * Revision 3.0 2002/02/03 18:42:05 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:18 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | 19 | /** 20 | * Title: Bunch Version 1.2 Base

21 | * Description: Your description

22 | * Copyright: Copyright (c) 1999

23 | * Company:

24 | * @author Brian Mitchell 25 | * @version 26 | */ 27 | package bunch.BunchServer; 28 | 29 | import java.rmi.RemoteException; 30 | import javax.rmi.PortableRemoteObject; 31 | import java.util.Properties; 32 | import javax.naming.*; 33 | import java.rmi.RMISecurityManager; 34 | 35 | public class BSTextServer { 36 | 37 | String nameSpace = ""; 38 | String server = ""; 39 | String nameSvr = ""; 40 | String port = ""; 41 | BunchSvrMsgImpl bunchMsg = null; 42 | InitialContext corbaContext = null; 43 | String jndiName = ""; 44 | 45 | 46 | public BSTextServer(String [] args) throws Exception { 47 | if (args.length != 4) 48 | throw(new Exception("Invalid Parameter(s), can not start text server!")); 49 | 50 | nameSpace = args[0]; 51 | server = args[1]; 52 | nameSvr = args[2]; 53 | port = args[3]; 54 | } 55 | 56 | public String getJndiName() 57 | { 58 | return jndiName; 59 | } 60 | 61 | public boolean start() 62 | { 63 | 64 | try 65 | { 66 | Properties env = new Properties (); 67 | 68 | env.put("java.naming.factory.initial","com.sun.jndi.cosnaming.CNCtxFactory"); 69 | 70 | String nsURL = "iiop://"+nameSvr+":"+port; 71 | System.out.println("Name Server URL: "+nsURL); 72 | 73 | String cnStr = "/"+nameSpace+"/"+server; 74 | jndiName = cnStr; 75 | System.out.println("Object Registration Name: " + cnStr); 76 | 77 | env.put("java.naming.provider.url",nsURL); 78 | 79 | InitialContext context = new InitialContext (env); 80 | 81 | //----------------------------------------------------- 82 | //See if this is the first time binding to a namespace 83 | //----------------------------------------------------- 84 | try{ 85 | context.createSubcontext(nameSpace); 86 | }catch(Exception e1) 87 | {} 88 | 89 | CompositeName cn = new CompositeName(cnStr); 90 | 91 | bunchMsg = new BunchSvrMsgImpl(); 92 | bunchMsg.setParent(null); 93 | bunchMsg.setJndiName(jndiName); 94 | bunchMsg.setTextMode(); 95 | 96 | context.rebind (cn, bunchMsg); 97 | 98 | corbaContext = context; 99 | 100 | System.out.println("SERVER Started OK!"); 101 | 102 | return true; 103 | } 104 | catch (Exception ex) 105 | { 106 | String excp = ex.toString(); 107 | System.out.println("Server exception: "+excp); 108 | return false; 109 | } 110 | } 111 | } -------------------------------------------------------------------------------- /src/main/java/bunch/ObjectiveFunctionCalculatorFactory.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: ObjectiveFunctionCalculatorFactory.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:54 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.1 2000/08/11 22:04:23 bsmitc 11 | * Commented out unwanted objective function calculators from the factory 12 | * 13 | * Revision 3.0 2000/07/26 22:46:10 bsmitc 14 | * *** empty log message *** 15 | * 16 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 17 | * Imported CVS Sources 18 | * 19 | * 20 | */ 21 | package bunch; 22 | 23 | /** 24 | * A factory for different kinds of objective function calculator objects 25 | * 26 | * @author Diego Doval 27 | * @version 1.0 28 | * @see bunch.ObjectiveFunctionCalculator 29 | * @see bunch.GenericFactory 30 | */ 31 | public 32 | class ObjectiveFunctionCalculatorFactory 33 | extends GenericFactory 34 | { 35 | String currObjFnMethod = "Incremental MQ Weighted"; 36 | String defaultMethod = "Incremental MQ Weighted"; 37 | 38 | /** 39 | * Class constructor, defines the objects that the factory will be able 40 | * to create 41 | */ 42 | public 43 | ObjectiveFunctionCalculatorFactory() 44 | { 45 | super(); 46 | setFactoryType("ObjectiveFunctionCalculator"); 47 | addItem("Basic MQ Function", "bunch.BasicMQ"); 48 | addItem("Turbo MQ Function", "bunch.TurboMQ"); 49 | //addItem("Incremental MQ", "bunch.TurboMQIncr"); 50 | addItem("Incremental MQ Weighted", "bunch.TurboMQIncrW"); 51 | 52 | addItem("bunch.BasicMQ", "bunch.BasicMQ"); 53 | addItem("bunch.TurboMQ", "bunch.TurboMQ"); 54 | addItem("bunch.ITurboMQ", "bunch.TurboMQIncrW"); 55 | addItem("bunch.TurboMQIncrW", "bunch.TurboMQIncrW"); 56 | 57 | //addItem("Turbo MQ Squared", "bunch.TurboMQ2"); 58 | //addItem("Experimental Weighted 2", "bunch.WeightedObjectiveFunctionCalculator2"); 59 | //addItem("Experimental Weighted 3", "bunch.WeightedObjectiveFunctionCalculator3"); 60 | //addItem("Spiros MQ", "bunch.SpirosMQ"); 61 | } 62 | 63 | /** 64 | * Obtains the OF Calculator corresponding to name passed as parameter. 65 | * Utility method that uses the #getItemInstance(java.lang.String) method 66 | * from GenericFactory and casts the object to a ObjectiveFunctionCalculator object. 67 | * 68 | * @param the name for the desired method 69 | * @return the OF Calculator corresponding to the name 70 | */ 71 | public 72 | ObjectiveFunctionCalculator 73 | getCalculator(String name) 74 | { 75 | return (ObjectiveFunctionCalculator)getItemInstance(name); 76 | } 77 | 78 | public 79 | ObjectiveFunctionCalculator 80 | getSelectedCalculator() 81 | { 82 | return (ObjectiveFunctionCalculator)getItemInstance(currObjFnMethod); 83 | } 84 | 85 | /** 86 | * This method returns the default clustering method. It is used in the GUI and 87 | * API when the clustering algorithm is not explicitly specified. 88 | */ 89 | public String getDefaultMethod() 90 | { 91 | return defaultMethod; 92 | } 93 | 94 | public 95 | String 96 | getCurrentCalculator() 97 | { 98 | return currObjFnMethod; 99 | } 100 | 101 | public 102 | void 103 | setCurrentCalculator(String sCalc) 104 | { 105 | currObjFnMethod = sCalc; 106 | } 107 | 108 | } -------------------------------------------------------------------------------- /src/main/java/bunch/BunchEvent.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: BunchEvent.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:44 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:03 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:07 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:33 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | 21 | /** 22 | * This class encapsulates BunchEvents which are used for asynchronous 23 | * interaction between the BunchComponents. Each Event has a unique event 24 | * id 25 | * 26 | * @author Brian Mitchell 27 | */ 28 | public class BunchEvent { 29 | 30 | public BunchEvent() { 31 | } 32 | public static final int EVENT_GOTWORK = 1; 33 | public static final int EVENT_SERVERDONE = 2; 34 | 35 | public static final int EVENT_STATE_NOT_INIT = -1; 36 | public static final int EVENT_STATE_SUBMITTED = 1; 37 | public static final int EVENT_STATE_PENDING = 2; 38 | public static final int EVENT_STATE_PROCESSED = 3; 39 | 40 | private int theEvent; 41 | private Object eventObj = null; 42 | private Object notifyObj = null; 43 | private Thread submitterThread = null; 44 | private int eventState = EVENT_STATE_NOT_INIT; 45 | 46 | /** 47 | * Set the event state 48 | * 49 | * @param The event state based on one of the constants 50 | */ 51 | public void setEventState(int state) 52 | { eventState = state; } 53 | 54 | /** 55 | * Get the event state 56 | */ 57 | public int getEventState() 58 | { return eventState; } 59 | 60 | /** 61 | * Set the event object. This object implements the functionality of the 62 | * actual bunch event 63 | */ 64 | public void setEventObj(Object eo) 65 | { eventObj = eo; } 66 | 67 | /** 68 | * Set the object that is to be notified when an event arrives 69 | */ 70 | public void setNotifyObj(Object no) 71 | { notifyObj = no; } 72 | 73 | /** 74 | * Get the notifiy object instance 75 | */ 76 | public Object getNotifyObj() 77 | { return notifyObj; } 78 | 79 | /** 80 | * Get the thread of the submitter. This way we can suspend it to 81 | * simulate synchronous operations. 82 | */ 83 | public Thread getSubmitterThread() 84 | { return submitterThread; } 85 | 86 | /** 87 | * Set the submitter thread. This way we can suspend it to simulate 88 | * synchronous operations. 89 | */ 90 | public void setSubmitterThread(Thread st) 91 | { submitterThread = st; } 92 | 93 | /** 94 | * Get the event object instance 95 | */ 96 | public Object getEventObj() 97 | { return eventObj; } 98 | 99 | /** 100 | * Set the ID of the event. The event ID must be unique. 101 | */ 102 | public void setEventID(int e) 103 | { theEvent = e; } 104 | 105 | /** 106 | * Get the ID of the event 107 | */ 108 | public int getEventID() 109 | { return theEvent; } 110 | 111 | /** 112 | * Set the event. 113 | * 114 | * @param e The Event ID 115 | * @param eo The Event Object 116 | */ 117 | public void setEvent(int e, Object eo) 118 | { 119 | theEvent = e; 120 | eventObj = eo; 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /src/main/java/bunch/SynchronizedEventQueue.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: SynchronizedEventQueue.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:56 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:11 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | import java.util.*; 21 | 22 | public class SynchronizedEventQueue { 23 | 24 | Thread managerThread = null; 25 | ArrayList workQueue = null; 26 | 27 | public SynchronizedEventQueue() { 28 | workQueue = new ArrayList(); 29 | } 30 | 31 | public SynchronizedEventQueue(Thread mgr) { 32 | workQueue = new ArrayList(); 33 | managerThread = mgr; 34 | } 35 | 36 | 37 | public void setManagerThread(Thread t) 38 | { managerThread = t; } 39 | 40 | public Thread getManagerThread() 41 | { return managerThread; } 42 | 43 | public BunchEvent getEvent() 44 | { 45 | try{ 46 | //synchronized(managerThread){ 47 | synchronized(managerThread){ 48 | while(workQueue.size()==0) 49 | { 50 | managerThread.wait(); 51 | } 52 | } 53 | synchronized(this) 54 | { 55 | BunchEvent be = (BunchEvent)workQueue.get(0); 56 | be.setEventState(BunchEvent.EVENT_STATE_PENDING); 57 | workQueue.remove(0); 58 | return be; 59 | } 60 | }catch(Exception ex){ 61 | System.out.println("SEM EXCEPTION - getEvent(): " + ex.toString()); 62 | return null; 63 | } 64 | } 65 | 66 | public void releaseEvent(BunchEvent be) 67 | { 68 | try{ 69 | synchronized(be.getSubmitterThread()){ 70 | be.setEventState(BunchEvent.EVENT_STATE_PROCESSED); 71 | be.getSubmitterThread().notify(); 72 | } 73 | }catch(Exception ex){ 74 | System.out.println("SEM EXCEPTION: - releaseEvent()" + ex.toString()); 75 | } 76 | } 77 | 78 | 79 | public BunchEvent putAndWait(BunchEvent be) 80 | { 81 | try{ 82 | synchronized(this){ 83 | be.setEventState(BunchEvent.EVENT_STATE_SUBMITTED); 84 | workQueue.add(be); 85 | } 86 | 87 | synchronized(managerThread){ 88 | managerThread.notify(); 89 | } 90 | 91 | synchronized(be.getSubmitterThread()){ 92 | while(be.getEventState() != BunchEvent.EVENT_STATE_PROCESSED) 93 | be.getSubmitterThread().wait(); 94 | 95 | return be; 96 | } 97 | }catch(Exception ex){ 98 | System.out.println("SEM EXCEPTION - putAndWait(): " + ex.toString()); 99 | return null; 100 | } 101 | 102 | } 103 | 104 | private void DEBUGDump(String caller, Thread callerThread, Thread mgrThr) 105 | { 106 | System.out.println("Debug dump of threads from - " + caller); 107 | System.out.println(" CurrentThread("+Thread.currentThread().getName()+ 108 | ") CallerThread("+callerThread.getName() + 109 | ") ManagerThread("+mgrThr.getName()+")"); 110 | System.out.flush(); 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /src/main/java/bunch/Parser.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: Parser.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:54 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.1 2000/11/30 03:07:57 bsmitc 11 | * Updated parser for statistics 12 | * 13 | * Revision 3.0 2000/07/26 22:46:10 bsmitc 14 | * *** empty log message *** 15 | * 16 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 17 | * Imported CVS Sources 18 | * 19 | * 20 | */ 21 | package bunch; 22 | 23 | import java.io.*; 24 | 25 | /** 26 | * A generic parser interface used by all of Bunch's parsers, Parser is 27 | * an abstract class that requires implementation of the parse() method 28 | * in its subclasses. 29 | * 30 | * @author Diego Doval 31 | * @version 1.0 32 | * @see bunch.ParserFactory 33 | */ 34 | public abstract 35 | class Parser 36 | { 37 | protected BufferedReader reader_d; 38 | protected String delims_d = " \t\r\n"; 39 | protected String inputFileName; 40 | 41 | 42 | /** 43 | * Empty parser constructor 44 | */ 45 | public 46 | Parser() 47 | { 48 | } 49 | 50 | public void setDelims(String d) 51 | { 52 | delims_d = d; 53 | } 54 | 55 | public String getDelims() 56 | { 57 | return delims_d; 58 | } 59 | 60 | public boolean hasReflexiveEdges() 61 | { 62 | //implement functionality in specific parser, default behavior is false 63 | return false; 64 | } 65 | 66 | public int getReflexiveEdges() 67 | { 68 | //implement functionality in specific parser, default behavior is to return 0 69 | return 0; 70 | } 71 | 72 | /** 73 | * Sets the stream provided as the input for this Parser 74 | * 75 | * @param is the InputStream that will be used as input 76 | */ 77 | public 78 | void 79 | setInput(InputStream is) 80 | { 81 | reader_d = new BufferedReader(new InputStreamReader(is)); 82 | } 83 | 84 | /** 85 | * Sets the file of name provided as the input for this Parser 86 | * 87 | * @param fileName the name of the file that will be used as input 88 | */ 89 | public 90 | void 91 | setInput(String fileName) 92 | { 93 | try { 94 | reader_d = new BufferedReader(new FileReader(fileName)); 95 | inputFileName = fileName; 96 | } 97 | catch (Exception e) { 98 | e.printStackTrace(); 99 | System.exit(1); 100 | } 101 | } 102 | 103 | public String getInputFileName() 104 | { 105 | return inputFileName; 106 | } 107 | 108 | /** 109 | * Sets the object used for internal processing, if any. 110 | * 111 | * @param obj the object to be used for internal processing 112 | */ 113 | public 114 | void 115 | setObject(Object obj) 116 | { 117 | } 118 | 119 | /** 120 | * Obtains the object used for internal processing, if any. 121 | * 122 | * @return the object used for internal processing 123 | */ 124 | public 125 | Object 126 | getObject() 127 | { 128 | return null; 129 | } 130 | 131 | /** 132 | * Obtains the reader class that from where the input to be parsed is obtained 133 | * 134 | * @return the reader class 135 | */ 136 | public 137 | BufferedReader 138 | getReader() 139 | { 140 | return reader_d; 141 | } 142 | 143 | /** 144 | * The abstract method to be implemented by all Parser subclasses 145 | * 146 | * @return the object resultant of the parsing, usually a Graph 147 | */ 148 | public abstract 149 | Object 150 | parse(); 151 | } -------------------------------------------------------------------------------- /dot-examples/micq.mdg: -------------------------------------------------------------------------------- 1 | ui micq 145 2 | file_util ctype 1 3 | icq_response micq 23 4 | util_ui ioctl 1 5 | micq ui 2 6 | micq stdlib 17 7 | server micq 32 8 | ui ctype 1 9 | mreadline micq 6 10 | network util_ui 1 11 | micq socket 15 12 | icq_response mreadline 2 13 | file_util errno 1 14 | micq mselect 5 15 | util util_ui 7 16 | icq_response stdlib 4 17 | jp_conv string 3 18 | file_util fcntl 8 19 | micq server 3 20 | network util 2 21 | util_ui termios 4 22 | file_util util 5 23 | char_conv icq_response 8 24 | util micq 42 25 | server unistd 2 26 | util_ui icq_response 1 27 | ui util 36 28 | icq_response server 26 29 | icq_response util 68 30 | rus_conv string 1 31 | stat util 2 32 | mreadline stdlib 4 33 | server util 15 34 | msg_queue mreadline 2 35 | server string 3 36 | ui util_ui 28 37 | micq unistd 1 38 | icq_response char_conv 5 39 | sendmsg util_ui 5 40 | micq time 7 41 | util_ui stdlib 9 42 | string util 4 43 | micq netdb 4 44 | util stdlib 9 45 | msg_queue util_ui 3 46 | network assert 1 47 | sendmsg assert 2 48 | server msg_queue 1 49 | util_ui micq 14 50 | micq string 15 51 | sendmsg micq 101 52 | sendmsg ui 53 53 | file_util stdio 7 54 | util server 11 55 | micq util_ui 13 56 | util_ui file_util 6 57 | mreadline ui 1 58 | icq_response string 6 59 | ui stdio 1 60 | util in 1 61 | rus_conv stdio 2 62 | file_util sendmsg 1 63 | mreadline unistd 1 64 | icq_response util_ui 19 65 | char_conv sendmsg 4 66 | util_ui unistd 4 67 | micq file_util 5 68 | util unistd 1 69 | util ctype 1 70 | micq icq_response 8 71 | util_ui util 1 72 | mreadline string 7 73 | file_util stdlib 9 74 | micq msg_queue 1 75 | sendmsg util 96 76 | msg_queue assert 3 77 | server mreadline 2 78 | micq network 2 79 | micq in 14 80 | ui file_util 3 81 | util_ui string 13 82 | mreadline stdio 6 83 | util_ui stdio 8 84 | util string 15 85 | jp_conv micq 1 86 | server sendmsg 6 87 | util errno 1 88 | char_conv assert 1 89 | char_conv micq 2 90 | server ui 1 91 | sendmsg file_util 1 92 | msg_queue micq 3 93 | util_ui mreadline 3 94 | sendmsg msg_queue 9 95 | char_conv rus_conv 1 96 | micq stdio 4 97 | util icq_response 61 98 | ui stdlib 19 99 | file_util time 3 100 | micq mreadline 6 101 | file_util unistd 3 102 | mreadline util_ui 3 103 | network mreadline 2 104 | ui time 6 105 | mselect select 1 106 | mselect micq 2 107 | icq_response time 3 108 | jp_conv char_conv 2 109 | sendmsg stdlib 18 110 | msg_queue util 6 111 | util sendmsg 138 112 | ui mreadline 7 113 | file_util string 21 114 | util_ui ui 2 115 | sendmsg mreadline 4 116 | util stdio 11 117 | util stat 3 118 | micq inet 5 119 | sendmsg in 4 120 | sendmsg server 8 121 | micq util 14 122 | icq_response in 1 123 | util time 5 124 | icq_response stdio 1 125 | server icq_response 11 126 | char_conv jp_conv 1 127 | file_util util_ui 9 128 | ui sendmsg 25 129 | mreadline termios 3 130 | rus_conv micq 1 131 | sendmsg stdio 1 132 | msg_queue sendmsg 2 133 | util_ui assert 2 134 | util assert 1 135 | msg_queue stdlib 7 136 | ui string 57 137 | sendmsg icq_response 7 138 | sendmsg unistd 4 139 | rus_conv char_conv 2 140 | util file_util 1 141 | sendmsg char_conv 4 142 | util msg_queue 7 143 | util select 1 144 | file_util ui 3 145 | micq sendmsg 33 146 | sendmsg string 33 147 | server util_ui 5 148 | util_ui time 4 149 | util ui 16 150 | msg_queue server 1 151 | sendmsg time 4 152 | micq wait 1 153 | icq_response sendmsg 3 154 | server stdlib 2 155 | network micq 3 156 | file_util micq 175 157 | -------------------------------------------------------------------------------- /src/main/java/bunch/api/BunchCluster.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: BunchCluster.java,v $ 4 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 5 | * CVS Import 6 | * 7 | * Revision 3.3 2000/11/30 01:49:21 bsmitc 8 | * Added support for various tests and statistical gathering 9 | * 10 | * Revision 3.2 2000/11/26 20:39:26 bsmitc 11 | * Added support for precision and recall calculations by using the 12 | * BunchGraph API suite 13 | * 14 | * Revision 3.1 2000/11/26 15:45:34 bsmitc 15 | * Initial Version - support for the BunchGraph api interface 16 | * 17 | * 18 | */ 19 | /** 20 | * Title: Bunch Project

21 | * Description:

22 | * Copyright: Copyright (c) Brian Mitchell

23 | * Company: Drexel University - SERG

24 | * @author Brian Mitchell 25 | * @version 1.0 26 | */ 27 | package bunch.api; 28 | 29 | import java.util.*; 30 | 31 | public class BunchCluster { 32 | 33 | int clusterID = -1; 34 | String clusterName = ""; 35 | ArrayList clusterNodes = null; 36 | ArrayList overlapNodes = null; 37 | Hashtable nodeHT = null; 38 | 39 | public BunchCluster(int id, String name, ArrayList nodes) { 40 | clusterID = id; 41 | clusterName = name; 42 | clusterNodes = nodes; 43 | nodeHT = null; 44 | //inform member nodes that they are a primary member of this cluster 45 | for(int i = 0; i < nodes.size(); i++) 46 | { 47 | BunchNode bn = (BunchNode)nodes.get(i); 48 | bn.setMemberCluster(this); 49 | } 50 | } 51 | 52 | public int getSize() 53 | { 54 | if (clusterNodes == null) return 0; 55 | return clusterNodes.size(); 56 | } 57 | 58 | public Collection getClusterNodes() 59 | { return clusterNodes; } 60 | 61 | public Collection getOverlapNodes() 62 | { return overlapNodes; } 63 | 64 | public int getOverlapNodeCount() 65 | { 66 | if(overlapNodes != null) 67 | return overlapNodes.size(); 68 | else 69 | return 0; 70 | } 71 | 72 | public void addOverlapNode(BunchNode bn) 73 | { 74 | if (overlapNodes == null) 75 | overlapNodes = new ArrayList(); 76 | 77 | overlapNodes.add(bn); 78 | nodeHT = null; 79 | } 80 | 81 | public void addNode(BunchNode bn) 82 | { 83 | bn.setMemberCluster(this); 84 | clusterNodes.add(bn); 85 | } 86 | 87 | public void removeNode(BunchNode bn) 88 | { 89 | bn.setMemberCluster(null); 90 | clusterNodes.remove(bn); 91 | } 92 | 93 | public int getID() 94 | { return clusterID; } 95 | 96 | public String getName() 97 | { return clusterName; } 98 | 99 | public boolean containsNode(BunchNode bn) 100 | { 101 | return containsNode(bn.getName()); 102 | } 103 | 104 | public boolean containsNode(String nodeName) 105 | { 106 | if(nodeHT == null) 107 | nodeHT = constructNodeHT(); 108 | 109 | return nodeHT.containsKey(nodeName); 110 | } 111 | 112 | private Hashtable constructNodeHT() 113 | { 114 | Hashtable h = new Hashtable(); 115 | h.clear(); 116 | 117 | if(clusterNodes != null) 118 | { 119 | for(int i = 0; i < clusterNodes.size(); i++) 120 | { 121 | BunchNode bn = (BunchNode)clusterNodes.get(i); 122 | String key = bn.getName(); 123 | h.put(key,bn); 124 | } 125 | } 126 | if(overlapNodes != null) 127 | { 128 | for(int i = 0; i < overlapNodes.size(); i++) 129 | { 130 | BunchNode bn = (BunchNode)overlapNodes.get(i); 131 | String key = bn.getName(); 132 | h.put(key,bn); 133 | } 134 | } 135 | return h; 136 | } 137 | } -------------------------------------------------------------------------------- /src/main/java/bunch/Bunch.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: Bunch.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:43 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:03 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.2 2000/08/18 21:07:59 bsmitc 11 | * Added feature to support tree output for dotty and text 12 | * 13 | * Revision 3.1 2000/07/26 23:27:55 bsmitc 14 | * Changed about box to include updated copywrite date and CVS release tag 15 | * 16 | * Revision 3.0 2000/07/26 22:46:07 bsmitc 17 | * *** empty log message *** 18 | * 19 | * Revision 1.1.1.1 2000/07/26 22:43:33 bsmitc 20 | * Imported CVS Sources 21 | * 22 | * 23 | */ 24 | package bunch; 25 | 26 | import javax.swing.UIManager; 27 | import java.awt.*; 28 | 29 | /** 30 | * The main aplication launcher class. This class basically sets the 31 | * general parameters (such as GUI) and then creates a BunchFrame and 32 | * displays it. 33 | * 34 | * @see bunch.BunchFrame 35 | */ 36 | public 37 | class Bunch 38 | { 39 | boolean packFrame = false; 40 | 41 | public 42 | Bunch() 43 | { 44 | BunchFrame frame = new BunchFrame(); 45 | 46 | //Validate frames that have preset sizes 47 | //Pack frames that have useful preferred size info, e.g. from their layout 48 | if (packFrame) 49 | frame.pack(); 50 | else 51 | frame.validate(); 52 | 53 | //Center the window 54 | Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 55 | Dimension frameSize = frame.getSize(); 56 | if (frameSize.height > screenSize.height) 57 | frameSize.height = screenSize.height; 58 | if (frameSize.width > screenSize.width) 59 | frameSize.width = screenSize.width; 60 | frame.setLocation((screenSize.width - frameSize.width) / 2, (screenSize.height - frameSize.height) / 2); 61 | frame.setVisible(true); 62 | } 63 | 64 | public static 65 | void 66 | main(String[] args) 67 | { 68 | try { 69 | if (args.length > 0) { 70 | System.setErr(new java.io.PrintStream(new java.io.FileOutputStream(args[0]))); 71 | } 72 | 73 | //-------------------------------------------------------------------------------- 74 | //Below is generated, but uncomment the desired layout manager 75 | //-------------------------------------------------------------------------------- 76 | //UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");//"javax.swing.plaf.windows.WindowsLookAndFeel"); 77 | //UIManager.setLookAndFeel(new javax.swing.plaf.motif.MotifLookAndFeel()); 78 | UIManager.setLookAndFeel(new javax.swing.plaf.metal.MetalLookAndFeel()); 79 | } 80 | catch (Exception e) { 81 | try{ 82 | UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); 83 | }catch (Exception e2) { 84 | e2.printStackTrace(); 85 | } 86 | } 87 | 88 | if (args.length == 1) 89 | { 90 | String a = args[0]; 91 | //-------------------------------------------------------------------------------- 92 | //Bunch can be started in server mode by placing a -s or -server at the end of 93 | //the command line 94 | //-------------------------------------------------------------------------------- 95 | if ((a.equalsIgnoreCase("-s")) || (a.equalsIgnoreCase("-server"))) 96 | { 97 | bunch.BunchServer.BunchServer theServer = new bunch.BunchServer.BunchServer(); 98 | theServer.setStartupParms(args,true); 99 | theServer.start(); 100 | } 101 | else 102 | System.out.println("Bad arguement, for BunchServer use -s or -server"); 103 | } 104 | else 105 | new Bunch(); 106 | } 107 | } 108 | 109 | 110 | 111 | -------------------------------------------------------------------------------- /src/main/java/bunch/BunchServer/BSWindow_AboutBox.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: BSWindow_AboutBox.java,v $ 4 | * Revision 3.0 2002/02/03 18:42:05 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:18 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch.BunchServer; 19 | 20 | import java.awt.*; 21 | import java.awt.event.*; 22 | import javax.swing.*; 23 | import javax.swing.border.*; 24 | 25 | public class BSWindow_AboutBox extends JDialog implements ActionListener { 26 | 27 | JPanel panel1 = new JPanel(); 28 | JPanel panel2 = new JPanel(); 29 | JPanel insetsPanel1 = new JPanel(); 30 | JPanel insetsPanel2 = new JPanel(); 31 | JPanel insetsPanel3 = new JPanel(); 32 | JButton button1 = new JButton(); 33 | JLabel imageControl1 = new JLabel(); 34 | ImageIcon imageIcon; 35 | JLabel label1 = new JLabel(); 36 | JLabel label2 = new JLabel(); 37 | JLabel label3 = new JLabel(); 38 | JLabel label4 = new JLabel(); 39 | BorderLayout borderLayout1 = new BorderLayout(); 40 | BorderLayout borderLayout2 = new BorderLayout(); 41 | FlowLayout flowLayout1 = new FlowLayout(); 42 | FlowLayout flowLayout2 = new FlowLayout(); 43 | GridLayout gridLayout1 = new GridLayout(); 44 | String product = "Your Product Name"; 45 | String version = ""; 46 | String copyright = "Copyright (c) 1999"; 47 | String comments = "Your description"; 48 | public BSWindow_AboutBox(Frame parent) { 49 | super(parent); 50 | enableEvents(AWTEvent.WINDOW_EVENT_MASK); 51 | try { 52 | jbInit(); 53 | } 54 | catch(Exception e) { 55 | e.printStackTrace(); 56 | } 57 | //imageControl1.setIcon(imageIcon); 58 | pack(); 59 | } 60 | 61 | private void jbInit() throws Exception { 62 | //imageIcon = new ImageIcon(getClass().getResource("your image name goes here")); 63 | this.setTitle("About"); 64 | setResizable(false); 65 | panel1.setLayout(borderLayout1); 66 | panel2.setLayout(borderLayout2); 67 | insetsPanel1.setLayout(flowLayout1); 68 | insetsPanel2.setLayout(flowLayout1); 69 | insetsPanel2.setBorder(new EmptyBorder(10, 10, 10, 10)); 70 | gridLayout1.setRows(4); 71 | gridLayout1.setColumns(1); 72 | label1.setText(product); 73 | label2.setText(version); 74 | label3.setText(copyright); 75 | label4.setText(comments); 76 | insetsPanel3.setLayout(gridLayout1); 77 | insetsPanel3.setBorder(new EmptyBorder(10, 60, 10, 10)); 78 | button1.setText("OK"); 79 | button1.addActionListener(this); 80 | insetsPanel2.add(imageControl1, null); 81 | panel2.add(insetsPanel2, BorderLayout.WEST); 82 | this.getContentPane().add(panel1, null); 83 | insetsPanel3.add(label1, null); 84 | insetsPanel3.add(label2, null); 85 | insetsPanel3.add(label3, null); 86 | insetsPanel3.add(label4, null); 87 | panel2.add(insetsPanel3, BorderLayout.CENTER); 88 | insetsPanel1.add(button1, null); 89 | panel1.add(insetsPanel1, BorderLayout.SOUTH); 90 | panel1.add(panel2, BorderLayout.NORTH); 91 | } 92 | 93 | protected void processWindowEvent(WindowEvent e) { 94 | if(e.getID() == WindowEvent.WINDOW_CLOSING) { 95 | cancel(); 96 | } 97 | super.processWindowEvent(e); 98 | } 99 | 100 | void cancel() { 101 | dispose(); 102 | } 103 | 104 | public void actionPerformed(ActionEvent e) { 105 | if(e.getSource() == button1) { 106 | cancel(); 107 | } 108 | } 109 | } -------------------------------------------------------------------------------- /src/main/java/bunch/BunchServer/ServerSteepestAscentClusteringMethod.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: ServerSteepestAscentClusteringMethod.java,v $ 4 | * Revision 3.0 2002/02/03 18:42:07 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:18 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch.BunchServer; 19 | import bunch.*; 20 | 21 | public class ServerSteepestAscentClusteringMethod 22 | extends GenericDistribHillClimbingClusteringMethod 23 | { 24 | 25 | int[] currWork = null; 26 | int pos=-1, maxPos=-1; 27 | 28 | FindNeighbor nServer = new FindNeighbor(); 29 | 30 | public ServerSteepestAscentClusteringMethod() { 31 | } 32 | 33 | protected 34 | Cluster 35 | getLocalMaxGraph(Cluster c) 36 | { 37 | System.out.print("IN: " + c.getObjFnValue() + " "); 38 | 39 | Cluster maxC = c.cloneCluster(); 40 | Cluster intermC = c.cloneCluster(); 41 | 42 | double maxOF = maxC.getObjFnValue(); 43 | double originalMax = maxOF; 44 | 45 | int[] clustNames = c.getClusterNames(); 46 | 47 | int[] clusters = c.getClusterVector(); 48 | 49 | int[] maxClust = maxC.getClusterVector(); 50 | 51 | boolean[] locks = c.getLocks(); 52 | 53 | //*********** 54 | //take this out later 55 | //*********** 56 | //if(pos == -1) 57 | //{ 58 | pos = 0; 59 | maxPos = clusters.length; 60 | //} 61 | 62 | int[] workVector = null; 63 | 64 | while((workVector = getMoreWork()) != null) 65 | { 66 | intermC = nServer.clusterWorklist(c,intermC,clustNames,locks,workVector); 67 | if (bunch.util.BunchUtilities.compareGreater(intermC.getObjFnValue(),maxOF)) { 68 | //if (intermC.getObjFnValue() > maxOF) { 69 | maxC.copyFromCluster(intermC);//System.arraycopy(clusters, 0, intermClust, 0, clusters.length); 70 | maxOF = maxC.getObjFnValue(); 71 | } 72 | } 73 | 74 | if (bunch.util.BunchUtilities.compareGreater(maxOF, originalMax)) { 75 | //if (maxOF > originalMax) { 76 | c.copyFromCluster(maxC);//.arraycopy(maxClust, 0, clusters, 0, clusters.length); 77 | } 78 | else { 79 | //we didn't find a better max partition then it's a maximum 80 | c.setConverged(true); 81 | } 82 | //c.calcObjFn(); 83 | 84 | System.out.println("OUT: " + c.getObjFnValue() + " "); 85 | 86 | return c; 87 | } 88 | 89 | int[] getMoreWork() 90 | { 91 | int start = pos; 92 | int end = Math.min(pos+5,maxPos); 93 | 94 | int delta = end-start; 95 | 96 | if(delta==0) 97 | return null; 98 | 99 | int [] workArea = new int[delta]; 100 | for(int i = 0; i < delta; i++) 101 | workArea[i]=pos++; 102 | 103 | return workArea; 104 | } 105 | 106 | public 107 | Configuration 108 | getConfiguration() 109 | { 110 | boolean reconf=false; 111 | if (configuration_d == null) { 112 | reconf = true; 113 | } 114 | 115 | HillClimbingConfiguration hc = (HillClimbingConfiguration)super.getConfiguration(); 116 | 117 | if (reconf) { 118 | hc.setThreshold(0.1); 119 | hc.setNumOfIterations(100); 120 | hc.setPopulationSize(5); 121 | } 122 | return hc; 123 | } 124 | 125 | public void 126 | setDefaultConfiguration() 127 | { 128 | HillClimbingConfiguration hc = (HillClimbingConfiguration)super.getConfiguration(); 129 | 130 | hc.setThreshold(0.1); 131 | hc.setNumOfIterations(100); 132 | hc.setPopulationSize(5); 133 | 134 | setConfiguration(hc); 135 | } 136 | 137 | } -------------------------------------------------------------------------------- /dot-examples/net-tools.mdg: -------------------------------------------------------------------------------- 1 | setroute stdio 2 2 | util ax25 3 3 | slip_ac string 2 4 | proc string 7 5 | netrom errno 1 6 | iptunnel string 17 7 | util utsname 1 8 | util unix 2 9 | hw activate 7 10 | getargs string 3 11 | ax25_gr stdio 6 12 | util arcnet 1 13 | util-ank iptunnel 12 14 | netrom string 1 15 | inet_gr af 2 16 | inet_sr ioctl 1 17 | interface util 7 18 | util getroute 2 19 | af ax25_gr 1 20 | inet_gr proc 6 21 | ax25 string 2 22 | util netrom 2 23 | ipx_gr af 2 24 | arcnet stdio 1 25 | ppp_ac stdio 2 26 | activate hw 2 27 | inet_sr stdlib 4 28 | ether stdio 1 29 | slip_ac ioctl 2 30 | getroute af 7 31 | inet_gr stdio 17 32 | iptunnel inet_sr 3 33 | ipx util 1 34 | ax25 ctype 3 35 | setroute af 5 36 | inet_sr socket 2 37 | inet in 12 38 | util-ank stdlib 20 39 | ppp stdio 2 40 | ipx in 4 41 | getroute util 1 42 | loopback stdio 2 43 | netrom stdio 3 44 | util stdlib 5 45 | inet_sr ctype 1 46 | util ddp 1 47 | tr hw 2 48 | ether util 1 49 | ax25 errno 1 50 | sockets util 1 51 | util af 2 52 | af netrom_sr 1 53 | inet util 2 54 | util-ank stdio 8 55 | interface af 4 56 | inet netdb 18 57 | util inet 2 58 | nstrcmp stdlib 1 59 | util-ank inet 2 60 | ax25_gr stdlib 2 61 | iptunnel inet 1 62 | iptunnel util-ank 10 63 | setroute inet_sr 1 64 | interface stdlib 2 65 | af stdlib 1 66 | inet_sr af 3 67 | util loopback 1 68 | netrom_gr stdio 8 69 | inet_sr unistd 1 70 | af inet_gr 1 71 | af ipx_gr 1 72 | activate stdio 2 73 | hw string 1 74 | inet ctype 2 75 | ipx_gr stdio 10 76 | unix stdio 2 77 | inet stdlib 6 78 | proc ctype 1 79 | ddp in 2 80 | iptunnel in 6 81 | ipx ctype 2 82 | tr ctype 1 83 | inet_sr string 2 84 | slip_ac errno 2 85 | ax25 util 3 86 | ddp stdio 1 87 | inet_sr in 2 88 | interface sockets 2 89 | inet errno 2 90 | af util 1 91 | util-ank string 11 92 | sockets stdio 2 93 | sockets net-support 2 94 | iptunnel stdio 20 95 | tr errno 1 96 | af ddp_gr 1 97 | sockets socket 2 98 | ax25 stdio 3 99 | setroute ipx_sr 1 100 | util string 1 101 | activate ppp_ac 2 102 | ddp util 1 103 | interface ioctl 3 104 | ddp_gr stdio 2 105 | inet_sr stdio 7 106 | af string 17 107 | interface string 8 108 | string irda 1 109 | hw stdio 2 110 | netrom util 2 111 | nstrcmp interface 2 112 | inet string 12 113 | af getroute 1 114 | activate slip_ac 10 115 | irda string 1 116 | sockets unistd 1 117 | slip_ac stdio 4 118 | string netrom 1 119 | netrom_gr stdlib 4 120 | af net-support 10 121 | inet stdio 3 122 | ipx stdlib 2 123 | inet inet_gr 3 124 | proc stdio 4 125 | af netrom_gr 1 126 | interface ctype 1 127 | getroute ipx_gr 1 128 | ipx stdio 1 129 | tr stdio 1 130 | netrom_sr stdio 2 131 | util inet_sr 4 132 | inet_gr stdlib 3 133 | ipx_sr stdio 2 134 | util stdio 3 135 | getroute ax25_gr 1 136 | netrom af 2 137 | interface errno 3 138 | af stdio 6 139 | frame stdio 1 140 | iptunnel stdlib 1 141 | ipx_gr string 1 142 | inet_sr util 1 143 | setroute netrom_sr 1 144 | util interface 4 145 | util ipx 1 146 | iptunnel socket 12 147 | arcnet util 1 148 | hw ether 1 149 | getroute ddp_gr 1 150 | nstrcmp ctype 1 151 | arcnet ctype 1 152 | getroute stdio 2 153 | netrom stdlib 2 154 | ether ctype 1 155 | ax25 af 2 156 | irda stdio 1 157 | getroute netrom_gr 1 158 | hw frame 2 159 | ax25 stdlib 2 160 | ipx string 1 161 | unix util 2 162 | arcnet errno 1 163 | getroute string 2 164 | af ipx_sr 1 165 | af inet_sr 1 166 | hw arcnet 1 167 | ether errno 1 168 | netrom ctype 3 169 | inet_gr inet 1 170 | util-ank in 2 171 | string ax25 1 172 | proc inet_gr 3 173 | hw ax25 1 174 | iptunnel unistd 6 175 | getroute inet_gr 1 176 | inet_gr string 4 177 | interface inet_sr 1 178 | interface nstrcmp 1 179 | interface stdio 11 180 | loopback util 1 181 | util ether 1 182 | iptunnel ioctl 12 183 | af setroute 1 184 | -------------------------------------------------------------------------------- /src/main/java/bunch/BunchServer/_BunchSvrMsgImpl_Tie.java: -------------------------------------------------------------------------------- 1 | // Tie class generated by rmic, do not edit. 2 | // Contents subject to change without notice. 3 | 4 | package bunch.BunchServer; 5 | 6 | import bunch.Callback; 7 | import java.io.Serializable; 8 | import java.rmi.Remote; 9 | import java.rmi.RemoteException; 10 | import javax.rmi.CORBA.Tie; 11 | import javax.rmi.CORBA.Util; 12 | import javax.rmi.PortableRemoteObject; 13 | import org.omg.CORBA.BAD_OPERATION; 14 | import org.omg.CORBA.ORB; 15 | import org.omg.CORBA.SystemException; 16 | import org.omg.CORBA.portable.InputStream; 17 | import org.omg.CORBA.portable.OutputStream; 18 | import org.omg.CORBA.portable.ResponseHandler; 19 | import org.omg.CORBA.portable.UnknownException; 20 | import org.omg.CORBA_2_3.portable.ObjectImpl; 21 | 22 | 23 | public class _BunchSvrMsgImpl_Tie extends ObjectImpl implements Tie { 24 | 25 | private BunchSvrMsgImpl target = null; 26 | 27 | private static final String[] _type_ids = { 28 | "RMI:bunch.BunchServer.BunchSvrMsg:0000000000000000" 29 | }; 30 | 31 | public void setTarget(Remote target) { 32 | this.target = (BunchSvrMsgImpl) target; 33 | } 34 | 35 | public Remote getTarget() { 36 | return target; 37 | } 38 | 39 | public org.omg.CORBA.Object thisObject() { 40 | return this; 41 | } 42 | 43 | public void deactivate() { 44 | _orb().disconnect(this); 45 | _set_delegate(null); 46 | target = null; 47 | } 48 | 49 | public ORB orb() { 50 | return _orb(); 51 | } 52 | 53 | public void orb(ORB orb) { 54 | orb.connect(this); 55 | } 56 | 57 | public String[] _ids() { 58 | return _type_ids; 59 | } 60 | 61 | public OutputStream _invoke(String method, InputStream _in, ResponseHandler reply) throws SystemException { 62 | try { 63 | org.omg.CORBA_2_3.portable.InputStream in = 64 | (org.omg.CORBA_2_3.portable.InputStream) _in; 65 | switch (method.length()) { 66 | case 8: 67 | if (method.equals("doAction")) { 68 | String arg0 = (String) in.read_value(String.class); 69 | boolean result = target.doAction(arg0); 70 | OutputStream out = reply.createReply(); 71 | out.write_boolean(result); 72 | return out; 73 | } 74 | case 13: 75 | if (method.equals("invokeMessage")) { 76 | String arg0 = (String) in.read_value(String.class); 77 | byte[] arg1 = (byte[]) in.read_value(byte[].class); 78 | boolean result = target.invokeMessage(arg0, arg1); 79 | OutputStream out = reply.createReply(); 80 | out.write_boolean(result); 81 | return out; 82 | } 83 | case 16: 84 | if (method.equals("registerCallback")) { 85 | Callback arg0 = (Callback) PortableRemoteObject.narrow(in.read_Object(), Callback.class); 86 | boolean result = target.registerCallback(arg0); 87 | OutputStream out = reply.createReply(); 88 | out.write_boolean(result); 89 | return out; 90 | } 91 | } 92 | throw new BAD_OPERATION(); 93 | } catch (SystemException ex) { 94 | throw ex; 95 | } catch (Throwable ex) { 96 | throw new UnknownException(ex); 97 | } 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /src/main/java/bunch/MQCalculatorUtil.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: MQCalculatorUtil.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:52 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:10 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | 19 | /** 20 | * Title: Bunch Version 1.2 Base

21 | * Description: Your description

22 | * Copyright: Copyright (c) 1999

23 | * Company:

24 | * @author Brian Mitchell 25 | * @version 26 | */ 27 | package bunch; 28 | 29 | import java.awt.*; 30 | import javax.swing.*; 31 | import java.awt.event.*; 32 | 33 | /** 34 | * This class is used to calculte MQ values using a given MQ objective function. 35 | */ 36 | 37 | public class MQCalculatorUtil extends JDialog { 38 | JPanel panel1 = new JPanel(); 39 | GridBagLayout gridBagLayout1 = new GridBagLayout(); 40 | JLabel jLabel1 = new JLabel(); 41 | JTextField fileNameEF = new JTextField(); 42 | JButton fileSelectPB = new JButton(); 43 | JLabel jLabel2 = new JLabel(); 44 | JComboBox jComboBox1 = new JComboBox(); 45 | JButton evaluatePB = new JButton(); 46 | JButton cancelPB = new JButton(); 47 | 48 | public MQCalculatorUtil(Frame frame, String title, boolean modal) { 49 | super(frame, title, modal); 50 | try { 51 | jbInit(); 52 | pack(); 53 | } 54 | catch(Exception ex) { 55 | ex.printStackTrace(); 56 | } 57 | } 58 | 59 | public MQCalculatorUtil() { 60 | this(null, "", false); 61 | } 62 | 63 | /** 64 | * Create the GUI controls 65 | */ 66 | void jbInit() throws Exception { 67 | panel1.setLayout(gridBagLayout1); 68 | jLabel1.setText("Input File Name:"); 69 | fileSelectPB.setText("Select ..."); 70 | jLabel2.setText("MQ Calculator:"); 71 | evaluatePB.setText("Evaluate..."); 72 | cancelPB.setText("Done"); 73 | cancelPB.addActionListener(new MQCalculatorUtil_cancelPB_actionAdapter(this)); 74 | getContentPane().add(panel1); 75 | panel1.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 76 | ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 0, 0)); 77 | panel1.add(fileNameEF, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 78 | ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 5, 5), 158, 0)); 79 | panel1.add(fileSelectPB, new GridBagConstraints(2, 0, 1, 1, 0.0, 0.0 80 | ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 0, 5, 0), 0, -6)); 81 | panel1.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 82 | ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, 0)); 83 | panel1.add(jComboBox1, new GridBagConstraints(1, 1, 2, 1, 0.0, 0.0 84 | ,GridBagConstraints.SOUTHWEST, GridBagConstraints.BOTH, new Insets(0, 0, 0, 0), 0, -8)); 85 | panel1.add(evaluatePB, new GridBagConstraints(0, 2, 1, 1, 0.0, 0.0 86 | ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(6, 0, 0, 0), 0, -7)); 87 | panel1.add(cancelPB, new GridBagConstraints(1, 2, 1, 1, 0.0, 0.0 88 | ,GridBagConstraints.SOUTHWEST, GridBagConstraints.NONE, new Insets(0, 5, 0, 0), 0, -7)); 89 | } 90 | 91 | void cancelPB_actionPerformed(ActionEvent e) { 92 | dispose(); 93 | } 94 | } 95 | 96 | class MQCalculatorUtil_cancelPB_actionAdapter implements java.awt.event.ActionListener { 97 | MQCalculatorUtil adaptee; 98 | 99 | MQCalculatorUtil_cancelPB_actionAdapter(MQCalculatorUtil adaptee) { 100 | this.adaptee = adaptee; 101 | } 102 | 103 | public void actionPerformed(ActionEvent e) { 104 | adaptee.cancelPB_actionPerformed(e); 105 | } 106 | } -------------------------------------------------------------------------------- /src/main/java/bunch/stats/StatsManager.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: StatsManager.java,v $ 4 | * Revision 1.1.1.1 2002/02/03 18:30:06 bsmitc 5 | * CVS Import 6 | * 7 | * Revision 1.3 2000/08/13 18:40:33 bsmitc 8 | * Added support for SA framework and dumping the output to a log file 9 | * 10 | * Revision 1.2 2000/08/11 15:04:36 bsmitc 11 | * Added support for producing optimal output on the clustering progress 12 | * dialog window 13 | * 14 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 15 | * Imported CVS Sources 16 | * 17 | * 18 | */ 19 | 20 | /** 21 | * Title: Bunch Version 1.2 Base

22 | * Description: Your description

23 | * Copyright: Copyright (c) 1999

24 | * Company:

25 | * @author Brian Mitchell 26 | * @version 27 | */ 28 | package bunch.stats; 29 | 30 | import java.io.*; 31 | 32 | public class StatsManager { 33 | 34 | public static String logFileNm = "BunchStats.log"; 35 | long mqCalculations = 0; 36 | long calcAllCalcs=0; 37 | long calcIncrCalcs=0; 38 | long exhaustiveTotal = -1; 39 | long exhaustiveFinished = 0; 40 | long simulatedAnnealingOverrides = 0; 41 | 42 | boolean collectClusteringDetails = false; 43 | 44 | //make this a singleton 45 | private StatsManager() { 46 | } 47 | 48 | static private StatsManager singletonObj; 49 | 50 | public static StatsManager getInstance() { 51 | if (singletonObj == null) { 52 | synchronized(StatsManager.class) { 53 | if (singletonObj == null) { 54 | singletonObj = new StatsManager(); 55 | } 56 | } 57 | } 58 | return singletonObj; 59 | } 60 | 61 | static public void cleanup() 62 | { singletonObj = null; } 63 | 64 | public void setCollectClusteringDetails(boolean b) 65 | { collectClusteringDetails = b;} 66 | 67 | public boolean getCollectClusteringDetails() 68 | { return collectClusteringDetails; } 69 | 70 | public long getMQCalculations() 71 | { return mqCalculations; } 72 | 73 | public long incrMQCalculations() 74 | { return ++mqCalculations; } 75 | 76 | public long incrCalcAllCalcs() 77 | { return ++calcAllCalcs; } 78 | 79 | public long getCalcAllCalcs() 80 | { return calcAllCalcs; } 81 | 82 | public long incrCalcIncrCalcs() 83 | { return ++calcIncrCalcs; } 84 | 85 | public long getCalcIncrCalcs() 86 | { return calcIncrCalcs; } 87 | 88 | public void setExhaustiveTotal(int t) 89 | { exhaustiveTotal = t; } 90 | 91 | public long getExhaustiveTotal() 92 | { return exhaustiveTotal; } 93 | 94 | public long getExhaustiveFinished() 95 | { return exhaustiveFinished; } 96 | 97 | public void incrExhaustiveFinished() 98 | { exhaustiveFinished++; } 99 | 100 | public void clearExhaustiveFinished() 101 | { exhaustiveFinished = 0; } 102 | 103 | public int getExhaustivePct() 104 | { 105 | if(exhaustiveTotal <= 0) return 0; 106 | 107 | double pct = (double)exhaustiveFinished/(double)exhaustiveTotal; 108 | pct *= 100.0; 109 | int iPct = (int)pct; 110 | return iPct; 111 | } 112 | 113 | public long getSAOverrides() 114 | { return simulatedAnnealingOverrides; } 115 | 116 | public void incrSAOverrides() 117 | { simulatedAnnealingOverrides++; } 118 | 119 | public boolean dumpStatsLog() 120 | { 121 | try 122 | { 123 | BufferedWriter writer = new BufferedWriter(new FileWriter(logFileNm)); 124 | writer.write("Total MQ Calculations: " + mqCalculations + "\n"); 125 | writer.write("Simulated Annealing Overrides: " + simulatedAnnealingOverrides + "\n"); 126 | writer.close(); 127 | } 128 | catch(Exception e) 129 | { 130 | System.out.println("Error creating the logfile at location: " + logFileNm); 131 | return false; 132 | } 133 | return true; 134 | } 135 | } -------------------------------------------------------------------------------- /dot-examples/bison: -------------------------------------------------------------------------------- 1 | LR0.c state.h 2 | LR0.c new.h 3 | LR0.c machine.h 4 | LR0.c /usr/include/stdio.h 5 | LR0.c main.c 6 | LR0.c gram.c 7 | LR0.c allocate.c 8 | LR0.c closure.c 9 | LR0.c libc.a 10 | /usr/include/stdio.h /usr/include/sys/va_list.h 11 | /usr/include/strings.h /usr/include/stdio.h 12 | /usr/include/string.h /usr/include/stdio.h 13 | alloca.c allocate.c 14 | alloca.c libc.a 15 | allocate.c /usr/include/stdio.h 16 | allocate.c files.c 17 | allocate.c main.c 18 | closure.c new.h 19 | closure.c machine.h 20 | closure.c gram.h 21 | closure.c gram.c 22 | closure.c libc.a 23 | closure.c allocate.c 24 | closure.c warshall.c 25 | closure.c derives.c 26 | files.h /usr/include/stdio.h 27 | conflicts.c /usr/include/stdio.h 28 | conflicts.c machine.h 29 | conflicts.c state.h 30 | conflicts.c gram.h 31 | conflicts.c new.h 32 | conflicts.c getargs.c 33 | conflicts.c libc.a 34 | conflicts.c files.c 35 | conflicts.c lalr.c 36 | conflicts.c gram.c 37 | conflicts.c allocate.c 38 | conflicts.c /usr/include/strings.h 39 | conflicts.c LR0.c 40 | conflicts.c reader.c 41 | derives.c new.h 42 | derives.c types.h 43 | derives.c gram.c 44 | derives.c libc.a 45 | derives.c allocate.c 46 | files.c /usr/include/stdio.h 47 | files.c files.h 48 | files.c new.h 49 | files.c /usr/include/string.h 50 | files.c getargs.c 51 | files.c libc.a 52 | files.c allocate.c 53 | files.c main.c 54 | getargs.c /usr/include/stdio.h 55 | getargs.c getopt.h 56 | getargs.c main.c 57 | getargs.c files.c 58 | getargs.c getopt.c 59 | getargs.c libc.a 60 | getargs.c version.c 61 | getargs.c getopt1.c 62 | getopt.c /usr/include/stdio.h 63 | getopt.c getopt.h 64 | getopt.c libc.a 65 | getopt.c /usr/include/string.h 66 | getopt.c files.c 67 | getopt1.c getopt.h 68 | getopt1.c /usr/include/stdio.h 69 | getopt1.c getopt.c 70 | lalr.c new.h 71 | lalr.c types.h 72 | lalr.c machine.h 73 | lalr.c state.h 74 | lalr.c gram.h 75 | lalr.c libc.a 76 | lalr.c allocate.c 77 | lalr.c gram.c 78 | lalr.c nullable.c 79 | lalr.c LR0.c 80 | lalr.c main.c 81 | lalr.c derives.c 82 | lex.c symtab.h 83 | lex.c /usr/include/stdio.h 84 | lex.c lex.h 85 | lex.c /usr/include/ctype.h 86 | lex.c new.h 87 | lex.c /usr/include/string.h 88 | lex.c main.c 89 | lex.c files.c 90 | lex.c reader.c 91 | lex.c getargs.c 92 | lex.c symtab.c 93 | lex.c getopt.c 94 | lex.c gram.c 95 | lex.c allocate.c 96 | main.c /usr/include/stdio.h 97 | main.c machine.h 98 | main.c getargs.c 99 | main.c print.c 100 | main.c files.c 101 | main.c reader.c 102 | main.c derives.c 103 | main.c libc.a 104 | main.c reduce.c 105 | main.c LR0.c 106 | main.c nullable.c 107 | main.c conflicts.c 108 | main.c output.c 109 | main.c lalr.c 110 | nullable.c types.h 111 | nullable.c new.h 112 | nullable.c gram.h 113 | nullable.c libc.a 114 | nullable.c gram.c 115 | nullable.c allocate.c 116 | output.c /usr/include/stdio.h 117 | output.c new.h 118 | output.c state.h 119 | output.c gram.h 120 | output.c machine.h 121 | output.c gram.c 122 | output.c lalr.c 123 | output.c files.c 124 | output.c LR0.c 125 | output.c getargs.c 126 | output.c allocate.c 127 | output.c reader.c 128 | output.c libc.a 129 | output.c conflicts.c 130 | output.c main.c 131 | output.c /usr/include/string.h 132 | print.c state.h 133 | print.c /usr/include/stdio.h 134 | print.c gram.h 135 | print.c gram.c 136 | print.c conflicts.c 137 | print.c reader.c 138 | print.c files.c 139 | print.c lalr.c 140 | print.c LR0.c 141 | print.c /usr/include/string.h 142 | reader.c lex.h 143 | reader.c /usr/include/stdio.h 144 | reader.c /usr/include/ctype.h 145 | reader.c new.h 146 | reader.c symtab.h 147 | reader.c gram.h 148 | reader.c machine.h 149 | reader.c main.c 150 | reader.c files.c 151 | reader.c allocate.c 152 | reader.c gram.c 153 | reader.c lex.c 154 | reader.c /usr/include/string.h 155 | reader.c getargs.c 156 | reader.c conflicts.c 157 | reader.c symtab.c 158 | reader.c version.c 159 | reader.c libc.a 160 | reader.c output.c 161 | reduce.c /usr/include/stdio.h 162 | reduce.c machine.h 163 | reduce.c gram.h 164 | reduce.c new.h 165 | reduce.c gram.c 166 | reduce.c allocate.c 167 | reduce.c libc.a 168 | reduce.c main.c 169 | reduce.c reader.c 170 | reduce.c files.c 171 | reduce.c getargs.c 172 | symtab.c new.h 173 | symtab.c symtab.h 174 | symtab.c /usr/include/stdio.h 175 | symtab.c allocate.c 176 | symtab.c gram.c 177 | symtab.c /usr/include/string.h 178 | symtab.c libc.a 179 | warshall.c machine.h 180 | -------------------------------------------------------------------------------- /src/main/java/bunch/_CallbackImpl_Tie.java: -------------------------------------------------------------------------------- 1 | // Tie class generated by rmic, do not edit. 2 | // Contents subject to change without notice. 3 | 4 | package bunch; 5 | 6 | import java.io.Serializable; 7 | import java.rmi.Remote; 8 | import java.rmi.RemoteException; 9 | import javax.rmi.CORBA.Tie; 10 | import javax.rmi.CORBA.Util; 11 | import org.omg.CORBA.BAD_OPERATION; 12 | import org.omg.CORBA.ORB; 13 | import org.omg.CORBA.SystemException; 14 | import org.omg.CORBA.portable.InputStream; 15 | import org.omg.CORBA.portable.OutputStream; 16 | import org.omg.CORBA.portable.ResponseHandler; 17 | import org.omg.CORBA.portable.UnknownException; 18 | import org.omg.CORBA_2_3.portable.ObjectImpl; 19 | 20 | 21 | public class _CallbackImpl_Tie extends ObjectImpl implements Tie { 22 | 23 | private CallbackImpl target = null; 24 | 25 | private static final String[] _type_ids = { 26 | "RMI:bunch.Callback:0000000000000000" 27 | }; 28 | 29 | public void setTarget(Remote target) { 30 | this.target = (CallbackImpl) target; 31 | } 32 | 33 | public Remote getTarget() { 34 | return target; 35 | } 36 | 37 | public org.omg.CORBA.Object thisObject() { 38 | return this; 39 | } 40 | 41 | public void deactivate() { 42 | _orb().disconnect(this); 43 | _set_delegate(null); 44 | target = null; 45 | } 46 | 47 | public ORB orb() { 48 | return _orb(); 49 | } 50 | 51 | public void orb(ORB orb) { 52 | orb.connect(this); 53 | } 54 | 55 | public String[] _ids() { 56 | return _type_ids; 57 | } 58 | 59 | public OutputStream _invoke(String method, InputStream _in, ResponseHandler reply) throws SystemException { 60 | try { 61 | org.omg.CORBA_2_3.portable.InputStream in = 62 | (org.omg.CORBA_2_3.portable.InputStream) _in; 63 | switch (method.length()) { 64 | case 14: 65 | if (method.equals("callFromServer")) { 66 | String arg0 = (String) in.read_value(String.class); 67 | byte[] result = target.callFromServer(arg0); 68 | org.omg.CORBA_2_3.portable.OutputStream out = 69 | (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply(); 70 | out.write_value(cast_array(result),byte[].class); 71 | return out; 72 | } 73 | case 15: 74 | if (method.equals("bCallFromServer")) { 75 | String arg0 = (String) in.read_value(String.class); 76 | boolean result = target.bCallFromServer(arg0); 77 | OutputStream out = reply.createReply(); 78 | out.write_boolean(result); 79 | return out; 80 | } 81 | case 21: 82 | if (method.equals("callFromServerWithObj")) { 83 | String arg0 = (String) in.read_value(String.class); 84 | byte[] arg1 = (byte[]) in.read_value(byte[].class); 85 | byte[] result = target.callFromServerWithObj(arg0, arg1); 86 | org.omg.CORBA_2_3.portable.OutputStream out = 87 | (org.omg.CORBA_2_3.portable.OutputStream) reply.createReply(); 88 | out.write_value(cast_array(result),byte[].class); 89 | return out; 90 | } 91 | case 22: 92 | if (method.equals("bCallFromServerWithObj")) { 93 | String arg0 = (String) in.read_value(String.class); 94 | byte[] arg1 = (byte[]) in.read_value(byte[].class); 95 | boolean result = target.bCallFromServerWithObj(arg0, arg1); 96 | OutputStream out = reply.createReply(); 97 | out.write_boolean(result); 98 | return out; 99 | } 100 | } 101 | throw new BAD_OPERATION(); 102 | } catch (SystemException ex) { 103 | throw ex; 104 | } catch (Throwable ex) { 105 | throw new UnknownException(ex); 106 | } 107 | } 108 | 109 | // This method is required as a work-around for 110 | // a bug in the JDK 1.1.6 verifier. 111 | 112 | private Serializable cast_array(Object obj) { 113 | return (Serializable)obj; 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /src/main/java/bunch/HillClimbingClusteringConfigurationDialog.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: HillClimbingClusteringConfigurationDialog.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:51 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:04 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.3 2000/08/13 18:40:06 bsmitc 11 | * Added support for SA framework 12 | * 13 | * Revision 3.2 2000/08/12 22:16:10 bsmitc 14 | * Added support for Simulated Annealing configuration for NAHC technique 15 | * 16 | * Revision 3.1 2000/08/11 22:13:04 bsmitc 17 | * Removed generation selection feature 18 | * 19 | * Revision 3.0 2000/07/26 22:46:10 bsmitc 20 | * *** empty log message *** 21 | * 22 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 23 | * Imported CVS Sources 24 | * 25 | * 26 | */ 27 | package bunch; 28 | 29 | import java.awt.*; 30 | import javax.swing.*; 31 | //import borland.jbcl.layout.GridBagConstraints2; 32 | import java.awt.event.*; 33 | import java.util.*; 34 | 35 | /** 36 | * A configuration dialog for the Hill Climbing clustering 37 | * methods. 38 | * 39 | * @author Brian Mitchell 40 | * 41 | * @see bunch.ClusteringConfigurationDialog 42 | * @see bunch.HillClimbingClusteringMethod 43 | * @see bunch.NextAscentHillClimbingClusteringMethod 44 | * @see bunch.SteepestAscentHillClimbingClusteringMethod 45 | */ 46 | public 47 | class HillClimbingClusteringConfigurationDialog 48 | extends ClusteringConfigurationDialog 49 | { 50 | 51 | GridBagLayout gridBagLayout2 = new GridBagLayout(); 52 | JLabel numGenlabel_d = new JLabel(); 53 | JTextField jTextField1 = new JTextField(); 54 | JLabel popSizelabel_d = new JLabel(); 55 | JTextField popSize_d = new JTextField(); 56 | JLabel thresholdLabel_d = new JLabel(); 57 | JTextField jTextField2 = new JTextField(); 58 | 59 | 60 | public 61 | HillClimbingClusteringConfigurationDialog(Frame frame, String title, boolean modal) 62 | { 63 | super(frame, title, modal); 64 | } 65 | 66 | public 67 | HillClimbingClusteringConfigurationDialog() 68 | { 69 | super(); 70 | } 71 | 72 | /** 73 | * Creates the basic configuration window. The idea is that this class is extended 74 | * to add additional UI controls for specific hill climbing clustering configruations 75 | */ 76 | public 77 | void 78 | jbInit() 79 | throws Exception 80 | { 81 | numGenlabel_d.setText("Number Of Generations:"); 82 | popSizelabel_d.setText("Population Size:"); 83 | thresholdLabel_d.setText("Cutoff Threshold:"); 84 | optionsPanel_d.setLayout(gridBagLayout2); 85 | 86 | jTextField1.setText(Integer.toString(configuration_d.getNumOfIterations())); 87 | popSize_d.setText(Integer.toString(configuration_d.getPopulationSize())); 88 | jTextField2.setText(Double.toString(((HillClimbingConfiguration)configuration_d).getThreshold())); 89 | 90 | optionsPanel_d.add(numGenlabel_d, new GridBagConstraints2(0, 0, 1, 1, 0.0, 0.0 91 | ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); 92 | optionsPanel_d.add(jTextField1, new GridBagConstraints2(1, 0, 1, 1, 0.4, 0.0 93 | ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); 94 | optionsPanel_d.add(popSizelabel_d, new GridBagConstraints2(0, 1, 1, 1, 0.0, 0.0 95 | ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); 96 | optionsPanel_d.add(popSize_d, new GridBagConstraints2(1, 1, 1, 1, 0.4, 0.0 97 | ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); 98 | //optionsPanel_d.add(thresholdLabel_d, new GridBagConstraints2(0, 2, 1, 1, 0.0, 0.0 99 | // ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 5, 5, 5), 0, 0)); 100 | //optionsPanel_d.add(jTextField2, new GridBagConstraints2(1, 2, 1, 1, 0.4, 0.0 101 | // ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); 102 | 103 | //HACK fix later 104 | numGenlabel_d.setVisible(false); 105 | jTextField1.setVisible(false); 106 | 107 | super.jbInit(); 108 | } 109 | 110 | /** 111 | * Creates a configuration based on the data entered on the dialog and 112 | * returns it. 113 | * 114 | * @return the created configuration 115 | */ 116 | protected 117 | Configuration 118 | createConfiguration() 119 | { 120 | configuration_d.setNumOfIterations(Integer.parseInt(jTextField1.getText())); 121 | configuration_d.setPopulationSize(Integer.parseInt(popSize_d.getText())); 122 | ((HillClimbingConfiguration)configuration_d).setThreshold(Double.valueOf(jTextField2.getText()).doubleValue()); 123 | return configuration_d; 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /dot-examples/bip-100-5.mdg: -------------------------------------------------------------------------------- 1 | M73 M9 1 2 | M68 M86 1 3 | M35 M28 1 4 | M96 M88 1 5 | M12 M2 1 6 | M88 M7 1 7 | M96 M9 1 8 | M96 M21 1 9 | M55 M54 1 10 | M25 M96 1 11 | M96 M16 1 12 | M79 M40 1 13 | M3 M0 1 14 | M28 M54 1 15 | M55 M50 1 16 | M12 M13 1 17 | M34 M55 1 18 | M23 M60 1 19 | M24 M70 1 20 | M55 M5 1 21 | M70 M93 1 22 | M79 M44 1 23 | M96 M49 1 24 | M73 M33 1 25 | M79 M89 1 26 | M96 M47 1 27 | M12 M29 1 28 | M27 M52 1 29 | M90 M12 1 30 | M19 M73 1 31 | M3 M97 1 32 | M33 M79 1 33 | M56 M52 1 34 | M4 M55 1 35 | M27 M70 1 36 | M55 M13 1 37 | M3 M50 1 38 | M89 M7 1 39 | M4 M3 1 40 | M52 M35 1 41 | M32 M7 1 42 | M79 M40 1 43 | M7 M93 1 44 | M70 M20 1 45 | M89 M7 1 46 | M88 M73 1 47 | M78 M12 1 48 | M28 M81 1 49 | M3 M42 1 50 | M83 M79 1 51 | M69 M7 1 52 | M68 M18 1 53 | M53 M23 1 54 | M68 M18 1 55 | M68 M0 1 56 | M55 M41 1 57 | M79 M50 1 58 | M7 M16 1 59 | M88 M7 1 60 | M3 M56 1 61 | M28 M80 1 62 | M23 M9 1 63 | M77 M52 1 64 | M12 M24 1 65 | M47 M23 1 66 | M32 M7 1 67 | M3 M51 1 68 | M68 M15 1 69 | M55 M82 1 70 | M70 M71 1 71 | M68 M32 1 72 | M63 M79 1 73 | M21 M73 1 74 | M25 M3 1 75 | M0 M73 1 76 | M25 M70 1 77 | M85 M73 1 78 | M28 M9 1 79 | M55 M8 1 80 | M83 M12 1 81 | M64 M28 1 82 | M69 M23 1 83 | M23 M19 1 84 | M5 M70 1 85 | M43 M23 1 86 | M96 M50 1 87 | M79 M17 1 88 | M85 M52 1 89 | M23 M44 1 90 | M23 M49 1 91 | M96 M10 1 92 | M68 M81 1 93 | M23 M77 1 94 | M19 M28 1 95 | M62 M68 1 96 | M82 M55 1 97 | M52 M34 1 98 | M29 M68 1 99 | M73 M13 1 100 | M12 M62 1 101 | M27 M52 1 102 | M73 M83 1 103 | M13 M73 1 104 | M77 M52 1 105 | M7 M56 1 106 | M68 M0 1 107 | M70 M6 1 108 | M54 M7 1 109 | M52 M16 1 110 | M88 M79 1 111 | M79 M58 1 112 | M79 M44 1 113 | M73 M64 1 114 | M47 M3 1 115 | M77 M52 1 116 | M96 M29 1 117 | M70 M34 1 118 | M41 M12 1 119 | M70 M34 1 120 | M7 M92 1 121 | M46 M70 1 122 | M27 M3 1 123 | M3 M91 1 124 | M73 M81 1 125 | M52 M40 1 126 | M70 M60 1 127 | M7 M31 1 128 | M12 M59 1 129 | M5 M7 1 130 | M70 M44 1 131 | M65 M70 1 132 | M10 M3 1 133 | M7 M19 1 134 | M68 M62 1 135 | M7 M0 1 136 | M46 M96 1 137 | M68 M99 1 138 | M16 M52 1 139 | M5 M55 1 140 | M47 M23 1 141 | M70 M2 1 142 | M33 M70 1 143 | M90 M68 1 144 | M98 M7 1 145 | M7 M75 1 146 | M17 M12 1 147 | M23 M76 1 148 | M12 M5 1 149 | M20 M3 1 150 | M70 M36 1 151 | M7 M47 1 152 | M7 M22 1 153 | M68 M78 1 154 | M79 M51 1 155 | M34 M28 1 156 | M83 M55 1 157 | M96 M72 1 158 | M55 M91 1 159 | M23 M2 1 160 | M52 M48 1 161 | M24 M7 1 162 | M39 M96 1 163 | M20 M52 1 164 | M75 M96 1 165 | M11 M68 1 166 | M60 M23 1 167 | M73 M93 1 168 | M7 M93 1 169 | M28 M46 1 170 | M80 M52 1 171 | M71 M52 1 172 | M84 M96 1 173 | M63 M23 1 174 | M84 M12 1 175 | M38 M68 1 176 | M7 M83 1 177 | M36 M23 1 178 | M55 M9 1 179 | M70 M82 1 180 | M18 M70 1 181 | M3 M27 1 182 | M19 M3 1 183 | M42 M79 1 184 | M93 M23 1 185 | M73 M41 1 186 | M73 M10 1 187 | M59 M7 1 188 | M7 M46 1 189 | M68 M91 1 190 | M55 M38 1 191 | M49 M96 1 192 | M73 M80 1 193 | M49 M96 1 194 | M96 M42 1 195 | M52 M46 1 196 | M66 M79 1 197 | M12 M44 1 198 | M52 M34 1 199 | M79 M95 1 200 | M3 M17 1 201 | M52 M13 1 202 | M10 M7 1 203 | M28 M6 1 204 | M25 M23 1 205 | M4 M23 1 206 | M29 M23 1 207 | M49 M52 1 208 | M8 M12 1 209 | M96 M66 1 210 | M55 M51 1 211 | M96 M46 1 212 | M28 M63 1 213 | M7 M21 1 214 | M47 M52 1 215 | M45 M3 1 216 | M70 M45 1 217 | M70 M50 1 218 | M68 M42 1 219 | M79 M8 1 220 | M13 M96 1 221 | M96 M8 1 222 | M75 M68 1 223 | M96 M43 1 224 | M3 M69 1 225 | M41 M96 1 226 | M79 M37 1 227 | M73 M69 1 228 | M23 M77 1 229 | M79 M66 1 230 | M23 M62 1 231 | M52 M35 1 232 | M88 M52 1 233 | M48 M52 1 234 | M7 M33 1 235 | M96 M19 1 236 | M43 M7 1 237 | M28 M30 1 238 | M28 M5 1 239 | M70 M39 1 240 | M21 M70 1 241 | M63 M96 1 242 | M96 M64 1 243 | M31 M3 1 244 | M34 M68 1 245 | M79 M95 1 246 | M34 M23 1 247 | M38 M96 1 248 | -------------------------------------------------------------------------------- /dot-examples/rnd-100-5.mdg: -------------------------------------------------------------------------------- 1 | M7 M64 1 2 | M30 M55 1 3 | M66 M41 1 4 | M34 M64 1 5 | M44 M7 1 6 | M81 M94 1 7 | M28 M62 1 8 | M55 M22 1 9 | M55 M7 1 10 | M53 M65 1 11 | M21 M97 1 12 | M97 M60 1 13 | M21 M81 1 14 | M36 M72 1 15 | M94 M48 1 16 | M61 M30 1 17 | M66 M46 1 18 | M41 M88 1 19 | M18 M76 1 20 | M50 M2 1 21 | M25 M100 1 22 | M81 M41 1 23 | M92 M88 1 24 | M80 M37 1 25 | M94 M16 1 26 | M85 M5 1 27 | M64 M41 1 28 | M100 M27 1 29 | M40 M43 1 30 | M6 M95 1 31 | M92 M39 1 32 | M81 M91 1 33 | M62 M85 1 34 | M33 M77 1 35 | M93 M55 1 36 | M81 M78 1 37 | M6 M12 1 38 | M69 M1 1 39 | M23 M51 1 40 | M17 M18 1 41 | M72 M46 1 42 | M23 M18 1 43 | M80 M73 1 44 | M33 M59 1 45 | M18 M12 1 46 | M61 M17 1 47 | M5 M62 1 48 | M46 M4 1 49 | M52 M60 1 50 | M79 M91 1 51 | M88 M25 1 52 | M75 M49 1 53 | M29 M79 1 54 | M32 M85 1 55 | M47 M85 1 56 | M40 M26 1 57 | M72 M9 1 58 | M95 M17 1 59 | M66 M100 1 60 | M7 M15 1 61 | M84 M53 1 62 | M1 M30 1 63 | M68 M52 1 64 | M86 M8 1 65 | M8 M82 1 66 | M80 M52 1 67 | M5 M54 1 68 | M79 M31 1 69 | M71 M9 1 70 | M97 M18 1 71 | M62 M96 1 72 | M24 M20 1 73 | M29 M11 1 74 | M84 M80 1 75 | M96 M65 1 76 | M81 M61 1 77 | M87 M69 1 78 | M98 M95 1 79 | M95 M23 1 80 | M31 M24 1 81 | M1 M69 1 82 | M59 M34 1 83 | M48 M46 1 84 | M11 M67 1 85 | M8 M62 1 86 | M73 M87 1 87 | M94 M26 1 88 | M24 M21 1 89 | M73 M7 1 90 | M34 M49 1 91 | M50 M16 1 92 | M5 M24 1 93 | M4 M68 1 94 | M23 M19 1 95 | M75 M4 1 96 | M33 M73 1 97 | M20 M59 1 98 | M80 M59 1 99 | M79 M18 1 100 | M48 M27 1 101 | M99 M57 1 102 | M53 M60 1 103 | M71 M16 1 104 | M12 M13 1 105 | M18 M49 1 106 | M67 M71 1 107 | M48 M73 1 108 | M90 M85 1 109 | M38 M9 1 110 | M2 M88 1 111 | M63 M56 1 112 | M3 M58 1 113 | M62 M7 1 114 | M72 M3 1 115 | M68 M38 1 116 | M36 M59 1 117 | M71 M27 1 118 | M34 M88 1 119 | M97 M56 1 120 | M21 M63 1 121 | M48 M82 1 122 | M31 M43 1 123 | M18 M34 1 124 | M45 M53 1 125 | M81 M67 1 126 | M50 M32 1 127 | M44 M20 1 128 | M75 M67 1 129 | M18 M1 1 130 | M82 M50 1 131 | M57 M28 1 132 | M4 M36 1 133 | M33 M63 1 134 | M9 M100 1 135 | M85 M19 1 136 | M7 M43 1 137 | M99 M23 1 138 | M15 M12 1 139 | M19 M56 1 140 | M27 M77 1 141 | M5 M56 1 142 | M95 M98 1 143 | M38 M35 1 144 | M54 M38 1 145 | M78 M58 1 146 | M86 M10 1 147 | M26 M15 1 148 | M60 M21 1 149 | M93 M23 1 150 | M96 M53 1 151 | M82 M95 1 152 | M5 M79 1 153 | M53 M95 1 154 | M75 M45 1 155 | M52 M98 1 156 | M49 M20 1 157 | M49 M63 1 158 | M52 M56 1 159 | M91 M11 1 160 | M23 M61 1 161 | M41 M12 1 162 | M67 M96 1 163 | M29 M68 1 164 | M60 M68 1 165 | M1 M28 1 166 | M56 M87 1 167 | M20 M96 1 168 | M47 M3 1 169 | M47 M72 1 170 | M28 M55 1 171 | M67 M82 1 172 | M48 M39 1 173 | M84 M86 1 174 | M9 M78 1 175 | M98 M2 1 176 | M73 M56 1 177 | M1 M93 1 178 | M38 M83 1 179 | M100 M50 1 180 | M78 M23 1 181 | M57 M41 1 182 | M8 M88 1 183 | M41 M30 1 184 | M58 M99 1 185 | M26 M57 1 186 | M15 M18 1 187 | M18 M32 1 188 | M38 M91 1 189 | M87 M36 1 190 | M33 M78 1 191 | M64 M88 1 192 | M94 M86 1 193 | M59 M84 1 194 | M91 M86 1 195 | M82 M66 1 196 | M84 M55 1 197 | M55 M61 1 198 | M68 M61 1 199 | M42 M85 1 200 | M2 M48 1 201 | M71 M93 1 202 | M21 M5 1 203 | M65 M19 1 204 | M69 M25 1 205 | M59 M31 1 206 | M35 M94 1 207 | M75 M77 1 208 | M51 M31 1 209 | M50 M65 1 210 | M5 M63 1 211 | M70 M28 1 212 | M54 M88 1 213 | M92 M78 1 214 | M24 M37 1 215 | M34 M40 1 216 | M37 M41 1 217 | M3 M83 1 218 | M40 M69 1 219 | M67 M60 1 220 | M67 M93 1 221 | M28 M12 1 222 | M13 M72 1 223 | M49 M51 1 224 | M18 M90 1 225 | M3 M12 1 226 | M32 M67 1 227 | M5 M65 1 228 | M75 M69 1 229 | M54 M17 1 230 | M20 M15 1 231 | M93 M95 1 232 | M21 M46 1 233 | M100 M34 1 234 | M22 M80 1 235 | M35 M71 1 236 | M24 M65 1 237 | M76 M96 1 238 | M61 M20 1 239 | M36 M95 1 240 | M37 M57 1 241 | M31 M71 1 242 | M35 M15 1 243 | M70 M15 1 244 | M41 M20 1 245 | M68 M41 1 246 | M8 M93 1 247 | M66 M56 1 248 | -------------------------------------------------------------------------------- /src/main/java/bunch/BunchFrame_AboutBox.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: BunchFrame_AboutBox.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:44 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:03 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.3 2001/04/03 23:32:12 bsmitc 11 | * Added NAHC (really HC) support for Distributed Bunch, updated release 12 | * version number to 3.2 13 | * 14 | * Revision 3.2 2001/04/02 19:23:39 bsmitc 15 | * *** empty log message *** 16 | * 17 | * Revision 3.1 2000/07/26 23:27:55 bsmitc 18 | * Changed about box to include updated copywrite date and CVS release tag 19 | * 20 | * Revision 3.0 2000/07/26 22:46:07 bsmitc 21 | * *** empty log message *** 22 | * 23 | * Revision 1.1.1.1 2000/07/26 22:43:33 bsmitc 24 | * Imported CVS Sources 25 | * 26 | * 27 | */ 28 | package bunch; 29 | 30 | import java.awt.*; 31 | import java.awt.event.*; 32 | import javax.swing.*; 33 | import javax.swing.border.*; 34 | 35 | /** 36 | * The class that displays the "About" dialog 37 | * 38 | * @author Brian Mitchell 39 | */ 40 | public 41 | class BunchFrame_AboutBox 42 | extends Dialog 43 | implements ActionListener{ 44 | JPanel panel1 = new JPanel(); 45 | JPanel panel2 = new JPanel(); 46 | JPanel insetsPanel1 = new JPanel(); 47 | JPanel insetsPanel2 = new JPanel(); 48 | JPanel insetsPanel3 = new JPanel(); 49 | JButton button1 = new JButton(); 50 | JLabel imageControl1 = new JLabel(); 51 | ImageIcon imageIcon; 52 | JLabel label1 = new JLabel(); 53 | JLabel label2 = new JLabel(); 54 | JLabel label3 = new JLabel(); 55 | JLabel label4 = new JLabel(); 56 | BorderLayout borderLayout1 = new BorderLayout(); 57 | BorderLayout borderLayout2 = new BorderLayout(); 58 | FlowLayout flowLayout1 = new FlowLayout(); 59 | FlowLayout flowLayout2 = new FlowLayout(); 60 | GridLayout gridLayout1 = new GridLayout(); 61 | String product = "Bunch 2.0 - JDK 1.2 Edition"; 62 | String version = ""; 63 | String copyright = "Copyright (c) 1999"; 64 | String comments = "Bunch Version 2.0"; 65 | JLabel jLabel1 = new JLabel(); 66 | JLabel jLabel2 = new JLabel(); 67 | JLabel jLabel3 = new JLabel(); 68 | JLabel jLabel4 = new JLabel(); 69 | 70 | public 71 | BunchFrame_AboutBox(Frame parent) 72 | { 73 | super(parent); 74 | enableEvents(AWTEvent.WINDOW_EVENT_MASK); 75 | try { 76 | jbInit(); 77 | } 78 | catch (Exception e) { 79 | e.printStackTrace(); 80 | } 81 | 82 | //imageControl1.setIcon(imageIcon); 83 | pack(); 84 | } 85 | 86 | private 87 | void 88 | jbInit() 89 | throws Exception 90 | { 91 | //imageIcon = new ImageIcon(getClass().getResource("your image name goes here")); 92 | this.setTitle("About"); 93 | setResizable(false); 94 | panel1.setLayout(borderLayout1); 95 | panel2.setLayout(borderLayout2); 96 | insetsPanel1.setLayout(flowLayout1); 97 | insetsPanel2.setLayout(flowLayout1); 98 | insetsPanel2.setBorder(new EmptyBorder(10, 10, 10, 10)); 99 | gridLayout1.setRows(8); 100 | gridLayout1.setColumns(1); 101 | label1.setText("Bunch 4.0.1 - April 2016"); 102 | label2.setText("Drexel University Software Engineering Group (SERG)"); 103 | label3.setText("Copyright (c) 1997-2016"); 104 | label4.setText("Bunch Edition 3D - JDK 1.8"); 105 | insetsPanel3.setLayout(gridLayout1); 106 | insetsPanel3.setBorder(new EmptyBorder(10, 60, 10, 10)); 107 | button1.setText("OK"); 108 | button1.addActionListener(this); 109 | jLabel3.setText("For Help and Documentation Please Visit:"); 110 | jLabel1.setText("CVS Release Tag: REL3-3"); 111 | jLabel4.setForeground(Color.blue); 112 | jLabel4.setText("http://serg.mcs.drexel.edu/bunch"); 113 | insetsPanel2.add(imageControl1, null); 114 | panel2.add(insetsPanel2, BorderLayout.WEST); 115 | this.add(panel1, null); 116 | insetsPanel3.add(label1, null); 117 | insetsPanel3.add(label2, null); 118 | insetsPanel3.add(label3, null); 119 | insetsPanel3.add(label4, null); 120 | insetsPanel3.add(jLabel1, null); 121 | insetsPanel3.add(jLabel2, null); 122 | insetsPanel3.add(jLabel3, null); 123 | insetsPanel3.add(jLabel4, null); 124 | panel2.add(insetsPanel3, BorderLayout.CENTER); 125 | insetsPanel1.add(button1, null); 126 | panel1.add(insetsPanel1, BorderLayout.SOUTH); 127 | panel1.add(panel2, BorderLayout.NORTH); 128 | } 129 | 130 | protected 131 | void 132 | processWindowEvent(WindowEvent e) 133 | { 134 | if (e.getID() == WindowEvent.WINDOW_CLOSING) { 135 | cancel(); 136 | } 137 | super.processWindowEvent(e); 138 | } 139 | 140 | void 141 | cancel() 142 | { 143 | dispose(); 144 | } 145 | 146 | public 147 | void 148 | actionPerformed(ActionEvent e) 149 | { 150 | if (e.getSource() == button1) { 151 | cancel(); 152 | } 153 | } 154 | } 155 | 156 | -------------------------------------------------------------------------------- /src/main/java/bunch/ClusterFileParser.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: ClusterFileParser.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:45 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:03 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.1 2000/08/09 14:17:47 bsmitc 11 | * Changes made to support agglomerative clustering feature. 12 | * 13 | * Revision 3.0 2000/07/26 22:46:08 bsmitc 14 | * *** empty log message *** 15 | * 16 | * Revision 1.1.1.1 2000/07/26 22:43:33 bsmitc 17 | * Imported CVS Sources 18 | * 19 | * 20 | */ 21 | package bunch; 22 | 23 | import java.util.*; 24 | 25 | /** 26 | * This class parses a file in SIL format and updates the provided graph 27 | * object. This object is often created from the parser factory. 28 | * 29 | * @see bunch.Parser 30 | * 31 | * @see http://serg.mcs.drexel.edu 32 | * 33 | * @author Brian Mitchell 34 | */ 35 | public 36 | class ClusterFileParser 37 | extends Parser 38 | { 39 | Graph graph_d; 40 | 41 | public 42 | ClusterFileParser() 43 | { 44 | } 45 | 46 | /** 47 | * This method sets the graph that will be updated according to the 48 | * specified cluster layout in the input SIL file. 49 | * 50 | * @param obj An instance of a Graph object. 51 | */ 52 | public 53 | void 54 | setObject(Object obj) 55 | { 56 | graph_d = (Graph)obj; 57 | } 58 | 59 | /** 60 | * This method returns the graph that is updated with clusters. 61 | * 62 | * @returns The updated graph after processing the SIL file. 63 | */ 64 | public 65 | Object 66 | getObject() 67 | { 68 | return graph_d; 69 | } 70 | 71 | /** 72 | * This is the parse method that reads the input file, sets up the clusters 73 | * and updates the graph accordingly. 74 | */ 75 | public 76 | Object 77 | parse() 78 | { 79 | int linecount = 0; 80 | Node[] nodes = graph_d.getNodes(); 81 | int[] clusters = graph_d.getClusters(); 82 | Vector clusterNames = new Vector(); 83 | 84 | try { 85 | /** 86 | * For each line... 87 | */ 88 | while (true) { 89 | String line = reader_d.readLine(); 90 | if (line == null) { 91 | break; 92 | } 93 | if (line.equals("")) { 94 | continue; 95 | } 96 | 97 | /** 98 | * parse the selected line. See if the first token is a comment 99 | */ 100 | StringTokenizer tok = new StringTokenizer(line, ", ="); 101 | String first = tok.nextToken(); 102 | if (first.charAt(0) == '/' && first.charAt(1) == '/') { //then its a comment, ignore 103 | continue; 104 | } 105 | 106 | /** 107 | * The next token is the cluster name 108 | */ 109 | StringTokenizer tok2 = new StringTokenizer(first, "()"); 110 | tok2.nextToken(); 111 | String cname = tok2.nextToken(); 112 | clusterNames.addElement(cname); 113 | 114 | /** 115 | * The remaining tokens hold the nodes in the clusters. 116 | */ 117 | while (tok.hasMoreTokens()) { 118 | String next = tok.nextToken(); 119 | if (next.charAt(0) == '/' && next.charAt(1) == '/') { //then its a comment, ignore 120 | --linecount; //to make sure the numbers are correct; 121 | break; 122 | } 123 | else 124 | for (int i=0; i nodeList = new ArrayList(); 157 | Node[] nodes = graph_d.getNodes(); 158 | 159 | //the cluster vector is initialized to -1 for all nodes 160 | //if a clusterid is -1 then something is wrong, as all nodes should be 161 | //specified in a cluster 162 | for (int i=0; i 18 | * Description:

19 | * Copyright: Copyright (c) Brian Mitchell

20 | * Company: Drexel University - SERG

21 | * @author Brian Mitchell 22 | * @version 1.0 23 | */ 24 | package bunch; 25 | 26 | import java.awt.*; 27 | import javax.swing.*; 28 | import java.awt.event.*; 29 | import java.util.*; 30 | 31 | public class SASimpleTechniqueDialog extends JDialog { 32 | JPanel panel1 = new JPanel(); 33 | GridBagLayout gridBagLayout1 = new GridBagLayout(); 34 | JLabel jLabel1 = new JLabel(); 35 | JTextField initialTempEF = new JTextField(); 36 | JLabel jLabel2 = new JLabel(); 37 | JTextField alphaEF = new JTextField(); 38 | JLabel DescriptionST = new JLabel(); 39 | JPanel jPanel1 = new JPanel(); 40 | JButton okPB = new JButton(); 41 | JButton cancelPB = new JButton(); 42 | 43 | SASimpleTechnique saTechnique = null; 44 | 45 | public SASimpleTechniqueDialog(Frame frame, String title, boolean modal) { 46 | super(frame, title, modal); 47 | try { 48 | jbInit(); 49 | pack(); 50 | } 51 | catch(Exception ex) { 52 | ex.printStackTrace(); 53 | } 54 | } 55 | 56 | public void setSATechnique(SASimpleTechnique s) 57 | { saTechnique = s; } 58 | 59 | public SASimpleTechniqueDialog() { 60 | this(null, "", false); 61 | } 62 | 63 | void jbInit() throws Exception { 64 | panel1.setLayout(gridBagLayout1); 65 | jLabel1.setText("Initial Temp. T(0):"); 66 | jLabel2.setText("Alpha:"); 67 | DescriptionST.setForeground(Color.red); 68 | DescriptionST.setText("Description:"); 69 | okPB.setText("OK"); 70 | okPB.addActionListener(new java.awt.event.ActionListener() { 71 | 72 | public void actionPerformed(ActionEvent e) { 73 | okPB_actionPerformed(e); 74 | } 75 | }); 76 | cancelPB.setText("Cancel"); 77 | cancelPB.addActionListener(new java.awt.event.ActionListener() { 78 | 79 | public void actionPerformed(ActionEvent e) { 80 | cancelPB_actionPerformed(e); 81 | } 82 | }); 83 | getContentPane().add(panel1, BorderLayout.CENTER); 84 | panel1.add(jLabel1, new GridBagConstraints(0, 0, 1, 1, 0.0, 0.0 85 | ,GridBagConstraints.CENTER, GridBagConstraints.NONE, new Insets(0, 10, 0, 10), 0, 0)); 86 | panel1.add(initialTempEF, new GridBagConstraints(1, 0, 1, 1, 0.0, 0.0 87 | ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 10), 155, 0)); 88 | panel1.add(jLabel2, new GridBagConstraints(0, 1, 1, 1, 0.0, 0.0 89 | ,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(5, 10, 0, 10), 0, 0)); 90 | panel1.add(alphaEF, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0 91 | ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 0, 10), 0, 0)); 92 | panel1.add(DescriptionST, new GridBagConstraints(0, 2, 2, 1, 0.0, 0.0 93 | ,GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL, new Insets(5, 10, 0, 0), 0, 0)); 94 | this.getContentPane().add(jPanel1, BorderLayout.SOUTH); 95 | jPanel1.add(okPB, null); 96 | jPanel1.add(cancelPB, null); 97 | 98 | DescriptionST.setText("Description Goes Here"); 99 | } 100 | 101 | public void setConfiguration(Hashtable h) 102 | { 103 | Double alpha = (Double)h.get(SASimpleTechnique.SET_ALPHA_KEY); 104 | Double temp = (Double)h.get(SASimpleTechnique.SET_INITIAL_TEMP_KEY); 105 | DescriptionST.setText(SASimpleTechnique.getDescription()); 106 | 107 | if((alpha==null)||(temp==null)) 108 | return; 109 | 110 | alphaEF.setText(alpha.toString()); 111 | initialTempEF.setText(temp.toString()); 112 | } 113 | 114 | public Hashtable getConfiguration() 115 | { 116 | Hashtable h = new Hashtable(); 117 | h.clear(); 118 | h.put(SASimpleTechnique.SET_ALPHA_KEY,new Double(alphaEF.getText())); 119 | h.put(SASimpleTechnique.SET_INITIAL_TEMP_KEY, new Double(initialTempEF.getText())); 120 | return h; 121 | } 122 | 123 | void okPB_actionPerformed(ActionEvent e) { 124 | setVisible(false); 125 | if(saTechnique != null) 126 | { 127 | Hashtable h = getConfiguration(); 128 | saTechnique.setConfig(h); 129 | } 130 | this.dispose(); 131 | } 132 | 133 | void cancelPB_actionPerformed(ActionEvent e) { 134 | this.dispose(); 135 | } 136 | } -------------------------------------------------------------------------------- /dot-examples/wu-ftpd-1.mdg: -------------------------------------------------------------------------------- 1 | ftpd setjmp 5 2 | acl stdlib 6 3 | extensions acl 13 4 | access signal 3 5 | ftpd socket 29 6 | realpath sigfix 2 7 | ftpcmd stdio 19 8 | access extensions 14 9 | access ctype 1 10 | paths ftpd 4 11 | rdservers netdb 2 12 | ftpd errno 10 13 | ftpcmd syslog 3 14 | ftpd signal 8 15 | paths stat 1 16 | ftpd sigfix 12 17 | ftpd fcntl 6 18 | acl ftpd 27 19 | bison proto 3 20 | extensions ftpcmd 2 21 | stat paths 2 22 | stat logwtmp 2 23 | bison glob 2 24 | ftpd stat 18 25 | acl stat 1 26 | conversions stdio 5 27 | realpath unistd 19 28 | realpath errno 2 29 | access errno 2 30 | ftpd acl 25 31 | rdservers ctype 1 32 | access unistd 29 33 | acl pathnames 1 34 | ftpcmd ftpd 50 35 | authenticate string 1 36 | extensions glob 3 37 | rdservers paths 3 38 | hostacc syslog 3 39 | conversions syslog 2 40 | realpath fcntl 2 41 | access fcntl 7 42 | bison unistd 1 43 | ftpd time 22 44 | ftpcmd stat 4 45 | bison inet 1 46 | ftpd access 29 47 | stat glob 5 48 | extensions popen 3 49 | private grp 5 50 | ftpd unistd 70 51 | realpath string 10 52 | acl access 17 53 | extensions syslog 3 54 | access string 41 55 | ftpcmd time 4 56 | ftpd libio 10 57 | bison string 8 58 | access grp 7 59 | popen resource 1 60 | ftpd string 166 61 | glob string 18 62 | ftpd hostacc 1 63 | ftpd shadow 4 64 | private errno 1 65 | extensions ftw 1 66 | acl string 7 67 | hostacc ftpd 3 68 | popen stdlib 3 69 | extensions bison 2 70 | ftpd stdio 77 71 | ftpd dirent 1 72 | COPYRIGHT stdio 1 73 | glob dirent 6 74 | glob popen 2 75 | bison acl 1 76 | access pathnames 1 77 | access pwd 4 78 | paths stdio 3 79 | ftpd ftp 4 80 | ftpd authenticate 1 81 | extensions grp 4 82 | access stdio 18 83 | ftpd in 15 84 | private stdlib 9 85 | bison realpath 1 86 | popen signal 5 87 | popen sigfix 2 88 | stat stdio 1 89 | paths socket 1 90 | logwtmp ftpd 3 91 | ftpd realpath 10 92 | ftpd conversions 3 93 | ftpcmd stdlib 4 94 | glob bison 1 95 | rdservers stdio 1 96 | popen fcntl 2 97 | logwtmp stat 1 98 | glob pwd 2 99 | ftpcmd setjmp 1 100 | extensions pwd 3 101 | ftpd grp 9 102 | private sigfix 2 103 | acl errno 1 104 | conversions pathnames 2 105 | logwtmp unistd 2 106 | popen unistd 13 107 | logwtmp time 1 108 | hostacc errno 1 109 | extensions errno 1 110 | authenticate ftpd 2 111 | private stdio 5 112 | ftpd COPYRIGHT 4 113 | hostacc stdlib 8 114 | conversions stdlib 7 115 | ftpcmd acl 3 116 | bison errno 1 117 | ftpcmd signal 1 118 | realpath ftpcmd 2 119 | popen glob 1 120 | ftpd extensions 31 121 | logwtmp string 1 122 | stat pathnames 1 123 | ftpd resource 1 124 | bison ftpcmd 65 125 | popen string 3 126 | paths pathnames 5 127 | extensions stdlib 25 128 | bison ftp 3 129 | paths unistd 1 130 | private unistd 7 131 | ftpd pwd 14 132 | ftpd ftpcmd 11 133 | access wu_fnmatch 3 134 | stat access 1 135 | glob ftpcmd 3 136 | access hostacc 3 137 | ftpd getopt 2 138 | bison ftpd 52 139 | acl extensions 13 140 | acl ftpcmd 6 141 | access syslog 10 142 | stat conversions 2 143 | paths string 5 144 | private string 10 145 | bison stat 3 146 | ftpcmd unistd 3 147 | extensions ftpd 84 148 | extensions regex 4 149 | ftpd glob 4 150 | glob errno 1 151 | bison syslog 1 152 | ftpcmd bison 14 153 | extensions wu_fnmatch 6 154 | realpath ftpd 36 155 | popen extensions 2 156 | stat ftpd 23 157 | paths inet 2 158 | extensions stat 7 159 | popen stdio 7 160 | ftpd select 2 161 | paths rdservers 1 162 | ftpd logwtmp 3 163 | ftpd syslog 23 164 | logwtmp fcntl 2 165 | conversions stat 1 166 | stat extensions 10 167 | bison time 1 168 | hostacc access 2 169 | realpath stat 2 170 | ftpd inet 10 171 | ftpcmd string 20 172 | ftpcmd glob 2 173 | acl syslog 2 174 | ftpd proto 3 175 | extensions time 13 176 | stat realpath 2 177 | acl stdio 5 178 | rdservers string 4 179 | hostacc stdio 5 180 | ftpcmd extensions 1 181 | extensions stdio 24 182 | extensions access 17 183 | stat dirent 1 184 | stat private 2 185 | extensions unistd 3 186 | rdservers inet 1 187 | private ftpd 5 188 | hostacc pathnames 2 189 | access proto 1 190 | hostacc string 8 191 | ftpcmd ctype 4 192 | conversions string 6 193 | private stat 1 194 | access ftpd 47 195 | ftpd popen 5 196 | realpath extensions 35 197 | popen wait 2 198 | access stat 14 199 | extensions string 78 200 | ftpcmd errno 1 201 | access time 3 202 | stat acl 2 203 | glob extensions 2 204 | bison in 1 205 | ftpd bison 16 206 | ftpd wait 2 207 | conversions errno 1 208 | access acl 17 209 | glob ftpd 12 210 | ftpd netdb 12 211 | logwtmp syslog 1 212 | realpath stdlib 3 213 | realpath bison 1 214 | access stdlib 32 215 | glob stat 3 216 | ftpcmd libio 4 217 | bison extensions 5 218 | stat ftpcmd 5 219 | bison stdlib 5 220 | access file 6 221 | popen ftpd 3 222 | paths netdb 2 223 | extensions realpath 13 224 | stat bison 1 225 | ftpd stdlib 61 226 | ftpd ctype 4 227 | glob stdlib 6 228 | paths syslog 1 229 | ftpd paths 2 230 | private syslog 3 231 | -------------------------------------------------------------------------------- /src/main/java/bunch/BunchPreferences.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: BunchPreferences.java,v $ 4 | * Revision 3.0 2002/02/03 18:41:44 bsmitc 5 | * Retag starting at 3.0 6 | * 7 | * Revision 1.1.1.1 2002/02/03 18:30:03 bsmitc 8 | * CVS Import 9 | * 10 | * Revision 3.0 2000/07/26 22:46:07 bsmitc 11 | * *** empty log message *** 12 | * 13 | * Revision 1.1.1.1 2000/07/26 22:43:33 bsmitc 14 | * Imported CVS Sources 15 | * 16 | * 17 | */ 18 | package bunch; 19 | 20 | /** 21 | * This class contains the settings used by Bunchv2. (Currently most of 22 | * the options are wired at compile time. However, the structure exists to 23 | * make this configuration loadable simply by providing a dialog box 24 | * that lets the user configure the options and then store them in a 25 | * java Serialized object) 26 | * 27 | * @author Brian Mitchell 28 | */ 29 | public 30 | class BunchPreferences 31 | implements java.io.Serializable 32 | { 33 | 34 | /** 35 | * The main entities for managing the clustering process are the clustering 36 | * method, objective function, parser and output factories. This class keeps 37 | * track as a global singleton of the factory instances. 38 | */ 39 | ClusteringMethodFactory methodFactory_d; 40 | ObjectiveFunctionCalculatorFactory calculatorFactory_d; 41 | ParserFactory parserFactory_d; 42 | GraphOutputFactory outputFactory_d; 43 | 44 | public static final long serialVersionUID = 100L; 45 | 46 | /** 47 | * class constructor. Create the factory objects. 48 | */ 49 | public 50 | BunchPreferences() 51 | { 52 | methodFactory_d = new ClusteringMethodFactory(); 53 | calculatorFactory_d = new ObjectiveFunctionCalculatorFactory(); 54 | parserFactory_d = new ParserFactory(); 55 | outputFactory_d = new GraphOutputFactory(); 56 | } 57 | 58 | /** 59 | * Sets the factory of clustering methods for this preferences object 60 | * 61 | * @param fac the new clustering method factory 62 | * @see #getClusteringMethodFactory() 63 | * @see bunch.ClusteringMethodFactory 64 | */ 65 | public 66 | void 67 | setClusteringMethodFactory(ClusteringMethodFactory fac) 68 | { 69 | methodFactory_d = fac; 70 | } 71 | 72 | /** 73 | * Obtains the factory of Clustering Methods set to this preferences object 74 | * 75 | * @return the clustering method factory 76 | * @see #setClusteringMethodFactory(bunch.ClusteringMethodFactory) 77 | * @see bunch.ClusteringMethodFactory 78 | */ 79 | public 80 | ClusteringMethodFactory 81 | getClusteringMethodFactory() 82 | { 83 | return methodFactory_d; 84 | } 85 | 86 | /** 87 | * Sets the factory of objective function calculator objects for this preferences object 88 | * 89 | * @param fac the new OF Calculator method factory 90 | * @see #getObjectiveFunctionCalculatorFactory() 91 | * @see bunch.ObjectiveFunctionCalculatorFactory 92 | */ 93 | public 94 | void 95 | setObjectiveFunctionCalculatorFactory(ObjectiveFunctionCalculatorFactory fac) 96 | { 97 | calculatorFactory_d = fac; 98 | } 99 | 100 | /** 101 | * Obtains the factory of objective function calculator 102 | * methods set to this preferences object 103 | * 104 | * @return the OF Calculator method factory 105 | * @see #setObjectiveFunctionCalculatorFactory(bunch.ObjectiveFunctionCalculatorFactory) 106 | * @see bunch.ObjectiveFunctionCalculatorFactory 107 | */ 108 | public 109 | ObjectiveFunctionCalculatorFactory 110 | getObjectiveFunctionCalculatorFactory() 111 | { 112 | return calculatorFactory_d; 113 | } 114 | 115 | /** 116 | * Sets the factory of parsers for this preferences object 117 | * 118 | * @param fac the new parser factory 119 | * @see #getParserFactory() 120 | * @see bunch.ParserFactory 121 | */ 122 | public 123 | void 124 | setParserFactory(ParserFactory fac) 125 | { 126 | parserFactory_d = fac; 127 | } 128 | 129 | /** 130 | * Obtains the factory of parsers set to this preferences object 131 | * 132 | * @return the parser factory 133 | * @see #setParserFactory(bunch.ParserFactory) 134 | * @see bunch.ParserFactory 135 | */ 136 | public 137 | ParserFactory 138 | getParserFactory() 139 | { 140 | return parserFactory_d; 141 | } 142 | 143 | /** 144 | * Obtains the factory of output methods set to this preferences object 145 | * 146 | * @return the graph output method factory 147 | * @see #setGraphOutputFactory(bunch.GraphOutputFactory) 148 | * @see bunch.GraphOutputFactory 149 | */ 150 | public 151 | GraphOutputFactory 152 | getGraphOutputFactory() 153 | { 154 | return outputFactory_d; 155 | } 156 | 157 | /** 158 | * Sets the factory of graph output objects for this preferences object 159 | * 160 | * @param fac the new graph output object factory 161 | * @see #getGraphOutputFactory() 162 | * @see bunch.GraphOutputFactory 163 | */ 164 | public 165 | void 166 | setGraphOutputFactory(GraphOutputFactory og) 167 | { 168 | outputFactory_d = og; 169 | } 170 | } 171 | -------------------------------------------------------------------------------- /src/main/java/bunch/LoadBalancer/Manager.java: -------------------------------------------------------------------------------- 1 | /**** 2 | * 3 | * $Log: Manager.java,v $ 4 | * Revision 1.1.1.1 2002/02/03 18:30:06 bsmitc 5 | * CVS Import 6 | * 7 | * Revision 1.1.1.1 2000/07/26 22:43:34 bsmitc 8 | * Imported CVS Sources 9 | * 10 | * 11 | */ 12 | 13 | /** 14 | * Title: Bunch Version 1.2 Base

15 | * Description: Your description

16 | * Copyright: Copyright (c) 1999

17 | * Company:

18 | * @author Brian Mitchell 19 | * @version 20 | */ 21 | package bunch.LoadBalancer; 22 | 23 | import java.util.*; 24 | 25 | public class Manager { 26 | 27 | public final static int RE_EVAL_FREQ = 50; 28 | public final static double ADJUSTMENT_THRESHOLD = 0.15; 29 | public final static int MAX_WORK_MULTIPLIER = 10; 30 | public final static int STABILITY_THRESHOLD = 5; 31 | 32 | public int baseUOWSz = 5; 33 | public int minUOWSz = baseUOWSz; 34 | public int maxUOWSz = baseUOWSz * 10; 35 | public boolean useAdaptiveAlg = true; 36 | 37 | int stabilityCounter = 0; 38 | 39 | 40 | Hashtable svrList = new Hashtable(); 41 | 42 | ServerStats [] ssArray = null; 43 | int svrCount = 0; 44 | int reEvalTracker = 0; 45 | 46 | public Manager() { 47 | } 48 | 49 | public int createNewServer() 50 | { 51 | ServerStats ss = new ServerStats(); 52 | ss.svrID = svrCount; 53 | ss.currUOWSz = baseUOWSz; 54 | 55 | //System.out.println("Server base unit of work size is: "+ss.currUOWSz); 56 | 57 | svrCount++; 58 | 59 | //This might seem inefficient to reconstruct the array everytime, but 60 | //array lookups will be faster than object lookups at runtime (I hope) 61 | 62 | ServerStats [] tmpSSArray = new ServerStats[svrCount]; 63 | if (ssArray != null) 64 | System.arraycopy(ssArray,0,tmpSSArray,0,ssArray.length); 65 | 66 | tmpSSArray[ss.svrID] = ss; 67 | 68 | ssArray = tmpSSArray; 69 | 70 | return ss.svrID; 71 | } 72 | 73 | public boolean incrementWork(int sid) 74 | { 75 | ServerStats ss = ssArray[sid]; 76 | ss.totalWork++; 77 | ss.workSinceLastAdjustment++; 78 | reEvalTracker++; 79 | 80 | if(reEvalTracker >= RE_EVAL_FREQ) 81 | { 82 | reEvalTracker = 0; 83 | return adaptiveUpdate(); 84 | } 85 | return true; 86 | } 87 | 88 | private boolean adaptiveUpdate() 89 | { 90 | if(ssArray == null) 91 | return false; 92 | 93 | int workCounter = 0; 94 | int totalServers = ssArray.length; 95 | 96 | if(totalServers == 0) 97 | return false; 98 | 99 | if(totalServers == 1) 100 | { 101 | ssArray[0].workSinceLastAdjustment = 0; 102 | return true; 103 | } 104 | 105 | boolean madeAdjustments = false; 106 | 107 | double avgExpectedWork = (double)RE_EVAL_FREQ / (double)totalServers; 108 | 109 | for(int i = 0; i < totalServers; i++) 110 | { 111 | double pctAdjustment = (double)(ssArray[i].workSinceLastAdjustment)/avgExpectedWork; 112 | int uowSz = ssArray[i].currUOWSz; 113 | 114 | //now govern if speedup is necessary 115 | if (pctAdjustment >= (1.0 + ADJUSTMENT_THRESHOLD)) 116 | pctAdjustment = 1.0 + ADJUSTMENT_THRESHOLD; 117 | 118 | //now govern if slowdown is necessary 119 | if (pctAdjustment <= (1.0 - ADJUSTMENT_THRESHOLD)) 120 | pctAdjustment = 1.0 - ADJUSTMENT_THRESHOLD; 121 | 122 | int newUOWSz = (int)((double)(uowSz)*pctAdjustment); 123 | 124 | if (newUOWSz == uowSz) 125 | if(pctAdjustment > 1.0) 126 | newUOWSz++; 127 | else if(pctAdjustment < 1.0) 128 | newUOWSz--; 129 | 130 | //now check for bounds 131 | if(newUOWSz < baseUOWSz) 132 | newUOWSz = baseUOWSz; 133 | 134 | if(newUOWSz > (baseUOWSz * this.MAX_WORK_MULTIPLIER)) 135 | newUOWSz = (baseUOWSz * this.MAX_WORK_MULTIPLIER); 136 | 137 | //debug message 138 | if(uowSz != newUOWSz) 139 | { 140 | madeAdjustments = true; 141 | 142 | // System.out.println("Adjusting work for server id: " + 143 | // ssArray[i].svrID+" from " + uowSz + " to " + newUOWSz); 144 | } 145 | 146 | ssArray[i].workSinceLastAdjustment = 0; 147 | ssArray[i].currUOWSz = newUOWSz; 148 | } 149 | 150 | if(madeAdjustments == false) 151 | { 152 | stabilityCounter++; 153 | if(stabilityCounter >= this.STABILITY_THRESHOLD) 154 | { 155 | stabilityCounter = 0; 156 | for(int i = 0; i < totalServers; i++) 157 | { 158 | ssArray[i].currUOWSz++; 159 | // System.out.println("Just adjusted all servers up 1 to break stalemate"); 160 | } 161 | } 162 | } 163 | else 164 | { 165 | stabilityCounter = 0; 166 | } 167 | return true; 168 | } 169 | 170 | public int getCurrentUOWSz(int sid) 171 | { 172 | ServerStats ss = ssArray[sid]; 173 | return ss.currUOWSz; 174 | } 175 | 176 | 177 | 178 | 179 | } -------------------------------------------------------------------------------- /src/main/java/bunch/api/BunchStatsTest.java: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * Title: Bunch Project

4 | * Description:

5 | * Copyright: Copyright (c) Brian Mitchell

6 | * Company: Drexel University - SERG

7 | * @author Brian Mitchell 8 | * @version 1.0 9 | */ 10 | 11 | /**** 12 | * 13 | * $Log: BunchStatsTest.java,v $ 14 | * Revision 1.1.1.1 2002/02/03 18:30:05 bsmitc 15 | * CVS Import 16 | * 17 | * Revision 3.0 2000/10/22 16:14:01 bsmitc 18 | * Changed version number to 3.0 to sync with rest of project 19 | * 20 | * Revision 1.1.1.1 2000/10/22 16:05:57 bsmitc 21 | * Initial Version 22 | * 23 | * 24 | */ 25 | package bunch.api; 26 | 27 | import java.util.*; 28 | import java.io.*; 29 | 30 | public class BunchStatsTest { 31 | 32 | public BunchStatsTest() 33 | { 34 | //runStatsTest(); 35 | checkGraphTest(); 36 | } 37 | 38 | public void checkGraphTest() 39 | { 40 | try 41 | { 42 | String filename = "d:\\proj\\bunch\\examples\\bison"; //"e:\\incl"; 43 | bunch.BunchPreferences pref = (bunch.BunchPreferences)(java.beans.Beans.instantiate(null, "bunch.BunchPreferences")); 44 | 45 | bunch.Parser p = pref.getParserFactory().getParser("dependency"); 46 | p.setInput(filename); 47 | p.setDelims(" \t"); 48 | bunch.Graph g = (bunch.Graph)p.parse(); 49 | 50 | String objFnCalc = "bunch.TurboMQIncrW"; 51 | (pref.getObjectiveFunctionCalculatorFactory()).setCurrentCalculator(objFnCalc); 52 | bunch.Graph.setObjectiveFunctionCalculatorFactory(pref.getObjectiveFunctionCalculatorFactory()); 53 | g.setObjectiveFunctionCalculator(objFnCalc); 54 | 55 | if(g == null) 56 | { 57 | System.out.println("The graph is null"); 58 | return; 59 | } 60 | 61 | for(int i = 0; i < 100; i++) 62 | { 63 | int [] clusterV = g.genRandomClusterSize(); //.getRandomCluster(); 64 | bunch.Cluster c = new bunch.Cluster(g,clusterV); 65 | System.out.println("NumClusters = "+c.getClusterNames().length+" MQ Value = "+c.getObjFnValue()); 66 | } 67 | 68 | }catch(Exception ex) 69 | { ex.printStackTrace(); } 70 | } 71 | 72 | 73 | 74 | public void runStatsTest() { 75 | 76 | String fileName = "e:\\bunchstats.txt"; 77 | 78 | try{ 79 | BufferedWriter writer_d = new BufferedWriter(new FileWriter(fileName)); 80 | double mqAccum = 0.0; 81 | int testRuns = 0; 82 | String header = "Run Number, Runtime(ms), Best MQ, Depth, Number of Clusters, MQ Evaluations, SA Neighbors Taken"; 83 | System.out.println(header); 84 | writer_d.write(header+"\r\n"); 85 | 86 | for(int i = 0; i < 100; i++) 87 | { 88 | BunchAPI api = new BunchAPI(); 89 | BunchProperties bp = new BunchProperties(); 90 | bp.setProperty(BunchProperties.MDG_INPUT_FILE_NAME,"e:\\incl"); 91 | bp.setProperty(BunchProperties.OUTPUT_FORMAT,BunchProperties.NULL_OUTPUT_FORMAT); 92 | 93 | bp.setProperty(BunchProperties.CLUSTERING_ALG,BunchProperties.ALG_NAHC); 94 | bp.setProperty(BunchProperties.ALG_NAHC_HC_PCT,"1"); 95 | //bp.setProperty(BunchProperties.ALG_NAHC_RND_PCT,"20"); 96 | //bp.setProperty(BunchProperties.ALG_NAHC_SA_CLASS,"bunch.SASimpleTechnique"); 97 | //bp.setProperty(BunchProperties.ALG_NAHC_SA_CONFIG,"InitialTemp=179.0,Alpha=0.995"); 98 | //bp.setProperty(BunchProperties.ALG_NAHC_SA_CONFIG,"InitialTemp=1.0,Alpha=0.85"); 99 | 100 | api.setProperties(bp); 101 | 102 | api.run(); 103 | 104 | Hashtable results = api.getResults(); 105 | 106 | String rt = (String)results.get(BunchAPI.RUNTIME); 107 | String evals = (String)results.get(BunchAPI.MQEVALUATIONS); 108 | String levels = (String)results.get(BunchAPI.TOTAL_CLUSTER_LEVELS); 109 | String saMovesTaken = (String)results.get(BunchAPI.SA_NEIGHBORS_TAKEN); 110 | 111 | Hashtable [] resultLevels = (Hashtable[])results.get(BunchAPI.RESULT_CLUSTER_OBJS); 112 | 113 | String mq = "null"; 114 | String depth="null"; 115 | String numC="null"; 116 | if(resultLevels.length>=1) 117 | { 118 | Hashtable lvlResults = resultLevels[0]; 119 | mq = (String)lvlResults.get(BunchAPI.MQVALUE); 120 | depth = (String)lvlResults.get(BunchAPI.CLUSTER_DEPTH); 121 | numC = (String)lvlResults.get(BunchAPI.NUMBER_CLUSTERS); 122 | } 123 | 124 | String outString = i+","+rt+","+mq+","+depth+","+numC+","+evals+","+saMovesTaken; 125 | System.out.println(outString); 126 | writer_d.write(outString+"\r\n"); 127 | testRuns++; 128 | mqAccum+= Double.parseDouble(mq); 129 | } 130 | writer_d.close(); 131 | System.out.println(); 132 | System.out.println("***** Average MQ = " + (mqAccum/((double)testRuns))); 133 | 134 | } 135 | catch(Exception e) { e.printStackTrace(); } 136 | } 137 | 138 | public static void main(String[] args) { 139 | BunchStatsTest bunchStatsTest1 = new BunchStatsTest(); 140 | } 141 | } -------------------------------------------------------------------------------- /dot-examples/php.mdg: -------------------------------------------------------------------------------- 1 | php_open_temporary_file zend_alloc 3 2 | main syslog 1 3 | stat fopen_wrappers 4 4 | php_ini zend_alloc 11 5 | stat safe_mode 3 6 | mergesort stdlib 3 7 | rfc1867 zend 3 8 | php_ini zend 2 9 | main zend_hash 4 10 | main zend_API 7 11 | SAPI php_content_types 2 12 | fopen_wrappers php_ini 2 13 | php_globals rfc1867 4 14 | zend_operators stdlib 40 15 | php_ini dl 1 16 | php_ini php_output 2 17 | zend_execute zend_alloc 39 18 | strlcat string 1 19 | main locale 1 20 | main php_variables 3 21 | php_ini php_globals 3 22 | php_variables rfc1867 6 23 | php_variables string 21 24 | php_ini zend_variables 4 25 | fopen_wrappers stdio 8 26 | zend_execute zend_variables 3 27 | rfc1867 SAPI 6 28 | php_logos logos 6 29 | php_content_types string 1 30 | SAPI stdlib 2 31 | rfc1867 php_variables 2 32 | main php_ini 5 33 | fopen_wrappers stdlib 1 34 | php_ticks php_globals 5 35 | main time 8 36 | fopen_wrappers stat 2 37 | fopen_wrappers zend_hash 5 38 | zend_execute zend_globals_macros 139 39 | rfc1867 zend_alloc 9 40 | fopen_wrappers zend_alloc 11 41 | SAPI internal_functions 2 42 | SAPI zend_globals_macros 1 43 | main zend_list 2 44 | fopen_wrappers safe_mode 3 45 | SAPI zend_alloc 29 46 | rfc1867 stdio 4 47 | mergesort string 1 48 | main php_globals 20 49 | main php_ticks 4 50 | fopen_wrappers strlcpy 1 51 | fopen_wrappers main 5 52 | php_open_temporary_file rfc1867 1 53 | strlcpy fopen_wrappers 2 54 | php_content_types zend_hash 2 55 | php_ini zend_ini 1 56 | SAPI php_output 4 57 | safe_mode unistd 1 58 | main stdlib 4 59 | php_ini stdio 1 60 | php_globals zend_globals_macros 1 61 | main setjmp 3 62 | stat stdio 1 63 | fopen_wrappers unistd 3 64 | main zend 10 65 | php_string string 6 66 | php_ticks zend_llist 5 67 | zend_operators errno 1 68 | main credits 1 69 | main zend_operators 1 70 | php_variables zend_hash 3 71 | safe_mode string 5 72 | main zend_execute 6 73 | php_ini zend_llist 4 74 | php_variables php 2 75 | php_variables zend_API 2 76 | main zend_compile 9 77 | fopen_wrappers zend 4 78 | SAPI string 23 79 | SAPI ctype 3 80 | fopen_wrappers string 25 81 | rfc1867 type 2 82 | network zend_alloc 4 83 | zend_globals_macros stdlib 1 84 | php_variables main 1 85 | php_logos stdlib 3 86 | php_open_temporary_file stdlib 5 87 | php_open_temporary_file stdio 3 88 | safe_mode stat 2 89 | php_ini info 3 90 | main SAPI 20 91 | php_content_types zend_variables 1 92 | safe_mode fopen_wrappers 7 93 | php_variables zend_alloc 14 94 | php_ini stdlib 3 95 | SAPI php_variables 1 96 | main internal_functions 4 97 | main unistd 2 98 | safe_mode pageinfo 2 99 | fopen_wrappers SAPI 4 100 | fopen_wrappers pwd 2 101 | php_ini zend_extensions 1 102 | main stdio 13 103 | strlcat SAPI 5 104 | mergesort errno 1 105 | php_content_types SAPI 6 106 | php_globals zend_alloc 1 107 | safe_mode zend_alloc 1 108 | php_logos php_output 1 109 | php_variables zend 1 110 | zend_globals_macros main 3 111 | main string 22 112 | rfc1867 php_open_temporary_file 2 113 | SAPI php_logos 2 114 | network in 3 115 | rfc1867 stdlib 2 116 | php_ini zend_highlight 1 117 | php_globals main 2 118 | php_ini zend_operators 2 119 | main zend_ini 8 120 | main zend_constants 1 121 | php_variables url 4 122 | SAPI zend_llist 5 123 | php_variables zend_globals_macros 6 124 | zend_globals_macros php_content_types 1 125 | main zend_extensions 1 126 | SAPI stat 1 127 | php_variables php_string 4 128 | php_globals php_variables 1 129 | php_variables SAPI 6 130 | fopen_wrappers tsrm_virtual_cwd 2 131 | php_logos string 6 132 | safe_mode zend 2 133 | safe_mode zend_hash 1 134 | main php_main 1 135 | php_open_temporary_file string 1 136 | network socket 3 137 | zend_execute zend 1 138 | php_variables php_globals 5 139 | main fsock 2 140 | fopen_wrappers php_globals 15 141 | SAPI stdio 1 142 | rfc1867 zend_globals_macros 3 143 | network netdb 4 144 | main fopen_wrappers 5 145 | rfc1867 php_globals 10 146 | main base64 2 147 | zend_operators mathcalls 1 148 | php_ini string 7 149 | php_ticks string 2 150 | php_variables zend_variables 1 151 | SAPI main 3 152 | php_ini zend_globals_macros 1 153 | rfc1867 unistd 2 154 | network zend 2 155 | main php_logos 3 156 | main zend_alloc 26 157 | php_open_temporary_file php_globals 1 158 | php_logos SAPI 2 159 | safe_mode SAPI 4 160 | internal_functions main 3 161 | fopen_wrappers ctype 1 162 | zend_globals_macros SAPI 1 163 | zend_globals_macros zend_execute 76 164 | SAPI fopen_wrappers 1 165 | strlcpy SAPI 1 166 | rfc1867 string 35 167 | SAPI zend_hash 5 168 | SAPI rfc1867 1 169 | network unistd 1 170 | php_ini zend_hash 9 171 | main tsrm_virtual_cwd 1 172 | main php_output 11 173 | php_globals php_ini 2 174 | main zend_globals_macros 27 175 | rfc1867 zend_API 1 176 | php_content_types zend_alloc 4 177 | SAPI safe_mode 1 178 | main zend_variables 1 179 | SAPI zend 1 180 | fopen_wrappers errno 1 181 | SAPI strlcat 2 182 | php_ini main 3 183 | network string 1 184 | rfc1867 zend_hash 7 185 | php_content_types zend_globals_macros 3 186 | zend_execute zend_hash 20 187 | stat SAPI 2 188 | php_logos zend_hash 5 189 | safe_mode pwd 2 190 | main php_content_types 1 191 | php_ini fopen_wrappers 2 192 | --------------------------------------------------------------------------------