Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Ex-Post calculation

    Posted Wed March 23, 2022 10:41 AM

    Hi all,

    I am still new to CPLEX. I have got my model running and got the feasible solutions from the model.

    However, when I ex-post calculate the value from the variable (as below), I ran into the warning message of "Element has never been used". I simply want to sum over the solution of the variable (NEWSTOCK) into the parameters (EndNewstock) and cross check the number with the actual data.
    This statement is added after the minimize statement and the constraints statement.

    As warning message indicated, even though I got the solutions for decision variable NEWSTOCK, EndNewstock is not created nor has any value showed in the "problem browser" tab.

    float EndNewstock[ti in t][v in vehicle][s in segment]=sum(a in agev, vmt in vmtgrp) NEWSTOCK[ti][v][a][vmt][s];​
    I wonder how could I correctly ex-post calculate the values I got from the model. Do I have to use the Script language?

    Thanks,
    Jia

    ------------------------------
    Jia Zhong, PhD
    ------------------------------

    #DecisionOptimization


  • 2.  RE: Ex-Post calculation

    Posted Wed March 23, 2022 11:22 AM
    Hi,

    if after that line you add

    execute
    {
    writeln(EndNewstock);
    }​

    the warning you got should go away.
    Lazy evaluation means values are computed only if needed.

    int a;

    will also generate a warning if you do not use a later on



    ------------------------------
    [Alex] [Fleischer]
    [EMEA CPLEX Optimization Technical Sales]
    [IBM]
    ------------------------------



  • 3.  RE: Ex-Post calculation

    Posted Wed March 23, 2022 01:36 PM
    Thanks a lot for your instant reply. 
    I was self-educating myself with the CPLEX syntax by reading A quick start to CPLEX Studio - IBM Documentation. But it is really hard for me to find the insightful answer as yours from the document. Do you have any suggestions what other manual I can follow to pick up those tricks asap?

    Thanks,
    Jia

    ------------------------------
    Jia
    ------------------------------



  • 4.  RE: Ex-Post calculation

    Posted Wed March 23, 2022 01:58 PM
    Hi,

    https://community.ibm.com/community/user/datascience/communities/community-home/digestviewer/viewthread?MessageKey=e1b0c4e9-9665-4cf8-b85e-2498635ecc15&CommunityKey=ab7de0fd-6f43-47a9-8261-33578a231bb7&bm=e1b0c4e9-9665-4cf8-b85e-2498635ecc15#bme1b0c4e9-9665-4cf8-b85e-2498635ecc15

    could help

    ------------------------------
    [Alex] [Fleischer]
    [EMEA CPLEX Optimization Technical Sales]
    [IBM]
    ------------------------------



  • 5.  RE: Ex-Post calculation

    Posted Wed March 23, 2022 01:59 PM
    Thanks a lot for sharing this!

    ------------------------------
    Jia
    ------------------------------