首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Eclipse开发 >

关于网格的经济模型调度算法,该如何处理

2012-05-16 
关于网格的经济模型调度算法我用visualmodeler自动生成的Java代码在eclipse中运行的时候老是出错。我做的是

关于网格的经济模型调度算法
我用visualmodeler自动生成的Java代码在eclipse中运行的时候老是出错。我做的是关于网格的基于经济模型调度的算法,这里我只是用了一个用户和一个资源。代码如下:
  // This file is auto-generated by VisualModeler.
// Created on Fri Jun 04 14:52:07 GMT 2010

import java.util.*;
import gridsim.*;
import gridbroker.*;

public class cost 
{

  public static void main(String[] args)
  {

  try
  {
  Calendar calendar = Calendar.getInstance();
  Random random;
  long seed = 11L*13*17*19*23+1;
  seed = seed * 97 + 1;

  String[] eff = {""};
  String[] efp = {""};
  String[] category = { "*.USER.GridletCompletion",
  "*.USER.TimeUtilization", "*.USER.BudgetUtilization" };

  String ReportWriterName = "ReportWritercost";

  // Initializing GridSim for 1 grid users and 1 grid resources
  GridSim.init(1, calendar, true, eff, efp, ReportWriterName);

  // Creates Report Writer entity
  new ReportWriter(ReportWriterName, 1, 1, "reportFilecost",
  category, false, null, true, 10000);


  // The starting point of creating Grid Resource entities
  LinkedList Weekends = new LinkedList();
  Weekends.add(new Integer(Calendar.SATURDAY));
  Weekends.add(new Integer(Calendar.SUNDAY));
  LinkedList Holidays = new LinkedList();

  PEList peList; // A list of PEs (Processing Elements)
  MachineList mList; // A list of Machine entities
  ResourceCharacteristics resConfig;
  GridResource gridRes; // A GridResource entity

  String[] resourceNameList = { 
  "Resource_1",  
  };

  ///////// Create Resource_1
  mList = new MachineList();// A list of Machines

  peList = new PEList(); // A list of PEs
  peList.add( new PE(0, 472) );
  peList.add( new PE(1, 472) );
  peList.add( new PE(2, 472) );
  peList.add( new PE(3, 472) );
  peList.add( new PE(4, 472) );
  peList.add( new PE(5, 472) );
  peList.add( new PE(6, 472) );
  peList.add( new PE(7, 472) );
  peList.add( new PE(8, 472) );
  peList.add( new PE(9, 472) );
  peList.add( new PE(10, 472) );
  peList.add( new PE(11, 472) );
  peList.add( new PE(12, 472) );
  peList.add( new PE(13, 472) );
  peList.add( new PE(14, 472) );
  peList.add( new PE(15, 472) );
  peList.add( new PE(16, 472) );
  peList.add( new PE(17, 472) );
  peList.add( new PE(18, 472) );
  peList.add( new PE(19, 472) );

  // Adding a new Machine into the list
  mList.add( new Machine(0, peList) );


  peList = new PEList(); // A list of PEs
  peList.add( new PE(0, 389) );
  peList.add( new PE(1, 389) );
  peList.add( new PE(2, 389) );
  peList.add( new PE(3, 389) );
  peList.add( new PE(4, 389) );
  peList.add( new PE(5, 389) );
  peList.add( new PE(6, 389) );


  peList.add( new PE(7, 389) );
  peList.add( new PE(8, 389) );
  peList.add( new PE(9, 389) );
  peList.add( new PE(10, 389) );

  // Adding a new Machine into the list
  mList.add( new Machine(1, peList) );


  peList = new PEList(); // A list of PEs
  peList.add( new PE(0, 58) );
  peList.add( new PE(1, 58) );
  peList.add( new PE(2, 58) );
  peList.add( new PE(3, 58) );
  peList.add( new PE(4, 58) );
  peList.add( new PE(5, 58) );
  peList.add( new PE(6, 58) );
  peList.add( new PE(7, 58) );
  peList.add( new PE(8, 58) );
  peList.add( new PE(9, 58) );
  peList.add( new PE(10, 58) );
  peList.add( new PE(11, 58) );
  peList.add( new PE(12, 58) );
  peList.add( new PE(13, 58) );
  peList.add( new PE(14, 58) );

  // Adding a new Machine into the list
  mList.add( new Machine(2, peList) );


  peList = new PEList(); // A list of PEs
  peList.add( new PE(0, 43) );
  peList.add( new PE(1, 43) );
  peList.add( new PE(2, 43) );

  // Adding a new Machine into the list
  mList.add( new Machine(3, peList) );


  // Creates a new ResourceCharacteristics entity
  resConfig = new ResourceCharacteristics("Compaq AlphaServer", "OSF1",
  mList, 0, 5.0, 3.0);

  // Creates a new GridResource entity
  gridRes = new GridResource("Resource_1", 100.0, seed*(1+1)+1,
  resConfig, 0.6, 0.4, 0.3, Weekends, Holidays);


  // The starting point of creating Grid user entities
  GridletList glList; // A list of Gridlets or jobs
  Experiment expt;
  UserEntity userEntity;
  int count = 0;

  ///////// Create User_1
  random = new Random(seed*997*(1+1)+1);
  glList = new GridletList();
  count = (int) GridSimRandom.real(200, 0.095, 0.071, random.nextDouble());

  // A loop that creates new Gridlets
  for (int i = 0; i < count; i++) {
  double len = GridSimRandom.real(10000, 0.043, 0.08800000000000001, random.nextDouble());

  long file = (long) GridSimRandom.real(19, 0.031, 0.096, random.nextDouble());

  long out = (long) GridSimRandom.real(41, 0.077, 0.07200000000000001, random.nextDouble());

  // Creates a new Gridlet entity 
  Gridlet gl = new Gridlet(i, len, file, out);
  glList.add(gl); // Adds a new Gridlet into a list
  }

  expt = new Experiment(1, glList, 4, false, 1100.0, 1783.0,
  "report1.txt", resourceNameList);

  userEntity = new UserEntity("User1", expt, 295.0, seed*997*(1+1)+1,
  51.0, false);

  // Starts grid simulation
  GridSim.startGridSimulation();
  }
  catch (Exception e) {
  e.printStackTrace();
  }
  } 


运行出错:Initialising...
Starting GridSim version 4.2


Entities started.
Exception in thread "Thread-11" java.lang.IncompatibleClassChangeError
at gridbroker.Broker.body(Broker.java:649)
at eduni.simjava.Sim_entity.run(Unknown Source)

[解决办法]
http://www.360doc.com/content/07/0910/16/43302_733564.shtml

热点排行