Decision Optimization

 View Only
  • 1.  generate release time randomly

    Posted Mon August 10, 2020 10:12 AM

    I wanna to generate release time randomly and make the trains' departure time equals to it. I write it as follows and I got something wrong with assignment statement.

    execute {
    cplex.tilim = 120;
    for (var k in orders)
      { writeln("\n origin release time is"+k.release_time);   
          k.release_time = Opl.rand(7);    // This is wrong.
         }    
    }

    my data file is :
                                                         // volume due_time release_time
    orders = {<1, {"Beijing"},{"Hamburg"},   24,       26,               0>,
                   <2, {"Yinchuan"},{"Hamburg"}, 26,     20,               0>,
                   <3, {"Shanghai"},{"Hamburg"}, 18,     28,               0> };

    Is it because I already define the value of release time in data file?  How can I change it ?  I need to change the release time of every order in each iteration.

    Regards


    Programmer
    ------------------------------
    Junaid - Ainit Dubai
    ------------------------------

    #DecisionOptimization


  • 2.  RE: generate release time randomly

    Posted Mon August 10, 2020 01:21 PM
    Hi

    similar to 

    https://community.ibm.com/community/user/datascience/communities/community-home/digestviewer/viewthread?GroupId=5557&MessageKey=f3516283-3fb7-437c-81bd-3247e99fdcec&CommunityKey=ab7de0fd-6f43-47a9-8261-33578a231bb7&tab=digestviewer&ReturnUrl=%2fcommunity%2fuser%2fdatascience%2fcommunities%2fcommunity-home%2fdigestviewer%3fcommunitykey%3dab7de0fd-6f43-47a9-8261-33578a231bb7%26tab%3ddigestviewer

    regards

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