help-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-glpk] Re: ordered and ord in MathProg?


From: Andrew Makhorin
Subject: Re: [Help-glpk] Re: ordered and ord in MathProg?
Date: Tue, 9 Feb 2010 06:34:20 +0300

> I search the archive regarding this topic -ord

> Andrew's reply below but hard to understand.

> http://www.mail-archive.com/address@hidden/msg01281.html

> Anyway, I tried to reformulate based on how I understand it. Revised
> model below.

> It is still not working.

set PP /*ordered*/;              # Set of SKU Numbers
set TT /*ordered*/;              # Set of Time Buckets

param ord{t in TT} := substr(t,1,1);

param P integer := card(PP); # Number of SKUs
param T integer := card(TT); # Number of Time Buckets
param M  >= 0;               # Large Number

param LT {PP} integer;      # Lead Time
param R  {PP,PP} integer;   # number of i to make one j
param D {PP, TT} integer;   # External Demand for an item in a period
param I {PP} integer;       # Beginning Inventory
param LS {PP} integer;      # Lot Size


var d {PP, TT} binary;      # production indicator
var x {PP, TT} >=0;         # number of SKUs to produce

# -----------------------------------------------------------------

minimize objective: sum {i in PP, t in TT}
                     (T-ord[t]+1) * x[i,t];

# -----------------------------------------------------------------

subject to MaterialRequirement {i in PP, t in TT}:
  (sum {s in TT: ord[s] <= ord[t]-LT[i] } x[i,s] )
   + I[i]
   - sum {s in TT: ord[s]<=ord[t]}
         (D[i,s] + sum {j in PP} R[i,j]* x[j,s])
   >= 0;

subject to LotSize {i in PP, t in TT}:
   x[i,t] - d[i,t]*LS[i] >= 0;

subject to ProductionIndicator {i in PP, t in TT}:
   d[i,t] - x[i,t]/M >=0;

data;

param M := 10000 ;              # Large number

param: PP: LT := AJ8172 2       # Items with Lead Times
                 LQ8811 3
                 RN0098 4
                 NN1100 1
                 WN7342 12;

set TT := 1jan04                # Time Buckets
          2jan04
          3jan04
          4jan04
          5jan04
          6jan04
          7jan04
          8jan04 ;

param R :                      # Number of i to produce one j
        AJ8172 LQ8811 RN0098 NN1100 WN7342  :=
AJ8172  0      0      0      0      0
LQ8811  2      0      0      0      0
RN0098  1      0      0      0      0
NN1100  0      1      0      0      0
WN7342  0      1      0      0      0  ;

param D:                       # external demand for i in t
        1jan04 2jan04 3jan04 4jan04 5jan04 6jan04 7jan04 8jan04 :=
AJ8172  20     30     10     20     30     20     30     40
LQ8811  0      0      0      0      0      0      0      0
RN0098  0      0      0      0      0      0      0      0
NN1100  0      0      0      0      0      0      0      0
WN7342  0      0      0      0      0      0      0      0;

param I := AJ8172 90           # Beginning Inventory of SKU i
           LQ8811 300
           RN0098 100
           NN1100 0
           WN7342 900;

param LS := AJ8172 100         # Lot Size
            LQ8811 400
            RN0098 100
            NN1100 1
            WN7342 1000;

GLPSOL: GLPK LP/MIP Solver, v4.43
Parameter(s) specified in the command line:
 -m foo.txt
Reading model section from foo.txt...
Reading data section from foo.txt...
foo.txt:85: warning: unexpected end of file; missing end statement inserted
85 lines were read
Generating objective...
Generating MaterialRequirement...
Generating LotSize...
Generating ProductionIndicator...
Model has been successfully generated
GLPK Integer Optimizer, v4.43
121 rows, 80 columns, 418 non-zeros
40 integer variables, all of which are binary
Preprocessing...
15 constraint coefficient(s) were reduced
109 rows, 78 columns, 347 non-zeros
39 integer variables, all of which are binary
Scaling...
 A: min|aij| =  1.000e-04  max|aij| =  1.000e+03  ratio =  1.000e+07
GM: min|aij| =  1.000e-01  max|aij| =  1.000e+01  ratio =  1.000e+02
EQ: min|aij| =  1.000e-02  max|aij| =  1.000e+00  ratio =  1.000e+02
2N: min|aij| =  6.400e-03  max|aij| =  1.562e+00  ratio =  2.441e+02
Constructing initial basis...
Size of triangular part = 109
Solving LP relaxation...
GLPK Simplex Optimizer, v4.43
109 rows, 78 columns, 347 non-zeros
      0: obj =   0.000000000e+00  infeas =  3.750e+01 (0)
*    14: obj =   6.400000000e+02  infeas =  0.000e+00 (0)
*    19: obj =   5.300000000e+02  infeas =  2.711e-16 (0)
OPTIMAL SOLUTION FOUND
Integer optimization begins...
+    19: mip =     not found yet >=              -inf        (1; 0)
+    34: >>>>>   6.800000000e+03 >=   5.500000000e+02  91.9% (6; 0)
+   132: mip =   6.800000000e+03 >=     tree is empty   0.0% (0; 37)
INTEGER OPTIMAL SOLUTION FOUND
Time used:   0.0 secs
Memory used: 0.3 Mb (346074 bytes)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]