Hello,
I am trying to use the Vector Elm Map function to map an existing 2D variable into a new 2D variable, where one subscript of the new variable is different, but the other subscript is retained.
The existing arrayed variable is: Task Duration by Role[RoleID, TaskID]
The new arrayed variable needs to be: Task Duration by Empl[EmplID, TaskID]
Separately, I have the following variable which assigns each employee to a role: Employee Role[EmplID]
The driver behind this architecture is the input file, which is read in from excel using GET DIRECT CONSTANTS and provides task duration by role (thus, [RoleID, TaskID]). I have been able to use Vector Elm Map to read in the correct data values for Task Duration, but I am unable to achieve the correct offset.
I found other topics where a 2D array was mapped to a 1D array, but could not find 2D to 2D; apologies if I am repeating a topic!
Thank you,
Vector Elm Map: 2 dim array to 2 dim array
-
- Super Administrator
- Posts: 4841
- Joined: Wed Mar 05, 2003 3:10 am
Re: Vector Elm Map: 2 dim array to 2 dim array
How are the two ranges related (RoleID and EmplID)?
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Vector Elm Map: 2 dim array to 2 dim array
Thank you for responding. Here are all of the related variables & subscripts that I have defined so far:
For this problem, there are 467 employees, so there are 467 elements of [Emplid], or E1..E467
Each employee has an ID number, defined as Empl ID Num[Emplid], range = 1...467, such that Empl ID Num[E1] = 1, Empl ID Num[E2] = 2, etc
There are 64 roles in the company, so there are 64 elements of [RoleID], or R1...R64
Each role has an ID number, defined as Role ID Num[RoleID], range = 1...64, such that Role ID Num[R1] = 1, Role ID Num[R2] = 2, etc.
Each employee is assigned one of the 64 roles via the Employee Role[Emplid] variable. ex. Employee Role[E1-E13] = 1, Employee Role[E14-E15] = 2, ...
Finally there are 31 tasks in the process being modeled, so there are 31 elements of [TaskID], or T1...T31
Each task has an ID number, defined as Task ID Num[TaskID], range 1...31, such that Task ID Num[T1] = 1, Task ID Num[T2] = 2, etc.
The data is read into the model via the following variable/equation:
Task Duration by Role[RoleID, TaskID] = GET DIRECT CONSTANTS('DurationData.xls', 'RolevTask', 'D7' )
I have verified that the data is being read in correctly.
The objective is to populate the array for the variable: Task Duration by Empl[Emplid, TaskID]
Since my initial post, I have been experimenting with the mapping and may have hit on a solution with the following equation:
Task Duration by Empl[Emplid, TaskID] = VECTOR ELM MAP(Task Duration by Role[R1,TaskID],(Empl Role[Emplid]-1)*ELMCOUNT(TaskID))
Cursory checks of the equation's output indicate that the duration for a given task is mapping correctly from a particular role, to all empl IDs assigned to that role. However, I cannot logically explain why this would be the case- I arrived at this equation via trial and error. Therefore I am not confident that the correct values are being mapped for all 14,477 cells in the [Emplid, TaskID] matrix (and I would prefer not to check all 14477)... Could I possibly have arrived at the correct solution by luck?
respectfully,
Buzz
For this problem, there are 467 employees, so there are 467 elements of [Emplid], or E1..E467
Each employee has an ID number, defined as Empl ID Num[Emplid], range = 1...467, such that Empl ID Num[E1] = 1, Empl ID Num[E2] = 2, etc
There are 64 roles in the company, so there are 64 elements of [RoleID], or R1...R64
Each role has an ID number, defined as Role ID Num[RoleID], range = 1...64, such that Role ID Num[R1] = 1, Role ID Num[R2] = 2, etc.
Each employee is assigned one of the 64 roles via the Employee Role[Emplid] variable. ex. Employee Role[E1-E13] = 1, Employee Role[E14-E15] = 2, ...
Finally there are 31 tasks in the process being modeled, so there are 31 elements of [TaskID], or T1...T31
Each task has an ID number, defined as Task ID Num[TaskID], range 1...31, such that Task ID Num[T1] = 1, Task ID Num[T2] = 2, etc.
The data is read into the model via the following variable/equation:
Task Duration by Role[RoleID, TaskID] = GET DIRECT CONSTANTS('DurationData.xls', 'RolevTask', 'D7' )
I have verified that the data is being read in correctly.
The objective is to populate the array for the variable: Task Duration by Empl[Emplid, TaskID]
Since my initial post, I have been experimenting with the mapping and may have hit on a solution with the following equation:
Task Duration by Empl[Emplid, TaskID] = VECTOR ELM MAP(Task Duration by Role[R1,TaskID],(Empl Role[Emplid]-1)*ELMCOUNT(TaskID))
Cursory checks of the equation's output indicate that the duration for a given task is mapping correctly from a particular role, to all empl IDs assigned to that role. However, I cannot logically explain why this would be the case- I arrived at this equation via trial and error. Therefore I am not confident that the correct values are being mapped for all 14,477 cells in the [Emplid, TaskID] matrix (and I would prefer not to check all 14477)... Could I possibly have arrived at the correct solution by luck?
respectfully,
Buzz
-
- Super Administrator
- Posts: 4841
- Joined: Wed Mar 05, 2003 3:10 am
Re: Vector Elm Map: 2 dim array to 2 dim array
Does the attached do what you need?
I've used the "SUM" function to loop over the subscript ranges and pick out the correct one. Using "SUM" in this way, you can match more than one ID if you need to.
I've used the "SUM" function to loop over the subscript ranges and pick out the correct one. Using "SUM" in this way, you can match more than one ID if you need to.
- Attachments
-
- 2d_mapping_example.cin
- (108.36 KiB) Downloaded 293 times
-
- 2d_mapping_example.mdl
- (3.12 KiB) Downloaded 268 times
Advice to posters seeking help (it really helps us to help you)
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
http://www.ventanasystems.co.uk/forum/v ... f=2&t=4391
Units are important!
http://www.bbc.co.uk/news/magazine-27509559
Re: Vector Elm Map: 2 dim array to 2 dim array
Hi
i never use the vector elm map function. It is dangerous with the risk of getting values outside the range of the array, and because of its complex formuoation if used with muliple subscripts that generates errors.
if i want to get the value of say the element of a one dimension vector vector[sub3] from the subscript : sub: (sub1-sub10) I will use:
sum(if then else(ident sub[sub!] = ident[sub3] , 1 , 0) * vector[sub!] ) where ident sub[sub] = sub. But the real insterest is when you use a three or more dimensional array like array[sub,tub,gub] and want to get the value of array[sub3,tub4,gub2] you will use the formula
sum(if then else(ident sub[sub!] = ident sub[sub3] :and: ident tub[tub!] = ident tub[tub4] :and ident gub[gub!] = ident gub[gub2] , 1 , 0) *
array[sub!,tub!,gub!] )
It ùakes tje formula much easier to read and eventually debug and with lees risk of errors.
Using this formulation may help you solve your problem more easily.
JJ
i never use the vector elm map function. It is dangerous with the risk of getting values outside the range of the array, and because of its complex formuoation if used with muliple subscripts that generates errors.
if i want to get the value of say the element of a one dimension vector vector[sub3] from the subscript : sub: (sub1-sub10) I will use:
sum(if then else(ident sub[sub!] = ident[sub3] , 1 , 0) * vector[sub!] ) where ident sub[sub] = sub. But the real insterest is when you use a three or more dimensional array like array[sub,tub,gub] and want to get the value of array[sub3,tub4,gub2] you will use the formula
sum(if then else(ident sub[sub!] = ident sub[sub3] :and: ident tub[tub!] = ident tub[tub4] :and ident gub[gub!] = ident gub[gub2] , 1 , 0) *
array[sub!,tub!,gub!] )
It ùakes tje formula much easier to read and eventually debug and with lees risk of errors.
Using this formulation may help you solve your problem more easily.
JJ