• 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    
  • Welcome   |   Team (contact)   |   JAVA client   |   Descriptions

    • Web services for the bin packing 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)        
    • Team's members 
    • photo de Carlos
      Carlos Cepeda

      Email : cepeda@poste.isima.fr
      ISIMA student
      Blaise Pascal University
      1 Rue de la Chebarde, 63178 Aubière CEDEX
    • photo de Jonathan
      Jonathan Dupres

      Email : dupres@poste.isima.fr
      ISIMA 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 following format.

      photo_creation

      This format is for a bin packing in 3D. To use it in 2D, delete the third dimension for the bin and for the objects.

     
    • 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/BinPackingWebService/WebServiceBPP?WSDL


    • Web Service :
    • Download Java Web Service

    • Example : Java Program using the web service
     


    • Code source available here : Download
      photo_creation

    • Output file for visualization tool
     


    • This web service is able to build a output file that can be used in the visualization tool made by Helene Toussaint.
      This visualization tool is available here : Download

      Launch visu3D.exe and write the name of the input file which have to be next to the executable.
      Press Enter and you should discover something like that :
      photo_creation


    • 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 :
      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/BinPackingWebService/WebServiceBPP?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.BinPackingWebService service = new webservice.BinPackingWebService();
              webservice.WebServiceBPP port = service.getWebServiceBPPPort();
      


      Step 2
      Read an input file and transform it into a array of byte. Note we assume the file is data.txt.

              File f = new File ("data.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

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



      Step 3.5
      Define the process type (linear programming or heuristic).

      		data_instance.setHeuristique(true);
      


      Step 4
      Start the solver and retrieve your client id, necessary to the next steps.

              String id = port.start(data_instance, error, stringError);
      

      Step 5
      Read the solution if available and display the results.

      		if (port.isCompleteThread(id, error, stringError) == 1) {
      			Donnees solution = port.readResult(id, error, stringError);
      			
      			jTextArea1.append("Nombre Objets insérés dans le bin : " + solution.getNbreObjetsInseres()+"\n\n");
      			jTextArea1.append("Dimensions bin: " + solution.getBin().getWidth()+" ; "+solution.getBin().getLength()+
      					((solution.isTroisDimensions())?(" ; "+solution.getBin().getHeight()):"")+"\n\n");
      			
      			Iterator<Objet> it = solution.getListeObjets().iterator();
      			Objet objCour ;
      			while(it.hasNext()) {
      				objCour = it.next();
      				
      				if (objCour.getX() > -1) {
      					jTextArea1.append("Dimensions obj"+objCour.getId()+" : " + objCour.getWidth()+" ; "+
      							objCour.getLength()+((solution.isTroisDimensions())?(" ; "+objCour.getHeight()):""));
      					jTextArea1.append(" ===> " + objCour.getX()+" ; "+ objCour.getY()+
      							((solution.isTroisDimensions())?(" ; "+ objCour.getZ()):"")+"\n");
      				}
      			}
      		}
      

      Step 6
      Save the solution on the disk in a basic format, in order to use it in the visualization tool.

      		byte[] contenuFichier = port.dataToBasicFile(instance);
              File imagefile = new File("solution.txt");
              FileOutputStream fileStream2 = new FileOutputStream(imagefile,false);
              fileStream2.write(contenuFichier);
              fileStream2.close();
      




    • The structures
    • Structure 1 : Donnees
      description : datas specific to the problem :
      Object bin : represents the bin
      ArrayList(Objet)> listeObjets : list of Objects to insert in the bin
      bool troisDimensions : indicate the dimension of the problem (2D or 3D)
      bool heuristique : indicate the type of execution process (linear programming or heuristic)
      String chemin : datafile path
    • Structure 2 : Objet
      description : element of the bin packing
      int _width : width of the object
      int _length : length of the object
      int _height : height of the object
      int _id : id of the object
      int _x : position x of the object
      int _y : position y of the object
      int _z : position z of the object
    • WebMethods


    • This is the calling server method used by the client.
    • It's an unsyncronous method.

    • Function 1 : [string id] start ( Donnees data, ref int error, ref string stringError);
      description : launch an instance.
      output:
      string id : it's very important to remember this id, because without it you can't received your results
      input :
      Donnees data: data sent by client
      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 2 : [int Result] IsCompleteThread ( 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 3: [Donnees result] ReadResult ( string id, ref int error, ref string stringError);
      output:
      Donnees result : the solution obtain with the solver for the Bin Packing 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
    • Function 4: [Donnees result] GetData(byte[] file, ref int error, ref string stringError);
      output:
      Donnees result : the solution obtained with the solver for the Bin Packing Problem
      input :
      byte[] file : a byte array obtained from file
      int error :in this integer there is a number which correspond to an error
      string stringError : this string contains an explanation of the error

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