Decision Optimization

 View Only
  • 1.  Regarding doopl

    Posted Mon June 29, 2020 11:47 AM
    I am having one doubt -
    I was able to access a tuple from .mod file to doopl python using opl.get_table("tuple"), but how can I access a 2D array of the form say int Array[100[100] from .mod to doopl python sir? I tried opl.Array[i][j], but that is throwing an error. 
    How can I access a 2D array using opl in doopl python from .mod?
    Please anyone help..


    ------------------------------
    Sai Sampath Bethu
    ------------------------------

    #DecisionOptimization


  • 2.  RE: Regarding doopl

    Posted Mon June 29, 2020 12:40 PM
    Hi,

    as can be seen in https://github.com/IBMDecisionOptimization/doopl-examples you may get results as tuple set

    So you could either turn your 2D array in a tuple set in your .mod and then you will see that from python.
    Or what you could also do is from your model .mod write a file with  a 2D matrix

    https://github.com/AlexFleischerParis/howtowithopl/blob/master/write2Darrayinafile.mod

    regards

    ------------------------------
    ALEX FLEISCHER
    ------------------------------



  • 3.  RE: Regarding doopl

    Posted Mon June 29, 2020 03:51 PM
    Thank you sir, I will try that out...

    ------------------------------
    Sai Sampath Bethu
    ------------------------------