Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  How to manipulate text file

    Posted 11/02/17 06:01 AM

    Originally posted by: memo85


    Hi. I have thousands of text file as data set for any problem. But these set format is not suitable for OPL data file. An example of data is given in the post. I would to like to manipulate to this file in accordance with the OPL data file. How can I do that? Thank you in advance. 

     

    Best regards. 


    #DecisionOptimization
    #MathematicalProgramming-General


  • 2.  Re: How to manipulate text file

    Posted 11/02/17 06:39 AM

    I would write a small script in Perl or Python to transform that data.

    Or check whether your application can create different data files than these .alb files. Maybe it can export data as JSON or some other common data format? Then you could existing parsers to parse the file and would just have to print the objects in an appropriate format.


    #DecisionOptimization
    #MathematicalProgramming-General


  • 3.  Re: How to manipulate text file



  • 4.  Re: How to manipulate text file

    Posted 11/02/17 06:52 AM

    Originally posted by: memo85


    Thank you very much for your replies. I will try your suggestion. 

     

    Regards.


    #DecisionOptimization
    #MathematicalProgramming-General


  • 5.  Re: How to manipulate text file

    Posted 11/02/17 09:34 AM

    Originally posted by: memo85


    Dear Alex, 

    I have created a new OPL model and pasted your script into the model. But, the model gives an error like that the export.csv did not find. And my data files contain some different splitters (e.g. blank, comma and colon), I could not achieve this problem. How can I solve these? Thank you.

    Regards.  


    #DecisionOptimization
    #MathematicalProgramming-General


  • 6.  Re: How to manipulate text file

    Posted 11/03/17 11:41 AM

    Uhm, Alex code is for the specific data format that Alex outlined in this post.

    Since your data format is completely different you will have to write a completely different parser. The only thing that you would have in common with Alex' code is the input via IloOplInputFile.

    About the "file not found" problem: Is your file really called "export.csv"? If not then you have of course to change the file name in the script.


    #DecisionOptimization
    #MathematicalProgramming-General


  • 7.  Re: How to manipulate text file

    Posted 11/06/17 02:03 AM

    Originally posted by: memo85


    Thank you, Daniel. 

    I have written a script in in C# as you suggested and I have achieved this transformation. Now, I am trying to write the similar script in OPL. 

    However, the "file not found" problem continues, although I pay attention to your suggestions. 

    Regards. 


    #DecisionOptimization
    #MathematicalProgramming-General


  • 8.  Re: How to manipulate text file

    Posted 11/10/17 02:38 AM

    That can only mean that the file is not stored in the place you/your script expect it to be. Does it work when you use absolute paths? Also thisOplModel.resolvePath() can frequently help to get around issues like that.


    #DecisionOptimization
    #MathematicalProgramming-General


  • 9.  Re: How to manipulate text file

    Posted 11/10/17 02:59 AM

    Originally posted by: memo85


    Thank you, Daniel, I could solve the problem. 

     

    Regards.


    #DecisionOptimization
    #MathematicalProgramming-General