sum[j,Stationen*Zuordnung_AufgabenStationen(i,s)]-sum[i,Stationen*Zuordnung_AufgabenStationen(j,s)]<=0

**Best answer by mohansx**

I tried to multiply a set to a variable in my constraint, which gave the error There is no operation defined for operator "*" with the arguments of data type numeric and data type set. I need to find a solution to avoid this multiplication but come to the same result.

sum[j,Stationen*Zuordnung_AufgabenStationen(i,s)]-sum[i,Stationen*Zuordnung_AufgabenStationen(j,s)]<=0

sum[j,Stationen*Zuordnung_AufgabenStationen(i,s)]-sum[i,Stationen*Zuordnung_AufgabenStationen(j,s)]<=0

**Best answer by mohansx**

This topic has been closed for comments

Hello @Melike , what do you intend to do by the constraint you wrote ? If you can tell me that, I can tell you the right way to model that constraint.

Hello MOhan, Im trying to write a model for Assembly Line Balancing. The aim is to minimize the number of stations on the assembly line. In that constraint I was trying to model the precedence relations between the tasks. Zurodnung_AufgabenStationen is the assignment of tasks to stations. j is the predecessor task.

Thanks in advance

Thanks in advance

In the case, remove the Stationen* inside the sum and put s as the index domain of the constraint. Something like the screenshot below. This will be interpreted as "for all stations s, sum[j, Zourdnun...(j,s)] - sum[i, Zoutdnu...(i,s)] must be less than or equal to 0. (Ignore the colors of the text, see the highlighted s in the Index domain.. field)

Hello Mohan. "do you mean - for all Stationen, the precedence relations must be satisfied ? s is an index in the Stationen set, correct ?" Exactly. Thanks a lot no errors now.

I try to model the Stationnumber (Variable which is to minimize). I found a function Max(..) but didnt understand how to use it without giving the elements.

and then try to model it in another way

sum[(i,s),Stationen*Zuordnung_AufgabenStationen(I,s)]; I is the last Task. but I dont know how to enter the last Task. I would probably have to use the Max function again which would be redundant, because i would then use it for Stationnumber. And then again the problem with the multiplication would occur.

I try to model the Stationnumber (Variable which is to minimize). I found a function Max(..) but didnt understand how to use it without giving the elements.

and then try to model it in another way

sum[(i,s),Stationen*Zuordnung_AufgabenStationen(I,s)]; I is the last Task. but I dont know how to enter the last Task. I would probably have to use the Max function again which would be redundant, because i would then use it for Stationnumber. And then again the problem with the multiplication would occur.

Do you want to minimize the total number of stations used ?

Again,

If you want to sum Zuordnung_AufgabenStationen for only the last Task l, then something like below could work.

sum[(l,s)|l = last(SetTasks), Zuordnung_AufgabenStationen(l,s)]

My answer might not be what you are looking for because I don't have a proper understanding of your problem statement and how you have set up the different sets and variables, so sharing that would be helpful if you need more assistance.

I used Last(SetStations) and its working as i have expected. Thanks a lot.

I havent add the data yet and just now tried to add the data to the Tasks,but it didnt except it with the error "There is no operation defined for the operator = with arguments of data type numeric and data type element,arguments Number of Stations and last(Stations)". Aufgaben=Tasks .Stationsanzahl=Number of Stations. Zuordnung_AufgabenStationen=Assignment of tasks to Stations. Aufgabenzuordung= constraint for the task assignment. I send the picture for the variable Number of Stations and Tasks. j is the predecessortask.

Last(Stationen) will return a set element. A variable of a math program must be a numerical quantity, not a set element.

If you want to minimize the number of stations used, I would recommend creating a binary variable bvStationUsed(s) which represents if a station is used or not. 1 = station in use, 0 = station not used.

Now, in your objective function use the definition sum[s, bvStationUsed(s)] which would give the total number of stations used.

You will also need an additional constraint restricting that a station can be assigned task only if that station is in use. So, something like

Constraint(i, s) with definition Zuordnung_AufgabenStationen(i, s) <= bvStationUsed(s)

(Assuming the i is an index in the set of tasks)

Hello Mohan,

I applied it and I have also written the execution program and added the data. hovewer after I ran the program it didnt run any iterations and I had the notification that an integer solution to the program does not exist . When does this error happen?

Thanks a lot

I applied it and I have also written the execution program and added the data. hovewer after I ran the program it didnt run any iterations and I had the notification that an integer solution to the program does not exist . When does this error happen?

Thanks a lot

This article is a good resource for you to debug : https://how-to.aimms.com/Articles/136/136-Infeasible-Unbounded.html

Thank you:) I solved it

Already have an account? Login

**Please use your business or academic e-mail address to register**

No account yet? Create an account

Enter your username or e-mail address. We'll send you an e-mail with instructions to reset your password.

Didn't find what you were looking for? Try searching on our documentation pages: