• Operational Research Web Services
    • LIMOS 2012 : Webservices' Development
    • LOGO LIMOS

    •    Homepage   
    •    Svg2Png   
    •    Job shop   
    •    GPS for pedestrian   
    •    Job shop time lags   
    •    VRP   
    •    Community-based GPS    
    •    Bin packing    
    •    NFC android    
    •    Sudoku PPC    
  • Tranform svg2png   |   Try it   |   Team (contact)   |   Active link JAVA   |   Active link C#   |   Descriptions

    • Web services for the job shop problem 
    • Limitations:
                The maximum number of procedures which are executed simultaneously on the server for the same IP is 2.
                The maximal number of simultaneous users is limited to 10 (10 different IP addresses)        
    • Dream team's members  
    • photo de Pierre
      Pierre Villechenon

      Email : villeche@poste.isima.fr
      ISIMA student
      Blaise Pascal University
      1 Rue de la Chebarde, 63178 Aubière CEDEX
    • photo de maxime
      Maxime Chassaing

      Email : maxime.chassaing@isima.fr
      Polytech'Clermont Ferrand student
      Blaise Pascal University
      1 Rue de la Chebarde, 63178 Aubière CEDEX
     
    • Input file format  
      The web service can be used providing input file according to the well known format used in the ORLibrary except that on the first line three numbers provide : - the number of jobs - the number of machines - the lower bound. An example of correct file is provided hereafter :
      photo_creation

      A solution is a gannt chart similar to the next one :
      photo_creation

     
    • Java implementation of the web service
     

    • Java Web Service link :

    • This web service is temporarily unavailable until July 8th 2016, if you need an earlier access you can contact Maxime Chassaing at this address: maxime.chassaing[@]gmail[dot]com
      http://orws2.isima.fr:80/WebServiceJobShop/WebServiceJobShop?WSDL


    • Web Service :
    • Download Java Web Service

    • Example : Java Program using the web service
     


    • Code source available here : Download
      photo_creation

    • Example 1: C# Program using the web service
     


    • Code source available here : Download
      photo_creation

    • Example 2: C# Program using the web service
     


    • Code source available here : Download
      photo_creation


     
    • How to create a C# client in 5 minutes ?

    • Start Visual Studio and create a new Windows form application
      photo_creation

      Take one minute to achieve a main window which could be similar to the next window :
      photo_creation

      Add to the projet a reference to the web service. Use the following address :

      This web service is temporarily unavailable until July 8th 2016, if you need earlier an access you can contact Maxime Chassaing at this address: maxime.chassaing[@]gmail[dot]com
      http://orws.isima.fr/WebServiceJobShop/WebServiceJobShop?WSDL

      which is the web service WSDL description.
      photo_creation

      The code C# implementation is divided into 6 steps :

      Step 1
      Create a reference to the Soap server :

      	ORWSjobshop.WebServiceJobShopClient ORWS = new ORWSjobshop.WebServiceJobShopClient();
      


      Step 2
      Read a file and transform it into a array of byte.

                  string FileName = "c:\\la03.txt";
                  byte[] datafile;
                  FileStream fileStream = new FileStream(FileName, FileMode.Open);
                  datafile = new byte[(int)fileStream.Length];
                  fileStream.Read(datafile, 0, (int)fileStream.Length);
      



      Step 3
      Transform the file into an instance.

                  int ERROR=0;
                  string STRERROR="";
                  ORWSjobshop.data data_instance = ORWS.getData(datafile,ref ERROR,ref STRERROR);
      


      Step 4
      Create a random bierwith vector, evaluate it and apply a local search.

                   //step4.1 generate a random VB
                  ORWSjobshop.bierwithVector BV = ORWS.getRandomBierwithVector(data_instance,(long)-1);
                   //step4.2 evaluate the vector to obtain a solution
                  ORWSjobshop.solution Solution_instance = ORWS.evaluate(data_instance, BV);
                   //step4.3 call a localsearch to improve a solution
                  ORWSjobshop.solution Solution_instance2 = ORWS.localSearch(data_instance, Solution_instance, 10000, ref ERROR);
                  
      

      Step 5
      Display the solution

                  t.AppendText("Solution makespan : ");
                  t.AppendText (Solution_instance2.makespan + "\n");
                  for (int i =0 ; i‹data_instance.nbJobs;i++ )
                  {
                       t.AppendText("Job : "+i+"\n");
                      for (int j = 0 ; j‹data_instance.nbMach;j++){
                          t.AppendText( " " + Solution_instance2.startDate[i*data_instance.nbMach+j]);
                      }
                      t.AppendText("\n");
                  }
      

      Step 6
      Save the solution in SVG format on the disk.

                  byte[] datafileSVG = ORWS.solutionToSvgFile(data_instance, Solution_instance2);
                   //step6.2 save on Disk
                  string nameFileOut = "C:\\out.svg";
                  FileStream fileStream2 = new FileStream(nameFileOut, FileMode.Create);
                  fileStream2.Write(datafileSVG, 0, datafileSVG.Length);
      

      The full code to manage the clic on the button


              private void button1_Click(object sender, EventArgs e)
              {
                  
                  //Step 1 : Connection
                  ORWSjobshop.WebServiceJobShopClient ORWS = new ORWSjobshop.WebServiceJobShopClient();
                  
                  
                  //step 2 Read File LaO1.txt and convert it to array of byte
                  string FileName = "c:\\la03.txt";
                  byte[] datafile;
                  FileStream fileStream = new FileStream(FileName, FileMode.Open);
                  datafile = new byte[(int)fileStream.Length];
                  fileStream.Read(datafile, 0, (int)fileStream.Length);
      
                  //step3 Transform file into data problem
                  int ERROR=0;
                  string STRERROR="";
                  ORWSjobshop.data data_instance = ORWS.getData(datafile,ref ERROR,ref STRERROR);
      
                  //step4 Creat a Bierwirth Vector and evaluate it
                   //step4.1 generate a random VB
                  ORWSjobshop.bierwithVector BV = ORWS.getRandomBierwithVector(data_instance,(long)-1);
                   //step4.2 evaluate the vector to obtain a solution
                  ORWSjobshop.solution Solution_instance = ORWS.evaluate(data_instance, BV);
                   //step4.3 call a localsearch to improve a solution
                  ORWSjobshop.solution Solution_instance2 = ORWS.localSearch(data_instance, Solution_instance, 10000, ref ERROR);
                  
                  //step5 display a solution
                  t.AppendText("Solution makespan : ");
                  t.AppendText (Solution_instance2.makespan + "\n");
                  for (int i =0 ; i‹data_instance.nbJobs;i++ )
                  {
                       t.AppendText("Job : "+i+"\n");
                      for (int j = 0 ; j‹data_instance.nbMach;j++){
                          t.AppendText( " " + Solution_instance2.startDate[i*data_instance.nbMach+j]);
                      }
                      t.AppendText("\n");
                  }
                  //step6 save solution on disk
                   //step6.1 transform solution in SVGfile
                  byte[] datafileSVG = ORWS.solutionToSvgFile(data_instance, Solution_instance2);
                   //step6.2 save on Disk
                  string nameFileOut = "C:\\out.svg";
                  FileStream fileStream2 = new FileStream(nameFileOut, FileMode.Create);
                  fileStream2.Write(datafileSVG, 0, datafileSVG.Length);
      
              }
          
      




     
    • How to create a Java client in 5 minutes ?

    • Start Netbeans and create a new Java application
      photo_creation

      Take one minute to achieve a main window which could be similar to the next window :
      photo_creation

      Add to the projet a reference to the web service. Use for example the following address :
      http://orws.isima.fr/WebServiceJobShop/WebServiceJobShop?WSDL

      The web service reference must be visible now in the project.
      photo_creation

      The code Java implementation is divided into 6 steps :

      Step 1
      Create a reference to the Soap serveur :

              webservice.WebServiceJobShop_Service service = new webservice.WebServiceJobShop_Service();
              webservice.WebServiceJobShop port = service.getWebServiceJobShopPort();
      


      Step 2
      Read a svg file and transform it into a array of byte. Note we assume the file is euro.svg.

              File f = new File ("La03.txt");
              FileInputStream ips = new FileInputStream(f.getName());
              byte[] in = new byte[ips.available()];
              ips.read(in);
              ips.close();
              Holder‹Integer› error = new Holder‹Integer›();
              Holder‹String› stringError = new Holder‹String›();
      



      Step 3
      Transform the file into an instance

       Data data_instance = port.getData(in, error, stringError);
      


      Step 4
      Create a random bierwith vector, evaluate it and apply a local search.

               BierwithVector bv = port.getRandomBierwithVector(data_instance, -1);
              Solution sol = port.evaluate(data_instance, bv);
              Solution betterSol = port.localSearch(data_instance, sol, 200, error);
      

      Step 5
      Display the solution

              jTextArea1.append("Makespan : " + betterSol.getMakespan() + "\n");
              for (int i = 0 ; i ‹data_instance.getNbOps() ; i++)
              {
                  jTextArea1.append("Start date operation "+ i + " : " + betterSol.getStartDate().get(i) + "\n");
              }
      

      Step 6
      Save the solution in SVG format on the disk.

              byte[] svgFile = port.solutionToSvgFile(data_instance, betterSol);
              File imagefile = new File("solution.svg");
              FileOutputStream fileStream2 = new FileOutputStream(imagefile,false);
              fileStream2.write(svgFile);
              fileStream2.close();
      




    • The structures
    • Structure 1 : BierwirthVector
      description :
      int nbJobs : number of job for the Job Shop Scheduling Problem
      int nbMach : number of machine for the Job Shop Scheduling Problem
      int NbOperation : number of operation for the Job Shop Scheduling Problem
      int[] Vector : the different value of the BierwirthVector
    • Structure 2 : Data
      description :
      int nbJob : number of job for the Job Shop Scheduling Problem
      int nbMach : number of machine for the Job Shop Scheduling Problem
      int NbOperation : number of operation for the Job Shop Scheduling Problem
      int[] time : Time for each operation
      int[] mach : machine for each operation
      int[] job: job for each operation
    • Structure 3: Solution
      description : 
      int makespan : the time to finish the sequence of jobs
      bierwirthVector bv: the bierwirth vector associete to the solution.
      int[] head : critical path
      int[] time : begin of each operation
    • GetData

     
    • Function : [Data data] getRandomBierwithVector ( byte[] dataFile, ref int error, ref string stringError);
      description :
      output:
      Data data : datas of a Job Shop Scheduling Problem
      input :
      Data data : datas of a Job Shop Scheduling Problem, initalised with the function getData();
      int error : in this integer there is a number which correspond to an error
      string stringError : this string contains an explanation of the error
    • Error code :
      "0" : Execution ok
      "-1" : Server Busy, too many clients
    • GetRandomBierwithVector
     
    • Function : [bierwirthVector BV] getRandomBierwithVector ( Data data);
      description :
      output:
      bierwirhVector BV : a bierwirthvector initialise with random values.
      input :
      Data data : datas of a Job Shop Scheduling Problem, initalised with the function getData();

    • GetNeighbourBierwithVector
     
    • Function : [bierwirthVector BVN] getNeighbourBierwithVector ( bierwirthVector BV );
      description :
      output:
      bierwirhVector BVN : a bierwirthvector neighbour similare to the bierwirthvector in  input but with one permutation of 2 values
      input :
      bierwirhVector BV :  a bierwirthvector initialised
      
    • Evaluate
     
    • Function : [Solution solution] evaluate ( Data data , BierwirthVector BV);
      description : 
      output:
      Solution solution : solution of the Job Shop Scheduling Problem matching with BV
      input :
      Data data : datas of a Job Shop Scheduling Problem, initalised with the function getData();
      bierwirhVector BV :  a bierwirthvector initialised
      
    • LocalSearch
     
    • Function : [Solution Newsolution]] localSearch ( Data data , Solution S, int maxiteration,ref int error);
      description :  
      output:
      Solution Newsolution : solution of the Job Shop Scheduling Problem better than S
      input/output:
      int error
      input :
      int maxiteration :
      Data data : datas of a Job Shop Scheduling Problem, initalised with the function getData();
      Solution Newsolution : solution of the Job Shop Scheduling Problem initialised
      
    • GRASP 


    • This is the Meta heuristique function we have implemented on a Web Service.
    •  There are four differents functions because it's an unsyncronous method.

    • Function 1 : [string id] start_GRASP ( Data data, int maxIterLS, int ELS, neighbourNumber, nbInitialVector  ref int error, ref string stringError);
      description :
      output:
      string id : it's very important to remenber this id, because without it you can't received your png file
      input :
      byte [] input: the .SVG file you want to convert into the .PNG picture format, take care it's a byte array and not a stream or another File format
      int maxIterLS : the number max of iteration in the local search procedure
      int ELS : the nomber of loop in the GRASP
      int neighbourNumber : the number of neighbour for each loop
      int nb initialVector: the number of initial BV
      int error :in this integer there is a number which correspond to an error
      string stringError : this string contains an explanation of the error
    • Error code :
      "0" : Execution ok
      "-1" : Server Busy, too many clients
      "-2" : Too many GRASP in progress for the same time and the same IP
      "-3" : The Data data is null
      • Function 2a : [int Result] IsCompleteThread_GRASP( string id, ref int error, ref string stringError);
        output:
        int Result : an integer which tell you if the convertion is finished or not
                     "0" : Execution in progress but not finished yet
                     "1" : Execution finished : you can call the next function (ReadResult) to get the best solution
        input :
        string id : the id obtained after calling the first function
        int error :in this integer there is a number which correspond to an error
        string stringError : this string contains an explanation of the error
    • Error code :
      "-1" : Id unknow
    • Function 2b : [void] Stop_GRASP( string id, ref int error, ref string stringError);
      input :
      string id : the id obtained after calling the first function
      int error : in this integer there is a number which correspond to an error
      string stringError : this string contains an explanation of the error
    • Error code :
      "0" : GRASP stroped
      "-1" : Id unknow
      "-2" : GRASP already finished
    • Function 3: [Solution result] ReadResult_GRASP( string id, ref int error, ref string stringError);
      output:
      Solution result : the solution obtain with the GRASP for the Job Shop Scheduling Problem
      input :
      string id : the id obtained after calling the first function
      int error :in this integer there is a number which correspond to an error
      string stringError : this string contains an explanation of the error
    • Error code :
      "0" : Execution ok
      "-1" : Id unknow
      "-2" : Execution still in progress
      "-3" : Error during GRASP
     
    • SolutionToSvgFile

     
    • Function : [byte[] ] SolutionToSvgFile ( Data data, Solution solution );
      description :
      output:
      byte[] datafile : array of byte containing the SVG file solution of the Job Shop Scheduling Problem
      input :
      Data data : datas of a Job Shop Scheduling Problem, initalised with the function getData();
      Solution solution : a solution of the JobShop Scheduling Problem
    • Mobile Application

    • This is an example of mobile client application of the Web Service Job Shop.

      capture d'écran
      video : Download
      APK application : Download
      source code : Download

    • Number of visitors : 3612
    |
      Last update : 15 december 2015