Solved

# Subset in given order and not ascending or descending

• 8 replies
• 71 views

+4
• 16 replies

Hi all,

I am modelling production routes per production order in which the production routes provide the sequence of the jobs to follow.

I created a subset ProductionRoute(i) that is a subset of all possible jobs.

See below a production order i that follows the sequence: SMD → AOI → REW.

When implementing this in the subset and when running the model, it will follow the sequence AOI → REW → SMD since operations is stated ascending. Such as below.

Is there a possibility to model in AIMMS that it should follow the production route as stated  in the first figure? Instead of looking to the ascending order of the subset.

icon

Best answer by Chris Kuip 12 January 2023, 18:12

View original

### 8 replies

Userlevel 5
+7

Hello,

Did you specify "user” in the ‘order by’ attribute of ProductionRoute?

With kind regards,

Chris.

+4

Hi Chris,

No I didn't. Thanks it works now!

+4

@Chris Kuip I got an additional question to this issue.

It works now in a constraint like: x(i,j) >= x(i,j-1) + p(i,j-1).

However, when I am using first(j in ProductionRoute(i)) and last(j in ProductionRoute(i)), it again looks in the ascending order. Is there another way how to retrieve the first element and last element of the unique production route of production order i?

Userlevel 5
+7

Hello,

Thanks for pointing out this behavior of the functions first and last.

As an alternative you may want to use:

• element( ProductionRoute(i), 1 ) for first
• element( ProductionRoute(i), card( ProductionRoute( i ) ) ) for last.

Hope this helps,

Chris

+4

Hi @Chris Kuip ,

Unfortunately it does not help. The result of  x(i,j) >= x(i,j-1) + p(i,j-1).  nicely plans according to the order I give in ProductionRoute(i). So the first job is TE and the last one VER.

But in my constraint it uses EC as first and VER as last. So according to the ascending order.

I programmed the constraint as:

Userlevel 5
+7

Hello @MZwanenburg

May I ask which version of AIMMS you are using?

In addition, can you try to use element parameters, say

• ep_firstJob(i) with definition element( ProductionRoute(i), 1 )
• ep_lastJob(i) with definition element( ProductionRoute(i), card( ProductionRoute( i ) ) )

When I use such definitions, see enclosed AIMMS 4.91 project, the values are as expected when using the above definitions.

With kind regards,

Chris

+4

Hi @Chris Kuip ,

To be sure I downloaded the same version. It works! I created the element parameters and used these in the constraints. Thank you for the clear explanation :)

Userlevel 5
+7

You're welcome.