How to create a new set which is a transformation of a previous set
Basically ill provide here the formulation:
We have set t → t ∈ T = {1,2,...,tn} ∀t ∈ T
And we need to create and use set tau where tau stands for
tau → ∀τ =t+1,...,min(t+Li −1,tn)
Please, it would be so helpful if someone could provide a solution. Thank you so much.
Page 1 / 1
Hello!
If I understand correctly, the first set is easy to define.
Having a parameter tn and then having a set defined as {1..tn} would do the trick. You may want to put a condition in the definition, something like
If tn >= 1 then
{1..tn}
endif;
To avoid getting errors when tn is < 1.
For the second one, I am not sure if I fully understand. Do you have an indexed set? Which t are you referring to when you mention ∀τ =t+1,...,min(t+Li −1,tn)? Since t is an index of a set, it is variable, not a fixed parameter.
Maybe a parameter could do the trick, something like:
tau(t1,t2)
defined as if t2 > t1 and t2 < min(t + Li - 1,tn) then 1 endif;
Assuming Li is a parameter.
This is the code I played around with:
Parameter tn;
Parameter Li;
Set sT { SubsetOf: Integers; Index: t, t1, t2; Property: ElementsAreNumerical; Definition: { if tn >= 1 then {1..tn} endif; } }
Parameter Tau { IndexDomain: (t1,t2); Definition: { if t2 > t1 and t2 < min(t1 + Li - 1,tn) then 1 endif; } }
And using tn = 10; Li = 5; I would get:
Hope it helps.
Reply
Sign up
Already have an account? Login Please use your business or academic e-mail address to register