Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  help :-)

    Posted 12/02/11 10:52 AM

    Originally posted by: John85655


    Hi
    
    
    
    int cut = ...; 
    
    int i = ...;
    //product 
    
    int j = ...;
    //machine 
    
    int k = ...;
    //process 
    
    int l = ...;
    //location range Cut = 1..cut;
    //process cut range ATL = cut+1..j;
    //process ATL range S = 1..i;
    //product range range T = 1..j;
    //machine range range Standort = 1..l;
    //location range       
    
    float h [ 1..i][1..k]=...;
    //processes required by a product 
    
    float d [ 1..i][1..k] = ...; 
    //demand of product s on a certain process 
    
    int feasibility[ 1..i][ 1..j] = ...;
    //feasibility of a product on a machine {0,1} 
    
    float cf[ 1..j] = ...;
    //fix costs 
    
    float cv[1..i][1..j]=...;
    //variable costs 
    
    int cap [ 1..i][ 1..j]=...;
    //capacity of product s on machine t     dvar 
    
    float costCut;
    //costs for process Cut dvar 
    
    float costATL;
    //costs for process ATL dvar int+ x[ 1..i][ 1..j];
    //number of parts of product s on machine t dvar 
    
    float cost;
    //costs   minimize cost; subject to 
    { forall(s in S, t in T)
    { cost == costCut+costATL; costCut==(sum(s in S)sum(t in Cut)((cv[s][t]*x[s][t]+ cf[t]))); costATL==(sum(s in S)sum(t in ATL)((cv[s][t]*x[s][t]+ cf[t]))); 
    } 
    /**product s can just get produced on a machine if the feasibility is equal to zero**/ forall (t in T, s in S, a in Standort) 
    
    if (feasibility[s][t] ==0) x[s][t] ==0;   
    /**If a part does not require the process Cut, then x equals =0**/ forall (s in S, t in Cut) 
    
    if (h[s][1] ==0) x[s][t] ==0; 
    /**The amount of product s for the process Cut on the feasibile machine has to be equal to the demand**/ forall (s in S) 
    
    if (h[s][1] ==1) sum(t in Cut)x[s][t]== d[s][1]; 
    /**If a part does not require the process ATL, then x equals =0**/ forall (s in S, t in ATL) 
    
    if(h[s][2] ==0) x[s][t] ==0; 
    /**The amount of product s for the process ATL on the feasibile machine has to be equal to the demand**/ forall (s in S) 
    
    if (h[s][2] ==1) sum(t in ATL)x[s][t]== d[s][2]; 
    /**Machine capacity restriction**/ forall(t in T, s in S) sum(s in S)(x[s][t])<=cap[s][t]; 
    }
    


    further information:
    • machine 1 is located in A
    • machine 2 is the same machine like machine 1 but located in B
    • machine 3 is the same machine like machine 1 an 2 but located in C
    • machine 4 is another machine located in A
    • machine 5 is the same machine like machine 4 but located in B
    • machine 6 is the same machine like machine 4 an 5 but located in C
    -.....

    machine 123 has to be located in the same location (A,B,C) for all products.

    allowed solution

    
    [0 400 0 0 0 0 0 0 0 0 0 0] [0 0 0 300 0 0 0 0 0 300 0 0] [0 200 0 0 0 0 0 0 0 200 0 0]
    


    not allowed solution of x:

    
    [0 400 0 0 0 0 0 0 0 0 0 0] [0 0 0 300 0 0 0 0 0 300 0 0] [200 0 0 0 0 0 0 0 0 0 200 0]
    

    Does anyone has an idea how to built this restriction?

    I do not have an extra array for the location because i want to write it out in an excle file.

    thanks for your help,
    john
    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: help :-)

    Posted 12/02/11 08:11 PM

    Originally posted by: SystemAdmin


    > machine 123 has to be located in the same location (A,B,C) for all
    > products.

    Your requirements are not very clear in the absence of the corresponding .dat file. Could you attach/provide it? It will help us understand as to why one solution is allowed and the other isn't; thereby come up an appropriate constraint.
    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: help :-)

    Posted 12/03/11 07:59 AM

    Originally posted by: John85655


    Hi,
    thanks for replying. As I have no access to the .data file at the moment, I will provide it here in the forum on monday.

    Sorry for the bad description:

    machine 1,2 and 3 are the same machine. this machine is called machine 1 if it is located in A, 2 if it is placed in B and 3 if in C.
    I need a constraint that just allow the production on one of the three machines. And this machine has to be the same for all products.
    The solution now says for instance produce 400 of product 1 on machine 2 and 500 of product 2 on machine 3. But as it is the same machine it can't be located in B and in C because we have just one machine.
    I hope my explanation is understandable and that you can help me with this problem :-)
    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: help :-)

    Posted 12/05/11 05:50 AM

    Originally posted by: John85655


    here the data file:
    i = 3;
    j = 12;
    k = 2;
    l=3;
    cut = 6;
     
     
    SheetConnection sheet("Daten.xls");
     
    d from SheetRead(sheet,"B2:C4");
    feasibility from SheetRead(sheet,"B8:M10");
    h from SheetRead(sheet,"B48:C50");
    cv from SheetRead(sheet,"B15:M17");
    cf from SheetRead(sheet,"B21:M21");           
    cap from SheetRead(sheet,"B59:M61");  
    cost to SheetWrite(sheet,"Result!A1");
    x to SheetWrite(sheet,"Result!B3:M5");
    

    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: help :-)

    Posted 12/05/11 04:00 PM

    Originally posted by: SystemAdmin


    Thank you for elaborating on your requirements. You would need to introduce a boolean variable to denote if a particular machine is producing goods or not and then restrict the sum of this variable to 1 between the different machine groups. In your example, you have 12 machines and 3 locations, which means that you have 4 different machines which could be in location A, B or C. The following code is one way to implement this approach:

    
    ... dvar int+ x[ 1..i][ 1..j];
    //number of parts of product s on machine t dvar 
    
    boolean isProducing[1..j];
    //boolean variable to denote if a machine is producing goods or not 
    
    int machineGroups = ftoi(j/l); dvar 
    
    float cost;
    //costs ... subject to 
    { ... 
    /**set isProducing based on if product quantity is greater than >=1 using indicator constraints**/ forall(t in T)
    { (sum(s in S)x[s][t]>=1) => (isProducing[t]==1); (sum(s in S)x[s][t]<=0) => (isProducing[t]==0); 
    } 
    /**limit the number of isProducing to a maximum of 1 between same machines**/ forall(c in 1..machineGroups)
    { sum(cIndex in 1+l*(c-1)..l*c) isProducing[cIndex] <=1; 
    }
    

    Since the dat file seems to connect with an excel file - "Daten.xls", which was not part of your post, I was not able to check this though.

    Hope this helps and provides you with a way forward.
    #CPLEXOptimizers
    #DecisionOptimization