Decision Optimization

Decision Optimization

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

 View Only
  • 1.  Initializing State Functions

    Posted Fri April 15, 2016 09:39 PM

    Originally posted by: AndyHam


    Dear IBM,

    In the previous semiconductor reticle case, I need to set the initial location (=state).

    Something like the following:

        PositionReticle[1]= 3; //Reticle 1 is initially located at matchine 3.

    Can you please help me out?

     

    Also, I found the very similar question by Adam Gregory. This question was not answered. 

    CP State Functions: Can resources also be given an initial state? Perhaps there is an off state on the oven and it states in that state. How do you ensure the resource states in this state?

    https://www.ibm.com/developerworks/community/forums/html/topic?id=ca133096-1065-4979-80b7-4ddb2c1ef374&ps=25

     

    Regards,

    Andy


    #CPOptimizer
    #DecisionOptimization


  • 2.  Re: Initializing State Functions

    Posted Tue April 19, 2016 04:00 AM

    Hi,

    have you had a look at

    alwaysEqual (f,s,e,v)

    where f is a stateFunction, s and e are starts and ends and v is a value ?

    regards


    #CPOptimizer
    #DecisionOptimization


  • 3.  Re: Initializing State Functions

    Posted Tue April 19, 2016 08:45 AM

    Originally posted by: AndyHam


    Thanks for the tip. I only knew alwaysEqual (f,a,v).

    alwaysEqual (f,s,e,v) should be the solution, but I still could not make it work.

    Let me use IBM Batch Scheduling sample to illustrate. Assume we want to initialize the state as "2" for all ovens and the state should remain as "2" until the first task is started. So, I wrote the code as follows. Can you please see if how to make my FirstStartAt calculation work?

    int FirstStartAt[o in ovens];

    forall(o in ovens){    

     //   FirstStartAt[o] == min(t in allTasks : presenceOf(taskOvenAlts[t][o])==1) startOf(taskOvenAlts[t][o]);
     //   FirstStartAt[o] == min(t in allTasks) if(presenceOf(taskOvenAlts[t][o])==1) startOf(taskOvenAlts[t][o]);
        alwaysEqual(ovenTemperature[o], 0, FirstStartAt[o], 2 ); //assuming last state was "2"  
      }

    Any help will be appreciated.


    #CPOptimizer
    #DecisionOptimization


  • 4.  Re: Initializing State Functions

    Posted Wed April 20, 2016 11:40 AM

    Originally posted by: Petr Vilím


    Hello,

    the solution depends on what do you want to achieve. I understand that you want the oven to be in state 2 until the first task starts. Is it because (a) there are some other tasks that could be performed before, i.e. during the state 2? Or (b) you want to make sure that there is enough time to change the state from 2 to the state required for the first task? I'm assuming you passed a transition matrix to the state function in the case (b).

    In the case (b) I think that you don't have to make sure that the state 2 ends as late as possible. You can e.g. enforce state 2 during interval [0, 1] using alwaysEqual as suggested by Alex.

    In the case (a) constraint alwaysEqual(f, s, e, v) cannot be used because FirstStartAt[o] is not a constant, it is decision expression (it is an expression that depends on some decision variables). And alwaysEqual(f, s, e, v) requires s and e to be constants. So it is necessary to use alwaysEqual(f, interval, v) instead and create an auxiliary interval variable that starts at 0 and ends at the time the first taskOvenAlts starts. There are multiple ways to do that:

    1) You can constraint the end of the interval to be equal to something similar to your FirstStartAt[o] expression: endOf(interval) = min(t in allTasks) startOf(taskOvenAlts[t][o], 1000000). The value 1000000 is used when the interval is absent, you can use some other number of course.

    2) You can use span constraint. Using span, you can create an interval that exactly covers all present intervals taskOvenAlts[t][o]. Then using endAtStart you can force the auxiliary interval to end at the time the spanning interval starts.

    There shouldn't be a big difference in speed between 1) and 2).

    Best regards, Petr


    #CPOptimizer
    #DecisionOptimization


  • 5.  Re: Initializing State Functions

    Posted Wed April 20, 2016 05:09 PM

    Originally posted by: AndyHam


    Thanks for the advice.

    I am afraid, but I don't think I was clear in explaining.

    What I want to achieve is to waive the transition penalty depending on the initial state.

    In the batch example,

        assume Oven[1] is already warmed up with State 2 at the beginning of scheduling horizon.

        If we schedule jobs having State=2, then there should be no transition penalty. 

    That is what I am trying to accomplish.


    #CPOptimizer
    #DecisionOptimization


  • 6.  Re: Initializing State Functions

    Posted Thu April 21, 2016 03:24 AM

    Originally posted by: Petr Vilím


    Hello,

    I still think that the approach (b) can solve the issue. Lets assume that the first oven task can be scheduled at time 0. Using alwaysEqual(f, -1, 0, 2) we set the oven into state 2 during interval [-1, 0]. So, assuming that transition time from state 2 to state 2 is 0 (in the oven example it make sense), the first task with state 2 can be scheduled at time 0 (waiving the transition penalty). On the other hand, assuming that transition time from 2 to 3 is 5, a task requiring state 3 could not be scheduled before 5.

    Otherwise I'm afraid that I still don't understand the problem. Could you give me an example where (b) doesn't work then?

    Petr


    #CPOptimizer
    #DecisionOptimization