So easier to help when the question is in OPL ...

Original Message:

Sent: Fri May 13, 2022 10:51 AM

From: Vasco Ferreira

Subject: Two intensity intervals

Thank you so much, it's working like a charm :)

------------------------------

Vasco Ferreira

Original Message:

Sent: Fri May 13, 2022 09:37 AM

From: ALEX FLEISCHER

Subject: Two intensity intervals

Ok then let me rewrite

`stepFunction F1 = stepwise (i in 0..1000,j in 0..1) { 100*j -> (480 + i * 1440) + (540 * j);0 };`

into

`int rates[0..1]=[0,100];int steps[0..1]=[480,480+540];stepFunction F1bis= stepwise (i in 0..1000,j in 0..1) { rates[j] -> i * 1440 + steps[j];0 };`

which is the same but more generic and that will let you add some periodic values easily

------------------------------

[Alex] [Fleischer]

[Data and AI Technical Sales]

[IBM]

Original Message:

Sent: Fri May 13, 2022 06:41 AM

From: Vasco Ferreira

Subject: Two intensity intervals

Hi Alex,

Thank you for the answer.

I don't think I can declare it with breakpoints, as it can't be a fixed interval. Basically those values represent the shift work time, and i am scheduling something for the upcoming days, so I need to check it for the next days aswell and I can't make that static ( unless I declared a variable with the breakpoints for the maximum upcoming days that I would schedule ).

Do you have an idea of how I could write that complex formula? Otherwise I guess I'll write the breakpoints for like 180 days in advance.

------------------------------

Vasco Ferreira

Original Message:

Sent: Fri May 13, 2022 06:33 AM

From: ALEX FLEISCHER

Subject: Two intensity intervals

Hi,

you could write a complex formula for the stepFunction or use the trick from How to with OPL

How to describe a stepwise function with breakpoints instead of jumps ?

` tuple breakpoint // y=f(x) { key float x; float y; } sorted { breakpoint } breakpoints={<0,0>,<1,1>,<2,4>}; stepFunction f=stepwise(b in breakpoints:b!=first(breakpoints)) { prev(breakpoints,b).y->b.x; last(breakpoints).y } ; assert forall(b in breakpoints) f(b.x)==b.y;`

------------------------------

[Alex] [Fleischer]

[Data and AI Technical Sales]

[IBM]

Original Message:

Sent: Fri May 13, 2022 04:12 AM

From: Vasco Ferreira

Subject: Two intensity intervals

Hello,

I currently have a stepwise function for the intensity of an interval. However, I needed to add another interval in the middle of that where the intensity is also 0.

What i got currently is:

`stepFunction F = stepwise (i in 0..1000,j in 0..1) { 100*j -> (480 + i * 1440) + (540 * j);0 };`

I needed to add another interval [720i , 780i], anyone knows how i could do so?

Thank you in advance.

------------------------------

Vasco Ferreira

------------------------------