public static void main(String[] args){
  Log.printLine("Starting ContainerCloudSimExample1...");
  try {
    int num_user=1;
    Calendar calendar=Calendar.getInstance();
    boolean trace_flag=false;
    CloudSim.init(num_user,calendar,trace_flag);
    ContainerAllocationPolicy containerAllocationPolicy=new PowerContainerAllocationPolicySimple();
    PowerContainerVmSelectionPolicy vmSelectionPolicy=new PowerContainerVmSelectionPolicyMaximumUsage();
    HostSelectionPolicy hostSelectionPolicy=new HostSelectionPolicyFirstFit();
    double overUtilizationThreshold=0.80;
    double underUtilizationThreshold=0.70;
    hostList=new ArrayList<ContainerHost>();
    hostList=createHostList(ConstantsExamples.NUMBER_HOSTS);
    cloudletList=new ArrayList<ContainerCloudlet>();
    vmList=new ArrayList<ContainerVm>();
    ContainerVmAllocationPolicy vmAllocationPolicy=new PowerContainerVmAllocationPolicyMigrationAbstractHostSelection(hostList,vmSelectionPolicy,hostSelectionPolicy,overUtilizationThreshold,underUtilizationThreshold);
    int overBookingFactor=80;
    ContainerDatacenterBroker broker=createBroker(overBookingFactor);
    int brokerId=broker.getId();
    cloudletList=createContainerCloudletList(brokerId,ConstantsExamples.NUMBER_CLOUDLETS);
    containerList=createContainerList(brokerId,ConstantsExamples.NUMBER_CLOUDLETS);
    vmList=createVmList(brokerId,ConstantsExamples.NUMBER_VMS);
    String logAddress="~/Results";
    @SuppressWarnings("unused") PowerContainerDatacenter e=(PowerContainerDatacenter)createDatacenter("datacenter",PowerContainerDatacenterCM.class,hostList,vmAllocationPolicy,containerAllocationPolicy,getExperimentName("ContainerCloudSimExample-1",String.valueOf(overBookingFactor)),ConstantsExamples.SCHEDULING_INTERVAL,logAddress,ConstantsExamples.VM_STARTTUP_DELAY,ConstantsExamples.CONTAINER_STARTTUP_DELAY);
    broker.submitCloudletList(cloudletList.subList(0,containerList.size()));
    broker.submitContainerList(containerList);
    broker.submitVmList(vmList);
    CloudSim.terminateSimulation(86400.00);
    CloudSim.startSimulation();
    CloudSim.stopSimulation();
    List<ContainerCloudlet> newList=broker.getCloudletReceivedList();
    printCloudletList(newList);
    Log.printLine("ContainerCloudSimExample1 finished!");
  }
 catch (  Exception e) {
    e.printStackTrace();
    Log.printLine("Unwanted errors happen");
  }
}

public static void main ( String [ ] args ) { Log . printLine ( "Starting ContainerCloudSimExample1..." ) ; try { int num_user = 1 ; Calendar calendar = Calendar . getInstance ( ) ; boolean trace_flag = false ; CloudSim . init ( num_user , calendar , trace_flag ) ; ContainerAllocationPolicy containerAllocationPolicy = new PowerContainerAllocationPolicySimple ( ) ; PowerContainerVmSelectionPolicy vmSelectionPolicy = new PowerContainerVmSelectionPolicyMaximumUsage ( ) ; HostSelectionPolicy hostSelectionPolicy = new HostSelectionPolicyFirstFit ( ) ; double overUtilizationThreshold = 0.80 ; double underUtilizationThreshold = 0.70 ; hostList = new ArrayList < ContainerHost > ( ) ; hostList = createHostList ( ConstantsExamples . NUMBER_HOSTS ) ; cloudletList = new ArrayList < ContainerCloudlet > ( ) ; vmList = new ArrayList < ContainerVm > ( ) ; ContainerVmAllocationPolicy vmAllocationPolicy = new PowerContainerVmAllocationPolicyMigrationAbstractHostSelection ( hostList , vmSelectionPolicy , hostSelectionPolicy , overUtilizationThreshold , underUtilizationThreshold ) ; int overBookingFactor = 80 ; ContainerDatacenterBroker broker = createBroker ( overBookingFactor ) ; int brokerId = broker . getId ( ) ; cloudletList = createContainerCloudletList ( brokerId , ConstantsExamples . NUMBER_CLOUDLETS ) ; containerList = createContainerList ( brokerId , ConstantsExamples . NUMBER_CLOUDLETS ) ; vmList = createVmList ( brokerId , ConstantsExamples . NUMBER_VMS ) ; String logAddress = "~/Results" ; @ SuppressWarnings ( "unused" ) PowerContainerDatacenter e = ( PowerContainerDatacenter ) createDatacenter ( "datacenter" , PowerContainerDatacenterCM . class , hostList , vmAllocationPolicy , containerAllocationPolicy , getExperimentName ( "ContainerCloudSimExample-1" , String . valueOf ( overBookingFactor ) ) , ConstantsExamples . SCHEDULING_INTERVAL , logAddress , ConstantsExamples . VM_STARTTUP_DELAY , ConstantsExamples . CONTAINER_STARTTUP_DELAY ) ; broker . submitCloudletList ( cloudletList . subList ( 0 , containerList . size ( ) ) ) ; broker . submitContainerList ( containerList ) ; broker . submitVmList ( vmList ) ; CloudSim . terminateSimulation ( 86400.00 ) ; CloudSim . startSimulation ( ) ; CloudSim . stopSimulation ( ) ; List < ContainerCloudlet > newList = broker . getCloudletReceivedList ( ) ; printCloudletList ( newList ) ; Log . printLine ( "ContainerCloudSimExample1 finished!" ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; Log . printLine ( "Unwanted errors happen" ) ; } }
creates main ( ) to run this example .
