Skip to main content

Hello,

I need help with implementing my model in Aimms. I want to implement a work staff optimizing model with on-call services. I want to show that on call-services can help with temporary bottlenecks and variable demand.

Sets:

t – Periods

j - Layers

Parameters:

a (t,j) – Period of use

b (t) – Staff requirements

Variables:

x (j) – regular employees

k (j) – on-call-services employees

 

This ist the optimizing model:

minj=1Jxj+kj

 

 

These are my constraints:

Demand fulfilment:
J=1Jatj×xj+kjbt                                     t

 

Deployment of employees:

(x(j)+k(j))>= 1

xj∈N                       j

 

kj∈N                         j

 

 

 

I wanted to implement it like this:

Set Periods {

             Index: t;

       }

       Variable x {

             IndexDomain: j;

             Range: {

                    {0..7}

             }

       }

       Parameter a {

             IndexDomain: (t,j);

             Range: binary;

       }

       Variable TotalMitabeiter {

             Range: free;

             Definition: sum(j, x(j) + k(j));

       }

       Variable k {

             IndexDomain: j;

             Range: (0, 3);

       }

       Set Layers {

             Index: j;

       }

       Constraint DemandFulfilment {

             IndexDomain: t;

             Definition: sum(j, a(t, j) * (x(j)+k(j)))>= b(t);

       }

       Constraint Deploymentofemployees {

             IndexDomain: j;

             Definition: {

                    (x(j)+k(j))>= 1;

             }

       }

       MathematicalProgram Solution {

             Objective: TotalMitabeiter;

             Direction: minimize;

             Constraints: AllConstraints;

             Variables: AllVariables;

             Type: Automatic;

       }

       Parameter b {

             IndexDomain: t;

             Range: nonnegative;

       }

       Procedure MainInitialization {

             Comment: "Add initialization statements here that do NOT require any library being initialized already.";

       }

       Procedure PostMainInitialization {

             Comment: {

                    "Add initialization statements here that require that the libraries are already initialized properly,

                    or add statements that require the Data Management module to be initialized."

             }

       }

       Procedure MainExecution {

             Body: {

                    solve Solution;

             }

       }

       Procedure PreMainTermination {

             Body: {

                    return DataManagementExit();

             }

             Comment: {

                    "Add termination statements here that require all libraries to be still alive.

                    Return 1 if you allow the termination sequence to continue.

                    Return 0 if you want to cancel the termination sequence."

             }

       }

       Procedure MainTermination {

             Body: {

                    return 1;

             }

             Comment: {

                    "Add termination statements here that do not require all libraries to be still alive.

                    Return 1 to allow the termination sequence to continue.

                    Return 0 if you want to cancel the termination sequence.

                    It is recommended to only use the procedure PreMainTermination to cancel the termination sequence and let this procedure always return 1."

             }

The Problem now ist hat Aimms says, the model is infeasible. What can I do better, that the model can be solved?

I would recommend to take a look at the how-to https://how-to.aimms.com/Articles/610/610-infeasible-model.html

 

My guess would be that one of the constraints you created is not looping over the exact index combinations in a sum that you would expect.

In case you have a small problem, the easiest might be to generate a constraint listing and just go through that because the constraint listing is just a text file. If the problem is a bit more complex, the Math Program Inspector might be easier.


Thank you for your answer! How do I generate a constraint listing?


See the instructions in the how-to I linked


@liv.stg You are using the range (0, 3) for variable k, which is unusual. It means that 0 and 3 will be excluded. If both values should be included then you should use range g0, 3]. (Note that fixing this might not resolve the infeasibility.)


I fixed my model and got some good solutions. But one question is still left: How can I restrict an employee to working only one shift per period? Do I need another constraint for it? And how does it look like?


Your variable x(j) seems to define the number of regular employees used for layer j. It seems to me that this automatically implies that an employee only works one shift per period.


Reply


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

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator