Create relationship between sets

Problems with syntax of GAMS
Post Reply
adeniyi4adisa
User
User
Posts: 6
Joined: 1 month ago

Create relationship between sets

Post by adeniyi4adisa » 2 weeks ago

Good day, please I need help to establish relationship between sets but I don't know how to go about it. It's a job scheduling problem.
An example is shown below.
Sets
j Current job /j1*j10/
h last job before the current /h1*h10/

I want to establish a relationship between h and j such a the relationship shown below. If the current job is J6 and it has finish processing and the next job is j2. While on job 6 set j is 6 but immediately it starts processing job 2, set j will pass its old value to h as 6 and the current job will have set j as 2.
h = ord (j)-1. (I don't know if this correct)
I want to express last job in terms of the current job. I don't even if this relationship is expressed as set, parameter or what.?
Thanks.
Last edited by adeniyi4adisa 2 weeks ago, edited 1 time in total.

adeniyi4adisa
User
User
Posts: 6
Joined: 1 month ago

Re: Create relationship between sets

Post by adeniyi4adisa » 2 weeks ago

adeniyi4adisa wrote:
2 weeks ago
Good day, please I need help to establish relationship between sets but I don't know how to go about it. It's a job scheduling problem.
An example is shown below.
Sets
j Current job /j1*j10/
h last job before the current /h1*h10/
I want that, if job 6 is the current job and job 2 was the last one, my model will be able to pass the last job to h and the current job will be j.
I want to establish a relationship between h and j such a the relationship shown below.
h = ord (j)-1. (I don't know if this correct)
I want to express last job in terms of the current job. I don't even if this relationship is expressed as set, parameter or what.?
Thanks.

User avatar
Renger
Posts: 585
Joined: 3 years ago

Re: Create relationship between sets

Post by Renger » 2 weeks ago

Hi
You are aware that you can write j-1 as index?

Code: Select all

set j /j1*j10/;

parameter Job(j), Previousjob(j)

PreviousJob(j) = Job(j-1);
Cheers
Renger
____________________________________
Enjoy modeling even more: Read my blog on modeling at The lazy economist

adeniyi4adisa
User
User
Posts: 6
Joined: 1 month ago

Re: Create relationship between sets

Post by adeniyi4adisa » 2 weeks ago

Thanks renger, you have been of great help to me. Though I have not finished working on your guide but it proved helpful.

adeniyi4adisa
User
User
Posts: 6
Joined: 1 month ago

Re: Create relationship between sets

Post by adeniyi4adisa » 2 weeks ago

Hi Ranger, I have tried the guide you gave me. It did not work. It seems the analysis works only on parameters not on sets. I need a way to manipulate these sets in order to achieve the desired result. I have tried to manipulate from the equations but to no avail because the domain will become meaningless.
Looking forward to hearing from you.
Thanks.

Post Reply