What is the error you get? Does the second variant also raise an error? One problem definitely is that the values in DMInvIndex are instances of
tDMInvIndex while in your definition of tK you define the field DMI to be of type int. This field should have type
tDMInvIndex, otherwise the types do not match.
------------------------------
Daniel Junglas
------------------------------
Original Message:
Sent: Wed July 01, 2020 12:52 AM
From: Sai Sampath Bethu
Subject: 2D matrix to tuple set conversion
here in my data-
num_shifts = 50; (declared in .dat code)
following is a code block in .mod file-
int num_shifts = ...;
range shift_range = 1..num_shifts;
tuple tDMInvIndex
{
int bom_elem_id;
string component;
}
{tDMInvIndex} DMInvIndex={<BM.bom_elem_id,BM.component> | BM in BomMappings};
int DMInvValue[DMI in DMInvIndex][shift in shift_range]=cumulFunctionValue(dm_inv[DMI],(shift*720));
//This is the 2D matrix
//Now, my goal is convert this 2D matrix into tuple set
//following is what I have done-
tuple tK
{
key int DMI;
key int shift;
int value;
}
{tK} K={<DMI, shift, DMInvValue[DMI][shift ]> | DMI in DMInvIndex, shift in shift_range}
is this correct sir? but when I have done this, it is throwing an error...
OR
tuple tK
{
int value;
}
{tK} K={<DMInvValue[DMI][shift ]> | DMI in DMInvIndex, shift in shift_range}
is this correct way?
------------------------------
Sai Sampath Bethu
------------------------------
#DecisionOptimization