Operations Research topics: SAS/OR,
SAS Optimization, and SAS Simulation Studio

"Infeasible or Unbounded" Solution Status

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 86
Accepted Solution

"Infeasible or Unbounded" Solution Status

Hi,

I just fixed my SAS code, while the solution status is still "Unbounded or Infeasible". It runs with no errors. What probably the reason ?

Thanks!

The code is as below .Sorry I cannot upload more than 1k)

Title 'A Serial Supply Chain example';

/*Define Customer Demand*/

Data Demand1;

  input product demand_1;

  datalines;

1  300

2  400

;

Data Demand2;

  input product demand_2;

  datalines;

1  600

2  700

;

Data Demand3;

  input product demand_3;

  datalines;

1  1200

2  1400

;

Data Demand4;

  input product demand_4;

  datalines;

1  1250

2  1100

;

Data Demand5;

  input product demand_5;

  datalines;

1  300

2  400

;

/*Define in-transit inventory holding cost*/

Data in_transit_cost1;

  input supplier type cost;

  datalines;

1  1  2.0

1  2  1.0

2  1  2.2

2  2  0.9

3  1  1.8

3  2  1.1

;

Data in_transit_cost2;

  input type stage cost;

  datalines;

1  2   7.5

1  3   8.5

2  2   9.5

2  3  11.5

;

/*Define price interval for raw materials*/

Data price_interval1;

  input supplier raw_material interval1 interval2 interval3;

  datalines;

1  1   9   9   9

1  2   7   7   7

;

Data price_interval2;

  input supplier raw_material interval1 interval2 interval3;

  datalines;

2  1  10   9   8

2  2   8   7   6

;

Data price_interval3;

  input supplier raw_material interval1 interval2 interval3;

  datalines;

3  1  11  10   9

3  2   9   7   5

;

/*Define manufacture and inventory capacity*/

Data Capacity;

  input time_period produce_cap inv_cap1 inv_cap2 inv_cap3 inv_cap4;

  datalines;

1  2000  3000  12000  12000  12000

2  1200  3000  12000  12000  12000

3   800  3000  12000  12000  12000

4   800  3000  12000  12000  12000

5  2000  3000  12000  12000  12000

;

/*Define the transformation of raw materials into finished products*/

Data Bill_Ratio;

  input raw_material product1 product2;

  datalines;

1  2  3

2  3  2

;

/*Define Production Rate*/

Data Pro_rate;

  input product pro_rate;

  datalines;

1  2 

2  1.5 

;

/*Define fill-in rate of raw materials and final products into 1 container*/

Data Fill_Ratio1;

  input raw_material fill1;

  datalines;

1  1.8

2  2.0

;

Data Fill_Ratio2;

  input product fill2;

  datalines;

1  2.5

2  3.0

;

/*Description of raw material suppliers*/

Data Supplier_info;

  input supplier lead_time raw_material1 raw_material2 perfect_rate1 perfect_rate2 major_cost minor1_cost minor2_cost time_period;

  datalines;

1  0  9000  9000  0.97  0.97  9000  10000  11000  1

2  1  3500  3500  0.95  0.96  5000   7000   6000  1

3  1  4000  4000  0.96  0.95  3000   3500   3000  1

;

/*Define minimum perfect rate*/

Data min_perfect;

  input raw_material min_perfect;

  datalines;

1    0.96

2    0.96

;

/*Define Inventory Holding Cost and Production Cost*/

Data Raw_inv_cost;

  input raw_material time_period1 time_period2 time_period3 time_period4;

  datalines;

1  1.8  1.8  1.8  1.8 

2  1.5  1.5  1.5  1.5 

;

/*The following does not consider time_periods, just repeat*/

Data Product_inv_cost;

  input  product stages2 stages3;

  datalines;

1   7  9

2  11  9

;

Data Product_inv_cost1;

  input product holding_3;

  datalines;

1   8

2  12

;

Data Produce_cost;

  input product time_period1 time_period2 time_period3 time_period4 time_period5;

  datalines;

1  24  25  29  29  24

2  29  30  35  35  29

;

/*Define in-transit inventory holding cost*/

Data in_transit_cost1;

  input supplier raw_material1 raw_material2;

  datalines;

1  2.0  1.5

2  2.2  1.4

3  1.8  1.6

;

Data in_transit_cost2;

  input product stage2 stage3;

  datalines;

1  7.5  8.5

2  9.5  11.5

;

/*Define truck capacity and cost information*/

Data truck_cap;

  input truck truck_cap;

  datalines;

1  75

2  85

3  95

;

Data truck_cost_1;

  input supplier truck1 truck2 truck3;

  datalines;

1  3000  3500  4000

2  2800  3200  3800

3  3100  3300  3900

;

Data truck_cost_2;

  input stage truck1 truck2 truck3;

  datalines;

2  1100  1000  1200

3  5500  5000  6000

;

/*Define major and minor fixed cost at manufacture stage*/

Data Minor_cost;

  input supplier raw_material1 raw_material2;

  datalines;

1  5000  6000

2  4000  3000

3  3500  3000

;

/*Data Minor_cost2;*/

/*  input raw_material time_period1 time_period2 time_period3 time_period4 time_period5;*/

/*  datalines;*/

/*1  4000  4000  4000  4000  .  */

/*2  3000  3000  3000  3000  .*/

/*;*/

/**/

/*Data Minor_cost3;*/

/*  input raw_material time_period1 time_period2 time_period3 time_period4 time_period5;*/

/*  datalines;*/

/*1  3500  3500  3500  3500  .  */

/*2  3000  3000  3000  3000  .*/

/*;*/

Data Major_cost;

  input supplier time_period1 time_period2 time_period3 time_period4 time_period5;

  datalines;

1  9000  9000  9000  9000  9000

2  5000  5000  5000  5000  5000

3  3000  3000  3000  3000  5000

;

Data Major_cost_1;

  input stage time_period1 time_period2 time_period3 time_period4 time_period5;

  datalines;

2  4000  4000  4000  4000  4000 

3  4000  4000  4000  4000  4000 

;

Data Minor_cost_1;

  input product time_period1 time_period2 time_period3 time_period4 time_period5;

  datalines;

1   1500   1500   1500   1500   1500

2   1250   1250   1250   1250   1250

;

/*Define price interval for raw materials*/

Data boundary_quantity;

  input raw_material quantity1 quantity2 quantity3;

  datalines;

1  1000  2000  10000000

2  1000  2000  10000000

;

Data initial_1;

  input raw_material initial_1;

  datalines;

1   1500

2   1700

;

Data ending_1;

  input raw_material ending_1;

  datalines;

1   500

2   700

;

Data initial_2;

  input product initial_2;

  datalines;

1   1500

2   1200

;

Data ending_2;

  input product ending_2;

  datalines;

1   500

2   400

;

Data initial_3;

  input product initial_3;

  datalines;

1    900

2    700

;

Data ending_3;

  input product ending_3;

  datalines;

1   400

2   300

;

Data initial_4;

  input product initial_4;

  datalines;

1   1000

2    750

;

Data ending_4;

  input product ending_4;

  datalines;

1   500

2   300

;

Proc Optmodel;

/*Declare Index Sets*/

set SUPPLIERS;

set SUPPLIERS_1 = {1};

set SUPPLIERS_2 = 1..3;

set SUPPLIERS_3 = 1..3;

set SUPPLIERS_4 = 1..3;

set SUPPLIERS_5 = 1..3;

/*set TIME_01 = 1..5;*/

/*set TIME_02 = 1..4;*/

set TIME_PERIOD_1 = 1..4;

/*set TIME_1 = 2..5;*/

/*set TIME_2 = 1..5;*/

/*set TIME_3 = 2..5;*/

/*set TIME_4 = 1..5;*/

set RAW_MATERIALS;

set PRODUCTS;

set STAGES = 2..4;

set STAGES1 = 1..4;

set STAGES2 = 2..3;

set STAGES3;

set STAGES4;

/*set STAGES5;*/

set TIME_PERIODS = 1..5;

set TRUCKS = 1..3;

set TRUCKS1;

set PRICE_INTERVALS = 1..3 ;

/*Declare Parameters*/

num BIGM = 1000000;

num B = 1000000;

num fill1 {RAW_MATERIALS};

read data Fill_Ratio1 into RAW_MATERIALS = [raw_material] fill1;

/*print fill1;*/

num fill2 {PRODUCTS};

read data Fill_Ratio2 into PRODUCTS = [product] fill2;

/*print fill2;*/

num bill_ratio {RAW_MATERIALS,PRODUCTS};

read data Bill_ratio into RAW_MATERIALS = [raw_material]

          {p in PRODUCTS} <bill_ratio[raw_material,p]=col("product"||p)>;

/*print bill_ratio;*/

/*The following does not consider time_periods*/

num supplier_cap {SUPPLIERS, RAW_MATERIALS};

read data Supplier_info into SUPPLIERS = [supplier]

          {m in RAW_MATERIALS} <supplier_cap[supplier,m]=col("raw_material"||m)>;

/*print supplier_cap;*/

/*num produce_cap {TIME_PERIODS};*/

/*read data Capacity into TIME_PERIODS = [time_period] produce_cap;*/

/*print produce_cap;*/

num produce_cap1 = 2000;

num produce_cap2 = 1200;

num produce_cap3 = 800;

num produce_cap4 = 800;

num produce_cap5 = 2000;

num inv_cap1 = 6000;

/*num inv_capk {STAGES5};*/

/*read data Capacity1 into STAGES5 = [stage] inv_capk;*/

/*print inv_capk;*/

num inv_capk = 12000;

/*num inv_cap {TIME_PERIODS, STAGES1};*/

/*read data Capacity into TIME_PERIODS = [time_period] */

/*          {k in STAGES1} <inv_cap[time_period,k]=col("inv_cap"||k)>;*/

/*print inv_cap;*/

num major_order_1 = 5000;

num pro_rate {PRODUCTS};

read data Pro_rate into PRODUCTS=[product] pro_rate;

print pro_rate;

num perfect_rate {SUPPLIERS, RAW_MATERIALS};

read data Supplier_info into SUPPLIERS = [supplier]

          {m in RAW_MATERIALS} <perfect_rate[supplier,m]=col("perfect_rate"||m)>;

/*print perfect_rate;*/

num min_perfect {RAW_MATERIALS};

read data min_perfect into RAW_MATERIALS = [raw_material] min_perfect;

/*print min_perfect;*/

num demand_1 {PRODUCTS};

read data Demand1 into PRODUCTS = [product] demand_1;

/*print demand;*/

num demand_2 {PRODUCTS};

read data Demand2 into PRODUCTS = [product] demand_2;

/*print demand;*/

num demand_3 {PRODUCTS};

read data Demand3 into PRODUCTS = [product] demand_3;

/*print demand;*/

num demand_4 {PRODUCTS};

read data Demand4 into PRODUCTS = [product] demand_4;

/*print demand;*/

num demand_5 {PRODUCTS};

read data Demand5 into PRODUCTS = [product] demand_5;

/*print demand;*/

num holding_1 {RAW_MATERIALS, TIME_PERIOD_1};

read data Raw_inv_cost into RAW_MATERIALS = [raw_material]

                            {t in TIME_PERIOD_1} <holding_1[raw_material,t]=col("time_period"||t)>;

print holding_1;

num holding_2 {PRODUCTS, STAGES2};

read data Product_inv_cost into PRODUCTS = [product]

                                {k in STAGES2} <holding_2[product,k]=col("STAGES"||k)>;

/*print holding_2;*/

num holding_3 {PRODUCTS};

read data Product_inv_cost1 into PRODUCTS = [product] holding_3;

print holding_3;

num in_transit_1 {SUPPLIERS, RAW_MATERIALS};

read data in_transit_cost1 into SUPPLIERS = [supplier]

                                {m in RAW_MATERIALS} <in_transit_1[supplier,m]=col("raw_material"||m)>;

/*print in_transit_1;*/

num in_transit_2 {PRODUCTS, STAGES2};

read data in_transit_cost2 into PRODUCTS = [product]

                                {k in STAGES2} <in_transit_2[product,k]=col("stage"||k)>;

print in_transit_2;

num unit_price1 {RAW_MATERIALS, PRICE_INTERVALS};

read data price_interval1 into RAW_MATERIALS = [raw_material]

                               {q in PRICE_INTERVALS} <unit_price1[raw_material,q]=col("interval"||q)>;

/*print unit_price1; */

num unit_price2 {RAW_MATERIALS, PRICE_INTERVALS};

read data price_interval2 into RAW_MATERIALS = [raw_material]

                               {q in PRICE_INTERVALS} <unit_price2[raw_material,q]=col("interval"||q)>;

/*print unit_price2; */

num unit_price3 {RAW_MATERIALS, PRICE_INTERVALS};

read data price_interval3 into RAW_MATERIALS = [raw_material]

                               {q in PRICE_INTERVALS} <unit_price3[raw_material,q]=col("interval"||q)>;

/*print unit_price3; */

num major_cost {SUPPLIERS, TIME_PERIODS};

read data major_cost into SUPPLIERS = [supplier]

                          {t in TIME_PERIODS} <major_cost[supplier,t]=col("time_period"||t)>;

/*print major_cost;*/

num minor_cost {SUPPLIERS, RAW_MATERIALS};

read data Minor_cost into SUPPLIERS = [supplier]

                           {m in RAW_MATERIALS} <Minor_cost[supplier,m]=col("raw_material"||m)>;

/*print minor_cost;*/

num produce_cost {PRODUCTS, TIME_PERIODS};

read data produce_cost into PRODUCTS = [product]

                            {t in TIME_PERIODS} <produce_cost[product,t]=col("time_period"||t)>;

/*print produce_cost;*/

num Major_cost_1 {STAGES3, TIME_PERIODS};

read data Major_cost_1 into STAGES3 = [stage]

                            {t in TIME_PERIODS} <Major_cost_1[stage,t]=col("time_period"||t)>;

/*print Major_cost_1;*/

num Minor_cost_1 {PRODUCTS, TIME_PERIODS};

read data Minor_cost_1 into PRODUCTS = [product]

                            {t in TIME_PERIODS} <Minor_cost_1[product,t]=col("time_period"||t)>;

/*print Minor_cost_1;*/

num truck_cost_1 {SUPPLIERS, TRUCKS};

read data truck_cost_1 into SUPPLIERS = [supplier]

                            {r in TRUCKS} <truck_cost_1[supplier,r]=col("truck"||r)>;

/*print truck_cost_1;*/

num truck_cost_2 {STAGES4, TRUCKS};

read data truck_cost_2 into STAGES4 = [stage]

                            {r in TRUCKS} <truck_cost_2[stage,r]=col("truck"||r)>;

/*print truck_cost_2;*/

num truck_cap {TRUCKS1};

read data truck_cap into TRUCKS1 = [truck] truck_cap;

/*print truck_cap;*/

num boundary_quantity {RAW_MATERIALS, PRICE_INTERVALS};

read data boundary_quantity into RAW_MATERIALS = [raw_material]

                                 {q in PRICE_INTERVALS} <boundary_quantity[raw_material,q]=col("quantity"||q)>;

print boundary_quantity;

num initial_1 {RAW_MATERIALS};

read data initial_1 into RAW_MATERIALS = [raw_material] initial_1;

num ending_1 {RAW_MATERIALS};

read data ending_1 into RAW_MATERIALS = [raw_material] ending_1;

num initial_2 {PRODUCTS};

read data initial_2 into PRODUCTS = [product] initial_2;

num ending_2 {PRODUCTS};

read data ending_2 into PRODUCTS = [product] ending_2;

num initial_3 {PRODUCTS};

read data initial_3 into PRODUCTS = [product] initial_3;

num ending_3 {PRODUCTS};

read data ending_3 into PRODUCTS = [product] ending_3;

num initial_4 {PRODUCTS};

read data initial_4 into PRODUCTS = [product] initial_4;

num ending_4 {PRODUCTS};

read data ending_4 into PRODUCTS = [product] ending_4;

/*Declare the variable*/

var raw_quantity1_1 {RAW_MATERIALS, PRICE_INTERVALS}>=0; /*For supplier 1, 0 time period*/

var raw_quantity1_2 {RAW_MATERIALS, PRICE_INTERVALS}>=0;

var raw_quantity1_3 {RAW_MATERIALS, PRICE_INTERVALS}>=0;

var raw_quantity1_4 {RAW_MATERIALS, PRICE_INTERVALS}>=0;

var raw_quantity1_5 {RAW_MATERIALS, PRICE_INTERVALS}>=0;

var raw_quantity2_1 {RAW_MATERIALS, PRICE_INTERVALS}>=0; /*For supplier 2, 0 time period*/

var raw_quantity2_2 {RAW_MATERIALS, PRICE_INTERVALS}>=0;

var raw_quantity2_3 {RAW_MATERIALS, PRICE_INTERVALS}>=0;

var raw_quantity2_4 {RAW_MATERIALS, PRICE_INTERVALS}>=0;

var raw_quantity3_1 {RAW_MATERIALS, PRICE_INTERVALS}>=0; /*For supplier 3, 0 time period*/

var raw_quantity3_2 {RAW_MATERIALS, PRICE_INTERVALS}>=0;

var raw_quantity3_3 {RAW_MATERIALS, PRICE_INTERVALS}>=0;

var raw_quantity3_4 {RAW_MATERIALS, PRICE_INTERVALS}>=0;

var raw_quantity_1 {SUPPLIERS, RAW_MATERIALS}>=0; /*Total quantity of raw materials*/

var raw_quantity_2 {SUPPLIERS, RAW_MATERIALS}>=0;

var raw_quantity_3 {SUPPLIERS, RAW_MATERIALS}>=0;

var raw_quantity_4 {SUPPLIERS, RAW_MATERIALS}>=0;

var raw_quantity_5 {SUPPLIERS, RAW_MATERIALS}>=0;

var inv_raw {RAW_MATERIALS, TIME_PERIOD_1}>=0; /*Inventory for raw materials*/

var inv_raw1 {RAW_MATERIALS}>=0;

var inv_raw2 {RAW_MATERIALS}>=0;

var inv_raw3 {RAW_MATERIALS}>=0;

var inv_raw4 {RAW_MATERIALS}>=0;

/*var inv_raw5 {RAW_MATERIALS}>=0;*/

var inv_pro1 {PRODUCTS, STAGES2}>=0; /*Inventory for final products*/

var inv_pro2 {PRODUCTS, STAGES2}>=0;

var inv_pro3 {PRODUCTS, STAGES2}>=0;

var inv_pro4 {PRODUCTS, STAGES2}>=0;

/*var inv_pro5 {PRODUCTS, STAGES}>=0;*/

var inv_pro2_1 {PRODUCTS}>=0;

var inv_pro2_2 {PRODUCTS}>=0;

var inv_pro2_3 {PRODUCTS}>=0;

var inv_pro2_4 {PRODUCTS}>=0;

/*var inv_pro2_5 {PRODUCTS}>=0;*/

var inv_pro3_1 {PRODUCTS}>=0;

var inv_pro3_2 {PRODUCTS}>=0;

var inv_pro3_3 {PRODUCTS}>=0;

var inv_pro3_4 {PRODUCTS}>=0;

/*var inv_pro3_5 {PRODUCTS}>=0;*/

var inv_pro4_1 {PRODUCTS}>=0;

var inv_pro4_2 {PRODUCTS}>=0;

var inv_pro4_3 {PRODUCTS}>=0;

var inv_pro4_4 {PRODUCTS}>=0;

/*var inv_pro4_5 {PRODUCTS}>=0;*/

var pro_size {PRODUCTS, TIME_PERIODS}>=0; /*production size*/

var pro_size1 {PRODUCTS}>=0;

var pro_size2 {PRODUCTS}>=0;

var pro_size3 {PRODUCTS}>=0;

var pro_size4 {PRODUCTS}>=0;

var pro_size5 {PRODUCTS}>=0;

var rep_size_1 {PRODUCTS, STAGES2}>=0;

var rep_size_12 {PRODUCTS}>=0;

var rep_size_13 {PRODUCTS}>=0;

var rep_size_2 {PRODUCTS, STAGES2}>=0; /*Replenish order*/

var rep_size_22 {PRODUCTS}>=0;

var rep_size_23 {PRODUCTS}>=0;

var rep_size_3 {PRODUCTS, STAGES2}>=0;

var rep_size_32 {PRODUCTS}>=0;

var rep_size_33 {PRODUCTS}>=0;

var rep_size_4 {PRODUCTS, STAGES2}>=0;

var rep_size_42 {PRODUCTS}>=0;

var rep_size_43 {PRODUCTS}>=0;

var rep_size_5 {PRODUCTS, STAGES2}>=0;

var rep_size_52 {PRODUCTS}>=0;

var rep_size_53 {PRODUCTS}>=0;

/*The amount of trucks should be integer*/

var truck_raw_1 {SUPPLIERS, TRUCKS} integer;

var truck_raw_2 {SUPPLIERS, TRUCKS} integer;

var truck_raw_3 {SUPPLIERS, TRUCKS} integer;

var truck_raw_4 {SUPPLIERS, TRUCKS} integer;

var truck_raw_5 {SUPPLIERS, TRUCKS} integer;

var truck_pro_1 {STAGES4, TRUCKS} integer;

var truck_pro_2 {STAGES4, TRUCKS} integer;

var truck_pro_3 {STAGES4, TRUCKS} integer;

var truck_pro_4 {STAGES4, TRUCKS} integer;

var truck_pro_5 {STAGES4, TRUCKS} integer;

/*Below are binary variables*/

var repl_order_1 {SUPPLIERS, TIME_PERIODS} binary; /*Major for suppliers*/

var repl_order_11 {SUPPLIERS} binary;

var repl_order_12 {SUPPLIERS} binary;

var repl_order_13 {SUPPLIERS} binary;

var repl_order_14 {SUPPLIERS} binary;

var repl_order_15 {SUPPLIERS} binary;

var repl_raw1 {SUPPLIERS, RAW_MATERIALS} binary;/*Minor in suppliers*/

var repl_raw2 {SUPPLIERS, RAW_MATERIALS} binary;

var repl_raw3 {SUPPLIERS, RAW_MATERIALS} binary;

var repl_raw4 {SUPPLIERS, RAW_MATERIALS} binary;

var repl_raw5 {SUPPLIERS, RAW_MATERIALS} binary;

var repl_order_k {STAGES2, TIME_PERIODS} binary;/*Major cost in later stages*/

var repl_order_k1 {STAGES2} binary;

var repl_order_k2 {STAGES2} binary;

var repl_order_k3 {STAGES2} binary;

var repl_order_k4 {STAGES2} binary;

var repl_order_k5 {STAGES2} binary;

var manu_order {PRODUCTS, TIME_PERIODS} binary;/*Minor for final products*/

var repl_manu1  binary;/*For stage 1*/

var repl_manu2  binary;

var repl_manu3  binary;

var repl_manu4  binary;

var repl_manu5  binary;

var raw_order1_1 {RAW_MATERIALS, PRICE_INTERVALS} binary;

var raw_order1_2 {RAW_MATERIALS, PRICE_INTERVALS} binary;

var raw_order1_3 {RAW_MATERIALS, PRICE_INTERVALS} binary;

var raw_order1_4 {RAW_MATERIALS, PRICE_INTERVALS} binary;

var raw_order1_5 {RAW_MATERIALS, PRICE_INTERVALS} binary;

var raw_order2_1 {RAW_MATERIALS, PRICE_INTERVALS} binary;

var raw_order2_2 {RAW_MATERIALS, PRICE_INTERVALS} binary;

var raw_order2_3 {RAW_MATERIALS, PRICE_INTERVALS} binary;

var raw_order2_4 {RAW_MATERIALS, PRICE_INTERVALS} binary;

var raw_order3_1 {RAW_MATERIALS, PRICE_INTERVALS} binary;

var raw_order3_2 {RAW_MATERIALS, PRICE_INTERVALS} binary;

var raw_order3_3 {RAW_MATERIALS, PRICE_INTERVALS} binary;

var raw_order3_4 {RAW_MATERIALS, PRICE_INTERVALS} binary;

/*Maximize the objective function*/

Max  Z = -sum {j in SUPPLIERS, t in TIME_PERIODS} major_cost[j,t]*repl_order_1[j,t]

                   - sum {j in SUPPLIERS, m in RAW_MATERIALS} minor_cost[j,m]*(repl_raw1[j,m] + repl_raw2[j,m] + repl_raw3[j,m] + repl_raw4[j,m] + repl_raw5[j,m])

                   - sum {m in RAW_MATERIALS, q in PRICE_INTERVALS} (unit_price1[m,q]*raw_quantity1_1[m,q]

                                                   + unit_price1[m,q]*raw_quantity1_2[m,q]
   + unit_price1[m,q]*raw_quantity1_3[m,q]
   + unit_price1[m,q]*raw_quantity1_4[m,q]
   + unit_price1[m,q]*raw_quantity1_5[m,q]

                                                                   + unit_price2[m,q]*raw_quantity2_1[m,q]

   + unit_price2[m,q]*raw_quantity2_2[m,q]
   + unit_price2[m,q]*raw_quantity2_3[m,q]
   + unit_price2[m,q]*raw_quantity2_4[m,q]
                                                   + unit_price3[m,q]*raw_quantity3_1[m,q]
   + unit_price3[m,q]*raw_quantity3_2[m,q]
   + unit_price3[m,q]*raw_quantity3_3[m,q]
   + unit_price3[m,q]*raw_quantity3_4[m,q])
   - sum {p in PRODUCTS, t in TIME_PERIODS} (minor_cost_1[p,t]*manu_order[p,t] + produce_cost[p,t]*pro_size[p,t])
   - sum {k in STAGES2, t in TIME_PERIODS} major_cost_1[k,t]*repl_order_k[k,t] - major_order_1*(repl_manu1 + repl_manu2 + repl_manu3 + repl_manu4 + repl_manu5)

                   - sum {m in RAW_MATERIALS, t in TIME_PERIOD_1} holding_1[m,t]*inv_raw[m,t]

   - sum {p in PRODUCTS, k in STAGES2} holding_2[p,k]*(inv_pro1[p,k] + inv_pro2[p,k] + inv_pro3[p,k] + inv_pro4[p,k])
   - sum {p in PRODUCTS} holding_3

*(inv_pro4_1

+ inv_pro4_2

+ inv_pro4_3

+ inv_pro4_4

)

                   - sum {j in SUPPLIERS, m in RAW_MATERIALS} in_transit_1[j,m]*(raw_quantity_1[j,m] + raw_quantity_2[j,m] + raw_quantity_3[j,m]

                                                                               + raw_quantity_4[j,m] +raw_quantity_5[j,m])

   - sum {p in PRODUCTS, k in STAGES2} in_transit_2[p,k]*(rep_size_1[p,k] + rep_size_2[p,k] + rep_size_3[p,k] + rep_size_4[p,k] + rep_size_5[p,k])
   - sum {j in SUPPLIERS, r in TRUCKS} truck_cost_1[j,r]*(truck_raw_1[j,r] + truck_raw_2[j,r] + truck_raw_3[j,r] + truck_raw_4[j,r] + truck_raw_5[j,r])

                   - sum {k in STAGES2, r in TRUCKS} truck_cost_2[k,r]*(truck_pro_1[k,r] + truck_pro_2[k,r] + truck_pro_3[k,r] + truck_pro_4[k,r] + truck_pro_5[k,r]);

;

/*Declare constraints*/

                 /*Constraint 2.2*/

constraint inv_flow1 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} raw_quantity_1[j,m] + initial_1 = inv_raw1 + sum {p in Products} bill_ratio[m,p]*pro_size1

;

constraint inv_flow2 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} raw_quantity_2[j,m] + inv_raw1 = inv_raw2 + sum {p in Products} bill_ratio[m,p]*pro_size2

;

constraint inv_flow3 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} raw_quantity_3[j,m] + inv_raw2 = inv_raw3 + sum {p in Products} bill_ratio[m,p]*pro_size3

;

constraint inv_flow4 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} raw_quantity_4[j,m] + inv_raw3 = inv_raw4 + sum {p in Products} bill_ratio[m,p]*pro_size4

;

                 constraint inv_flow5 {m in RAW_MATERIALS}:

     sum {j in SUPPLIERS} raw_quantity_5[j,m] + inv_raw4 = ending_1 + sum {p in Products} bill_ratio[m,p]*pro_size5

;

                 /*Constraint 2.3*/

con raw_interval1 {m in RAW_MATERIALS}:
     sum {q in PRICE_INTERVALS} (raw_quantity1_1[m,q]+raw_quantity2_1[m,q]+raw_quantity3_1[m,q]) = sum {j in SUPPLIERS} raw_quantity_1[j,m];
con raw_interval2 {m in RAW_MATERIALS}:

                     sum {q in PRICE_INTERVALS} (raw_quantity1_2[m,q]+raw_quantity2_2[m,q]+raw_quantity3_2[m,q]) = sum {j in SUPPLIERS} raw_quantity_2[j,m];

con raw_interval3 {m in RAW_MATERIALS}:
sum {q in PRICE_INTERVALS} (raw_quantity1_3[m,q]+raw_quantity2_3[m,q]+raw_quantity3_3[m,q]) = sum {j in SUPPLIERS} raw_quantity_3[j,m];
con raw_interval4 {m in RAW_MATERIALS}:
sum {q in PRICE_INTERVALS} (raw_quantity1_4[m,q]+raw_quantity2_4[m,q]+raw_quantity3_4[m,q]) = sum {j in SUPPLIERS} raw_quantity_4[j,m];
con raw_interval5 {m in RAW_MATERIALS}:
sum {q in PRICE_INTERVALS} raw_quantity1_5[m,q] = sum {j in SUPPLIERS} raw_quantity_5[j,m];

                 /*Constraint 2.4*/

constraint inv_stage2_1 {p in PRODUCTS}:

                     pro_size1

+ initial_2

= inv_pro2_1

+ rep_size_12

;

constraint inv_stage2_2 {p in PRODUCTS}:
     pro_size2

+ inv_pro2_1

= inv_pro2_2

+ rep_size_22

;

constraint inv_stage2_3 {p in PRODUCTS}:
     pro_size3

+ inv_pro2_2

= inv_pro2_3

+ rep_size_32

;

constraint inv_stage2_4 {p in PRODUCTS}:
     pro_size4

+ inv_pro2_3

= inv_pro2_4

+ rep_size_42

;

constraint inv_stage2_5 {p in PRODUCTS}:
     pro_size5

+ inv_pro2_4

= ending_2

+ rep_size_52

;

                

     /*Constraint 2.5*/
     constraint inv_stage3_1 {p in PRODUCTS}:
     rep_size_12

+ initial_3

= inv_pro3_1

+ rep_size_13

;

                 constraint inv_stage3_2 {p in PRODUCTS}:

                     rep_size_22

+ inv_pro3_1

= inv_pro3_2

+ rep_size_23

;

                 constraint inv_stage3_3 {p in PRODUCTS}:

                     rep_size_32

+ inv_pro3_2

= inv_pro3_3

+ rep_size_33

;

     constraint inv_stage3_4 {p in PRODUCTS}:

                     rep_size_42

+ inv_pro3_3

= inv_pro3_4

+ rep_size_43

;

                 constraint inv_stage3_5 {p in PRODUCTS}:

                     rep_size_52

+ inv_pro3_4

= ending_3

+ rep_size_53

;

                

/*Constraint 2.6*/
     constraint inv_stage4_1 {p in PRODUCTS}:
     rep_size_13

+ initial_4

= demand_1

+ inv_pro4_1

;

     constraint inv_stage4_2 {p in PRODUCTS}:

                     rep_size_23

+ inv_pro4_1

= demand_2

+ inv_pro4_2

;

                 constraint inv_stage4_3 {p in PRODUCTS}:

                     rep_size_33

+ inv_pro4_2

= demand_3

+ inv_pro4_3

;

                 constraint inv_stage4_4 {p in PRODUCTS}:

                     rep_size_43

+ inv_pro4_3

= demand_4

+ inv_pro4_4

;

     constraint inv_stage4_5 {p in PRODUCTS}:

                     rep_size_53

+ inv_pro4_4

= demand_5

+ ending_4

;

                

     /*Constraint 2.7*/

                 constraint perfect_rate1 {m in RAW_MATERIALS}:

     sum {j in SUPPLIERS} perfect_rate[j,m]*raw_quantity_1[j,m] >= sum {j in SUPPLIERS} raw_quantity_1[j,m]*min_perfect;
constraint perfect_rate2 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} perfect_rate[j,m]*raw_quantity_2[j,m] >= sum {j in SUPPLIERS} raw_quantity_2[j,m]*min_perfect;
     constraint perfect_rate3 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} perfect_rate[j,m]*raw_quantity_3[j,m] >= sum {j in SUPPLIERS} raw_quantity_3[j,m]*min_perfect;
constraint perfect_rate4 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} perfect_rate[j,m]*raw_quantity_4[j,m] >= sum {j in SUPPLIERS} raw_quantity_4[j,m]*min_perfect;
constraint perfect_rate5 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} perfect_rate[j,m]*raw_quantity_5[j,m] >= sum {j in SUPPLIERS} raw_quantity_5[j,m]*min_perfect;
/*Constraint 2.8*/
     constraint supplier_cap1 {j in SUPPLIERS, m in RAW_MATERIALS}:
     raw_quantity_1[j,m] <= supplier_cap[j,m]*repl_raw1[j,m];

                 constraint supplier_cap2 {j in SUPPLIERS, m in RAW_MATERIALS}:

     raw_quantity_2[j,m] <= supplier_cap[j,m]*repl_raw2[j,m];
constraint supplier_cap3 {j in SUPPLIERS, m in RAW_MATERIALS}:
     raw_quantity_3[j,m] <= supplier_cap[j,m]*repl_raw3[j,m];
constraint supplier_cap4 {j in SUPPLIERS, m in RAW_MATERIALS}:
     raw_quantity_4[j,m] <= supplier_cap[j,m]*repl_raw4[j,m];

                 constraint supplier_cap5 {j in SUPPLIERS, m in RAW_MATERIALS}:

     raw_quantity_5[j,m] <= supplier_cap[j,m]*repl_raw5[j,m];

/*Constraint 2.9*/

                 constraint binary_minor1 {j in SUPPLIERS}:

                     sum {m in RAW_MATERIALS} repl_raw1[j,m]<= BIGM * repl_order_11;

constraint binary_minor2 {j in SUPPLIERS}:

                     sum {m in RAW_MATERIALS} repl_raw2[j,m]<= BIGM * repl_order_12;

                 constraint binary_minor3 {j in SUPPLIERS}:

                     sum {m in RAW_MATERIALS} repl_raw3[j,m]<= BIGM * repl_order_13;

                 constraint binary_minor4 {j in SUPPLIERS}:

                     sum {m in RAW_MATERIALS} repl_raw4[j,m]<= BIGM * repl_order_14;

                 constraint binary_minor5 {j in SUPPLIERS}:

                     sum {m in RAW_MATERIALS} repl_raw5[j,m]<= BIGM * repl_order_15;

                

/*Constraint 2.10*/
constraint binary_manu {p in PRODUCTS, t in TIME_PERIODS}:
     pro_size[p,t] <= B * manu_order[p,t];

                

/*Supplement constraints*/
constraint cal_pro_size {p in PRODUCTS}:
      sum {t in TIME_PERIODS} pro_size[p,t] = pro_size1

+ pro_size2

+ pro_size3

+ pro_size4

+ pro_size5

;

/*Constraint 2.11*/
constraint produce_rate1 {p in PRODUCTS}:

                      pro_size1

/pro_rate

<= produce_cap1*repl_manu1;

                 constraint produce_rate2 {p in PRODUCTS}:

                      pro_size2

/pro_rate

<= produce_cap2*repl_manu2;

     constraint produce_rate3 {p in PRODUCTS}:

                      pro_size3

/pro_rate

<= produce_cap3*repl_manu3;

     constraint produce_rate4 {p in PRODUCTS}:

                      pro_size4

/pro_rate

<= produce_cap4*repl_manu4;

     constraint produce_rate5 {p in PRODUCTS}:

                      pro_size5

/pro_rate

<= produce_cap5*repl_manu5;

/*Constraint 2.12*/
constraint repl_order1 {k in STAGES2}:
     sum {p in PRODUCTS} rep_size_1[p,k] <= B*repl_order_k1;
constraint repl_order2 {k in STAGES2}:
     sum {p in PRODUCTS} rep_size_2[p,k] <= B*repl_order_k2;

                 constraint repl_order3 {k in STAGES2}:

     sum {p in PRODUCTS} rep_size_3[p,k] <= B*repl_order_k3;

                 constraint repl_order4 {k in STAGES2}:

     sum {p in PRODUCTS} rep_size_4[p,k] <= B*repl_order_k4;
     constraint repl_order5 {k in STAGES2}:
     sum {p in PRODUCTS} rep_size_5[p,k] <= B*repl_order_k5;

/*Constraint 2.13*/

                 constraint raw_inv1 :

     sum {m in RAW_MATERIALS} fill1*inv_raw1 <= inv_cap1;

                 constraint raw_inv2 :

     sum {m in RAW_MATERIALS} fill1*inv_raw2 <= inv_cap1;
constraint raw_inv3 :
     sum {m in RAW_MATERIALS} fill1*inv_raw3 <= inv_cap1;
constraint raw_inv4 :
     sum {m in RAW_MATERIALS} fill1*inv_raw4 <= inv_cap1;
/* constraint raw_inv5:*/
/*     sum {m in RAW_MATERIALS} fill1*inv_raw5 <= inv_cap1;*/

                 /*Constraint 2.13 add*/

constraint raw_cal {m in RAW_MATERIALS}:
     sum {t in TIME_PERIOD_1} inv_raw[m,t] = inv_raw1 + inv_raw2 + inv_raw3 + inv_raw4;
   

/*Constraint 2.14*/
constraint pro_inv2_1 :
     sum {p in PRODUCTS} fill2

*inv_pro2_1

<= inv_capk;

constraint pro_inv2_2 :
     sum {p in PRODUCTS} fill2

*inv_pro2_2

<= inv_capk;

constraint pro_inv2_3 :
     sum {p in PRODUCTS} fill2

*inv_pro2_3

<= inv_capk;

constraint pro_inv2_4 :
     sum {p in PRODUCTS} fill2

*inv_pro2_4

<= inv_capk;

/* constraint pro_inv2_5 {p in PRODUCTS}:*/
/*     sum {p in PRODUCTS} fill2

*inv_pro2_5

<= inv_capk;*/

constraint pro_inv3_1 :
     sum {p in PRODUCTS} fill2

*inv_pro3_1

<= inv_capk;

constraint pro_inv3_2 :
     sum {p in PRODUCTS} fill2

*inv_pro3_2

<= inv_capk;

constraint pro_inv3_3 :
     sum {p in PRODUCTS} fill2

*inv_pro3_3

<= inv_capk;

constraint pro_inv3_4 :
     sum {p in PRODUCTS} fill2

*inv_pro3_4

<= inv_capk;

/* constraint pro_inv3_5:*/
/*     sum {p in PRODUCTS} fill2

*inv_pro3_5

<= inv_capk;*/

constraint pro_inv4_1 :
     sum {p in PRODUCTS} fill2

*inv_pro4_1

<= inv_capk;

constraint pro_inv4_2 :
     sum {p in PRODUCTS} fill2

*inv_pro4_2

<= inv_capk;

constraint pro_inv4_3 :
     sum {p in PRODUCTS} fill2

*inv_pro4_3

<= inv_capk;

constraint pro_inv4_4 :
     sum {p in PRODUCTS} fill2

*inv_pro4_4

<= inv_capk;

/*Constraint 2.15*/
constraint truck_raw1 {j in SUPPLIERS}:

                     sum {m in RAW_MATERIALS} fill1*raw_quantity_1[j,m] <= sum {r in TRUCKS} truck_cap*truck_raw_1[j,r];

constraint truck_raw2 {j in SUPPLIERS}:

                     sum {m in RAW_MATERIALS} fill1*raw_quantity_2[j,m] <= sum {r in TRUCKS} truck_cap*truck_raw_2[j,r];

                 constraint truck_raw3 {j in SUPPLIERS}:

                     sum {m in RAW_MATERIALS} fill1*raw_quantity_3[j,m] <= sum {r in TRUCKS} truck_cap*truck_raw_3[j,r];

constraint truck_raw4 {j in SUPPLIERS}:

                     sum {m in RAW_MATERIALS} fill1*raw_quantity_4[j,m] <= sum {r in TRUCKS} truck_cap*truck_raw_4[j,r];

constraint truck_raw5 {j in SUPPLIERS}:

                     sum {m in RAW_MATERIALS} fill1*raw_quantity_5[j,m] <= sum {r in TRUCKS} truck_cap*truck_raw_5[j,r];

     /*Constraint 2.16*/

                 constraint truck_pro1 {k in STAGES2}:

     sum {p in PRODUCTS} fill2

*rep_size_1[p,k] <= sum {r in TRUCKS} truck_cap*truck_pro_1[k,r];

constraint truck_pro2 {k in STAGES2}:
     sum {p in PRODUCTS} fill2

*rep_size_2[p,k] <= sum {r in TRUCKS} truck_cap*truck_pro_2[k,r];

constraint truck_pro3 {k in STAGES2}:
     sum {p in PRODUCTS} fill2

*rep_size_3[p,k] <= sum {r in TRUCKS} truck_cap*truck_pro_3[k,r];

constraint truck_pro4 {k in STAGES2}:
     sum {p in PRODUCTS} fill2

*rep_size_4[p,k] <= sum {r in TRUCKS} truck_cap*truck_pro_4[k,r];

constraint truck_pro5 {k in STAGES2}:
     sum {p in PRODUCTS} fill2

*rep_size_5[p,k] <= sum {r in TRUCKS} truck_cap*truck_pro_5[k,r];

                 /*Constraint 2.17*/

constraint truck_raw_size1 {j in SUPPLIERS}:
     sum {r in TRUCKS} truck_cap*truck_raw_1[j,r] <= sum {m in RAW_MATERIALS} raw_quantity_1[j,m];
constraint truck_raw_size2 {j in SUPPLIERS}:
     sum {r in TRUCKS} truck_cap*truck_raw_2[j,r] <= sum {m in RAW_MATERIALS} raw_quantity_2[j,m];
constraint truck_raw_size3 {j in SUPPLIERS}:
     sum {r in TRUCKS} truck_cap*truck_raw_3[j,r] <= sum {m in RAW_MATERIALS} raw_quantity_3[j,m];
constraint truck_raw_size4 {j in SUPPLIERS}:
     sum {r in TRUCKS} truck_cap*truck_raw_4[j,r] <= sum {m in RAW_MATERIALS} raw_quantity_4[j,m];
constraint truck_raw_size5 {j in SUPPLIERS}:
     sum {r in TRUCKS} truck_cap*truck_raw_5[j,r] <= sum {m in RAW_MATERIALS} raw_quantity_5[j,m];
/*Constraint 2.18*/
constraint truck_pro_size1 {k in STAGES2}:
     sum {r in TRUCKS} truck_cap*truck_pro_1[k,r] >= sum {p in PRODUCTS} rep_size_1[p,k];
constraint truck_pro_size2 {k in STAGES2}:
     sum {r in TRUCKS} truck_cap*truck_pro_2[k,r] >= sum {p in PRODUCTS} rep_size_2[p,k];
constraint truck_pro_size3 {k in STAGES2}:
     sum {r in TRUCKS} truck_cap*truck_pro_3[k,r] >= sum {p in PRODUCTS} rep_size_3[p,k];
constraint truck_pro_size4 {k in STAGES2}:
     sum {r in TRUCKS} truck_cap*truck_pro_4[k,r] >= sum {p in PRODUCTS} rep_size_4[p,k];
constraint truck_pro_size5 {k in STAGES2}:
     sum {r in TRUCKS} truck_cap*truck_pro_5[k,r] >= sum {p in PRODUCTS} rep_size_5[p,k];

/*Constraint 2.19*/

                 constraint price_cons1_1 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:

     raw_quantity1_1[m,q] <= raw_order1_1[m,q]*boundary_quantity[m,q];
constraint price_cons1_2 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity1_2[m,q] <= raw_order1_2[m,q]*boundary_quantity[m,q];
constraint price_cons1_3 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity1_3[m,q] <= raw_order1_3[m,q]*boundary_quantity[m,q];
constraint price_cons1_4 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity1_4[m,q] <= raw_order1_4[m,q]*boundary_quantity[m,q];
constraint price_cons1_5 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity1_5[m,q] <= raw_order1_5[m,q]*boundary_quantity[m,q];

constraint price_cons2_1 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity2_1[m,q] <= raw_order2_1[m,q]*boundary_quantity[m,q];

                 constraint price_cons2_2 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:

     raw_quantity2_2[m,q] <= raw_order2_2[m,q]*boundary_quantity[m,q];
constraint price_cons2_3 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity2_3[m,q] <= raw_order2_3[m,q]*boundary_quantity[m,q];
constraint price_cons2_4 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity2_4[m,q] <= raw_order2_4[m,q]*boundary_quantity[m,q];
constraint price_cons3_1 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity3_1[m,q] <= raw_order3_1[m,q]*boundary_quantity[m,q];
constraint price_cons3_2 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity3_2[m,q] <= raw_order3_2[m,q]*boundary_quantity[m,q];
constraint price_cons3_3 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity3_3[m,q] <= raw_order3_3[m,q]*boundary_quantity[m,q];
constraint price_cons3_4 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity3_4[m,q] <= raw_order3_4[m,q]*boundary_quantity[m,q];

/*Constraint 2.20*/
     constraint binary_price1_1 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order1_1[m,q] <= 1;
constraint binary_price1_2 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order1_2[m,q] <= 1;

                 constraint binary_price1_3 {m in RAW_MATERIALS}:

     sum{q in PRICE_INTERVALS} raw_order1_3[m,q] <= 1;
constraint binary_price1_4 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order1_4[m,q] <= 1;
constraint binary_price1_5 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order1_5[m,q] <= 1;

constraint binary_price2_1 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order2_1[m,q] <= 1;
constraint binary_price2_2 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order2_2[m,q] <= 1;

                 constraint binary_price2_3 {m in RAW_MATERIALS}:

     sum{q in PRICE_INTERVALS} raw_order2_3[m,q] <= 1;
constraint binary_price2_4 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order2_4[m,q] <= 1;
     constraint binary_price3_1 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order3_1[m,q] <= 1;
constraint binary_price3_2 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order3_2[m,q] <= 1;

                 constraint binary_price3_3 {m in RAW_MATERIALS}:

     sum{q in PRICE_INTERVALS} raw_order3_3[m,q] <= 1;
constraint binary_price3_4 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order3_4[m,q] <= 1;

                 /*Constraint added*/

constraint repl_order_sum {k in STAGES2}:
     sum {t in TIME_PERIODS} repl_order_k[k,t] = repl_order_k1 + repl_order_k2 + repl_order_k3
                                           + repl_order_k4 + repl_order_k5;

     constraint repl_order1_sum {j in SUPPLIERS}:
     sum {t in TIME_PERIODS} repl_order_1[j,t] = repl_order_11 + repl_order_12 + repl_order_13
                                           + repl_order_14 + repl_order_15;

/*Constraint rep_size added*/

                 constraint rep_cal1 {p in PRODUCTS}:

                     sum {k in STAGES2} rep_size_1[p,k] = rep_size_12

+ rep_size_13

;

                 constraint rep_cal2 {p in PRODUCTS}:

                     sum {k in STAGES2} rep_size_2[p,k] = rep_size_22

+ rep_size_23

;

                 constraint rep_cal3 {p in PRODUCTS}:

                     sum {k in STAGES2} rep_size_3[p,k] = rep_size_32

+ rep_size_33

;

                 constraint rep_cal4 {p in PRODUCTS}:

                     sum {k in STAGES2} rep_size_4[p,k] = rep_size_42

+ rep_size_43

;

                 constraint rep_cal5 {p in PRODUCTS}:

                     sum {k in STAGES2} rep_size_5[p,k] = rep_size_52

+ rep_size_53

;

/*Constraint inv_pro */

                 constraint inv_cal1 {p in PRODUCTS}:

                     sum {k in STAGES2} inv_pro1[p,k] = inv_pro2_1

+ inv_pro3_1

;

                 constraint inv_cal2 {p in PRODUCTS}:

                     sum {k in STAGES2} inv_pro2[p,k] = inv_pro2_2

+ inv_pro3_2

;

                 constraint inv_cal3 {p in PRODUCTS}:

                     sum {k in STAGES2} inv_pro3[p,k] = inv_pro2_3

+ inv_pro3_3

;

                 constraint inv_cal4 {p in PRODUCTS}:

                     sum {k in STAGES2} inv_pro4[p,k] = inv_pro2_4

+ inv_pro3_4

;

/*                 constraint inv_cal5 {p in PRODUCTS}:*/

/*                     sum {k in STAGES} inv_pro5[p,k] = inv_pro2_5

+ inv_pro3_5

;*/

/*To solve the problem*/

solve with milp;

QUIT;


Accepted Solutions
Solution
‎07-12-2015 08:57 PM
SAS Employee
Posts: 416

Re: "Infeasible or Unbounded" Solution Status

Are your truck_raw* and truck_pro* variables supposed to be >= 0?

Even without those lower bounds, the LP relaxation is infeasible.  If you replace your SOLVE statement with the following, you can investigate the resulting IIS to see what makes your model infeasible:

solve with LP relaxint / iis=on;

expand / iis;

View solution in original post


All Replies
Solution
‎07-12-2015 08:57 PM
SAS Employee
Posts: 416

Re: "Infeasible or Unbounded" Solution Status

Are your truck_raw* and truck_pro* variables supposed to be >= 0?

Even without those lower bounds, the LP relaxation is infeasible.  If you replace your SOLVE statement with the following, you can investigate the resulting IIS to see what makes your model infeasible:

solve with LP relaxint / iis=on;

expand / iis;

Frequent Contributor
Posts: 86

Re: "Infeasible or Unbounded" Solution Status

Hi Rob,

Thanks and that's is really helpful.

Now the solution status is feasible, and how can I see all the variables if there are a lot I just defined?

Thanks!

SAS Employee
Posts: 416

Re: "Infeasible or Unbounded" Solution Status

You can print the values of all variables as follows:

     print _VAR_;

See this link for details about problem symbols like _VAR_:

SAS/OR(R) 13.2 User's Guide: Mathematical Programming

Frequent Contributor
Posts: 86

Re: "Infeasible or Unbounded" Solution Status

Hi Rob,

Sorry, but one more question.

I added the following part to the end of the code.

constraint re_or_mamu1 {j in SUPPLIERS}:

      sum {m in RAW_MATERIALS} repl_raw1[j,m] = repl_order_11;

(similar to the other time periods)

The solution is feasible, n=but unfortunately all variables are 0.

But according to the constraints it should not be so. And sas runs still with no error. And no IIS is found.

Is there something wrong?

Thanks!

SAS Employee
Posts: 416

Re: "Infeasible or Unbounded" Solution Status

Can you please attach the latest code?

Frequent Contributor
Posts: 86

Re: "Infeasible or Unbounded" Solution Status

Title 'A Serial Supply Chain example';

/*Define Customer Demand*/
Data Demand1;
  input product demand_1;
  datalines;
1  300
2  400
;

Data Demand2;
  input product demand_2;
  datalines;
1  600
2  700
;

Data Demand3;
  input product demand_3;
  datalines;
1  1200
2  1400
;

Data Demand4;
  input product demand_4;
  datalines;
1  1250
2  1100
;

Data Demand5;
  input product demand_5;
  datalines;
1  300
2  400
;

/*Define in-transit inventory holding cost*/
Data in_transit_cost1;
  input supplier type cost;
  datalines;
1  1  2.0
1  2  1.0
2  1  2.2
2  2  0.9
3  1  1.8
3  2  1.1
;

Data in_transit_cost2;
  input type stage cost;
  datalines;
1  2   7.5
1  3   8.5
2  2   9.5
2  3  11.5
;

/*Define price interval for raw materials*/
Data price_interval1;
  input supplier raw_material interval1 interval2 interval3;
  datalines;
1  1   9   9   9
1  2   7   7   7
;

Data price_interval2;
  input supplier raw_material interval1 interval2 interval3;
  datalines;
2  1  10   9   8
2  2   8   7   6
;

Data price_interval3;
  input supplier raw_material interval1 interval2 interval3;
  datalines;
3  1  11  10   9
3  2   9   7   5
;

/*Define manufacture and inventory capacity*/
Data Capacity;
  input time_period produce_cap inv_cap1 inv_cap2 inv_cap3 inv_cap4;
  datalines;
1  2000  3000  12000  12000  12000
2  1200  3000  12000  12000  12000
3   800  3000  12000  12000  12000
4   800  3000  12000  12000  12000
5  2000  3000  12000  12000  12000
;

/*Define the transformation of raw materials into finished products*/
Data Bill_Ratio;
  input raw_material product1 product2;
  datalines;
1  2  3
2  3  2
;

/*Define Production Rate*/
Data Pro_rate;
  input product pro_rate;
  datalines;
1  2 
2  1.5 
;
/*Define fill-in rate of raw materials and final products into 1 container*/
Data Fill_Ratio1;
  input raw_material fill1;
  datalines;
1  1.8
2  2.0
;

Data Fill_Ratio2;
  input product fill2;
  datalines;
1  2.5
2  3.0
;

/*Description of raw material suppliers*/
Data Supplier_info;
  input supplier lead_time raw_material1 raw_material2 perfect_rate1 perfect_rate2 major_cost minor1_cost minor2_cost time_period;
  datalines;
1  0  9000  9000  0.97  0.97  9000  10000  11000  1
2  1  3500  3500  0.95  0.96  5000   7000   6000  1
3  1  4000  4000  0.96  0.95  3000   3500   3000  1
;

/*Define minimum perfect rate*/
Data min_perfect;
  input raw_material min_perfect;
  datalines;
1    0.96
2    0.96
;

/*Define Inventory Holding Cost and Production Cost*/
Data Raw_inv_cost;
  input raw_material time_period1 time_period2 time_period3 time_period4;
  datalines;
1  1.8  1.8  1.8  1.8 
2  1.5  1.5  1.5  1.5 
;

/*The following does not consider time_periods, just repeat*/
Data Product_inv_cost;
  input  product stages2 stages3;
  datalines;
1   7  9
2  11  9
;

Data Product_inv_cost1;
  input product holding_3;
  datalines;
1   8
2  12
;

Data Produce_cost;
  input product time_period1 time_period2 time_period3 time_period4 time_period5;
  datalines;
1  24  25  29  29  24
2  29  30  35  35  29
;

/*Define in-transit inventory holding cost*/
Data in_transit_cost1;
  input supplier raw_material1 raw_material2;
  datalines;
1  2.0  1.5
2  2.2  1.4
3  1.8  1.6
;

Data in_transit_cost2;
  input product stage2 stage3;
  datalines;
1  7.5  8.5
2  9.5  11.5
;

/*Define truck capacity and cost information*/
Data truck_cap;
  input truck truck_cap;
  datalines;
1  25
2  30
3  35
;

Data truck_cost_1;
  input supplier truck1 truck2 truck3;
  datalines;
1  3000  3500  4000
2  2800  3200  3800
3  3100  3300  3900
;

Data truck_cost_2;
  input stage truck1 truck2 truck3;
  datalines;
2  1100  1000  1200
3  5500  5000  6000
;

/*Define major and minor fixed cost at manufacture stage*/
Data Minor_cost;
  input supplier raw_material1 raw_material2;
  datalines;
1  5000  6000
2  4000  3000
3  3500  3000
;

/*Data Minor_cost2;*/
/*  input raw_material time_period1 time_period2 time_period3 time_period4 time_period5;*/
/*  datalines;*/
/*1  4000  4000  4000  4000  .  */
/*2  3000  3000  3000  3000  .*/
/*;*/
/**/
/*Data Minor_cost3;*/
/*  input raw_material time_period1 time_period2 time_period3 time_period4 time_period5;*/
/*  datalines;*/
/*1  3500  3500  3500  3500  .  */
/*2  3000  3000  3000  3000  .*/
/*;*/

Data Major_cost;
  input supplier time_period1 time_period2 time_period3 time_period4 time_period5;
  datalines;
1  9000  9000  9000  9000  9000
2  5000  5000  5000  5000  5000
3  3000  3000  3000  3000  5000
;

Data Major_cost_1;
  input stage time_period1 time_period2 time_period3 time_period4 time_period5;
  datalines;

2  4000  4000  4000  4000  4000 
3  4000  4000  4000  4000  4000 
;

Data Minor_cost_1;
  input product time_period1 time_period2 time_period3 time_period4 time_period5;
  datalines;
1   1500   1500   1500   1500   1500
2   1250   1250   1250   1250   1250
;

/*Define price interval for raw materials*/
Data boundary_quantity;
  input raw_material quantity1 quantity2 quantity3;
  datalines;
1  1000  2000  10000000
2  1000  2000  10000000
;

Data initial_1;
  input raw_material initial_1;
  datalines;
1   1500
2   1700
;

Data ending_1;
  input raw_material ending_1;
  datalines;
1   500
2   700
;

Data initial_2;
  input product initial_2;
  datalines;
1   1500
2   1200
;

Data ending_2;
  input product ending_2;
  datalines;
1   500
2   400
;

Data initial_3;
  input product initial_3;
  datalines;
1    900
2    700
;

Data ending_3;
  input product ending_3;
  datalines;
1   400
2   300
;

Data initial_4;
  input product initial_4;
  datalines;
1   1000
2    750
;

Data ending_4;
  input product ending_4;
  datalines;
1   500
2   300
;

Proc Optmodel;
/*Declare Index Sets*/
set SUPPLIERS;
set SUPPLIERS_1 = {1};
set SUPPLIERS_2 = 1..3;
set SUPPLIERS_3 = 1..3;
set SUPPLIERS_4 = 1..3;
set SUPPLIERS_5 = 1..3;
/*set TIME_01 = 1..5;*/
/*set TIME_02 = 1..4;*/
set TIME_PERIOD_1 = 1..4;
/*set TIME_1 = 2..5;*/
/*set TIME_2 = 1..5;*/
/*set TIME_3 = 2..5;*/
/*set TIME_4 = 1..5;*/
set RAW_MATERIALS;
set PRODUCTS;
set STAGES = 2..4;
set STAGES1 = 1..4;
set STAGES2 = 2..3;
set STAGES3;
set STAGES4;
/*set STAGES5;*/
set TIME_PERIODS = 1..5;
set TRUCKS = 1..3;
set TRUCKS1;
set PRICE_INTERVALS = 1..3 ;

/*Declare Parameters*/
num BIGM = 1000000;
num B = 1000000;

num fill1 {RAW_MATERIALS};
read data Fill_Ratio1 into RAW_MATERIALS = [raw_material] fill1;
/*print fill1;*/

num fill2 {PRODUCTS};
read data Fill_Ratio2 into PRODUCTS = [product] fill2;
/*print fill2;*/

num bill_ratio {RAW_MATERIALS,PRODUCTS};
read data Bill_ratio into RAW_MATERIALS = [raw_material]
          {p in PRODUCTS} <bill_ratio[raw_material,p]=col("product"||p)>;
/*print bill_ratio;*/

/*The following does not consider time_periods*/
num supplier_cap {SUPPLIERS, RAW_MATERIALS};
read data Supplier_info into SUPPLIERS = [supplier]
          {m in RAW_MATERIALS} <supplier_cap[supplier,m]=col("raw_material"||m)>;
/*print supplier_cap;*/
/*num produce_cap {TIME_PERIODS};*/
/*read data Capacity into TIME_PERIODS = [time_period] produce_cap;*/
/*print produce_cap;*/

num produce_cap1 = 2000;
num produce_cap2 = 1200;
num produce_cap3 = 800;
num produce_cap4 = 800;
num produce_cap5 = 2000;

num inv_cap1 = 6000;

/*num inv_capk {STAGES5};*/
/*read data Capacity1 into STAGES5 = [stage] inv_capk;*/
/*print inv_capk;*/

num inv_capk = 12000;

/*num inv_cap {TIME_PERIODS, STAGES1};*/
/*read data Capacity into TIME_PERIODS = [time_period] */
/*          {k in STAGES1} <inv_cap[time_period,k]=col("inv_cap"||k)>;*/
/*print inv_cap;*/

num major_order_1 = 5000;

num pro_rate {PRODUCTS};
read data Pro_rate into PRODUCTS=[product] pro_rate;
print pro_rate;

num perfect_rate {SUPPLIERS, RAW_MATERIALS};
read data Supplier_info into SUPPLIERS = [supplier]
          {m in RAW_MATERIALS} <perfect_rate[supplier,m]=col("perfect_rate"||m)>;
/*print perfect_rate;*/

num min_perfect {RAW_MATERIALS};
read data min_perfect into RAW_MATERIALS = [raw_material] min_perfect;
/*print min_perfect;*/

num demand_1 {PRODUCTS};
read data Demand1 into PRODUCTS = [product] demand_1;
/*print demand;*/

num demand_2 {PRODUCTS};
read data Demand2 into PRODUCTS = [product] demand_2;
/*print demand;*/

num demand_3 {PRODUCTS};
read data Demand3 into PRODUCTS = [product] demand_3;
/*print demand;*/

num demand_4 {PRODUCTS};
read data Demand4 into PRODUCTS = [product] demand_4;
/*print demand;*/

num demand_5 {PRODUCTS};
read data Demand5 into PRODUCTS = [product] demand_5;
/*print demand;*/

num holding_1 {RAW_MATERIALS, TIME_PERIOD_1};
read data Raw_inv_cost into RAW_MATERIALS = [raw_material]
                            {t in TIME_PERIOD_1} <holding_1[raw_material,t]=col("time_period"||t)>;
print holding_1;

num holding_2 {PRODUCTS, STAGES2};
read data Product_inv_cost into PRODUCTS = [product]
                                {k in STAGES2} <holding_2[product,k]=col("STAGES"||k)>;
/*print holding_2;*/

num holding_3 {PRODUCTS};
read data Product_inv_cost1 into PRODUCTS = [product] holding_3;
print holding_3;

num in_transit_1 {SUPPLIERS, RAW_MATERIALS};
read data in_transit_cost1 into SUPPLIERS = [supplier]
                                {m in RAW_MATERIALS} <in_transit_1[supplier,m]=col("raw_material"||m)>;
/*print in_transit_1;*/

num in_transit_2 {PRODUCTS, STAGES2};
read data in_transit_cost2 into PRODUCTS = [product]
                                {k in STAGES2} <in_transit_2[product,k]=col("stage"||k)>;
print in_transit_2;

num unit_price1 {RAW_MATERIALS, PRICE_INTERVALS};
read data price_interval1 into RAW_MATERIALS = [raw_material]
                               {q in PRICE_INTERVALS} <unit_price1[raw_material,q]=col("interval"||q)>;
/*print unit_price1; */

num unit_price2 {RAW_MATERIALS, PRICE_INTERVALS};
read data price_interval2 into RAW_MATERIALS = [raw_material]
                               {q in PRICE_INTERVALS} <unit_price2[raw_material,q]=col("interval"||q)>;
/*print unit_price2; */

num unit_price3 {RAW_MATERIALS, PRICE_INTERVALS};
read data price_interval3 into RAW_MATERIALS = [raw_material]
                               {q in PRICE_INTERVALS} <unit_price3[raw_material,q]=col("interval"||q)>;
/*print unit_price3; */

num major_cost {SUPPLIERS, TIME_PERIODS};
read data major_cost into SUPPLIERS = [supplier]
                          {t in TIME_PERIODS} <major_cost[supplier,t]=col("time_period"||t)>;
/*print major_cost;*/

num minor_cost {SUPPLIERS, RAW_MATERIALS};
read data Minor_cost into SUPPLIERS = [supplier]
                           {m in RAW_MATERIALS} <Minor_cost[supplier,m]=col("raw_material"||m)>;
/*print minor_cost;*/

num produce_cost {PRODUCTS, TIME_PERIODS};
read data produce_cost into PRODUCTS = [product]
                            {t in TIME_PERIODS} <produce_cost[product,t]=col("time_period"||t)>;
/*print produce_cost;*/

num Major_cost_1 {STAGES3, TIME_PERIODS};
read data Major_cost_1 into STAGES3 = [stage]
                            {t in TIME_PERIODS} <Major_cost_1[stage,t]=col("time_period"||t)>;
/*print Major_cost_1;*/

num Minor_cost_1 {PRODUCTS, TIME_PERIODS};
read data Minor_cost_1 into PRODUCTS = [product]
                            {t in TIME_PERIODS} <Minor_cost_1[product,t]=col("time_period"||t)>;
/*print Minor_cost_1;*/

num truck_cost_1 {SUPPLIERS, TRUCKS};
read data truck_cost_1 into SUPPLIERS = [supplier]
                            {r in TRUCKS} <truck_cost_1[supplier,r]=col("truck"||r)>;
/*print truck_cost_1;*/

num truck_cost_2 {STAGES4, TRUCKS};
read data truck_cost_2 into STAGES4 = [stage]
                            {r in TRUCKS} <truck_cost_2[stage,r]=col("truck"||r)>;
/*print truck_cost_2;*/

num truck_cap {TRUCKS1};
read data truck_cap into TRUCKS1 = [truck] truck_cap;
/*print truck_cap;*/

num boundary_quantity {RAW_MATERIALS, PRICE_INTERVALS};
read data boundary_quantity into RAW_MATERIALS = [raw_material]
                                 {q in PRICE_INTERVALS} <boundary_quantity[raw_material,q]=col("quantity"||q)>;
print boundary_quantity;

num initial_1 {RAW_MATERIALS};
read data initial_1 into RAW_MATERIALS = [raw_material] initial_1;

num ending_1 {RAW_MATERIALS};
read data ending_1 into RAW_MATERIALS = [raw_material] ending_1;

num initial_2 {PRODUCTS};
read data initial_2 into PRODUCTS = [product] initial_2;

num ending_2 {PRODUCTS};
read data ending_2 into PRODUCTS = [product] ending_2;

num initial_3 {PRODUCTS};
read data initial_3 into PRODUCTS = [product] initial_3;

num ending_3 {PRODUCTS};
read data ending_3 into PRODUCTS = [product] ending_3;

num initial_4 {PRODUCTS};
read data initial_4 into PRODUCTS = [product] initial_4;

num ending_4 {PRODUCTS};
read data ending_4 into PRODUCTS = [product] ending_4;

/*Declare the variable*/
var raw_quantity1_1 {RAW_MATERIALS, PRICE_INTERVALS}>=0; /*For supplier 1, 0 time period*/
var raw_quantity1_2 {RAW_MATERIALS, PRICE_INTERVALS}>=0;
var raw_quantity1_3 {RAW_MATERIALS, PRICE_INTERVALS}>=0;
var raw_quantity1_4 {RAW_MATERIALS, PRICE_INTERVALS}>=0;
var raw_quantity1_5 {RAW_MATERIALS, PRICE_INTERVALS}>=0;

var raw_quantity2_1 {RAW_MATERIALS, PRICE_INTERVALS}>=0; /*For supplier 2, 0 time period*/
var raw_quantity2_2 {RAW_MATERIALS, PRICE_INTERVALS}>=0;
var raw_quantity2_3 {RAW_MATERIALS, PRICE_INTERVALS}>=0;
var raw_quantity2_4 {RAW_MATERIALS, PRICE_INTERVALS}>=0;

var raw_quantity3_1 {RAW_MATERIALS, PRICE_INTERVALS}>=0; /*For supplier 3, 0 time period*/
var raw_quantity3_2 {RAW_MATERIALS, PRICE_INTERVALS}>=0;
var raw_quantity3_3 {RAW_MATERIALS, PRICE_INTERVALS}>=0;
var raw_quantity3_4 {RAW_MATERIALS, PRICE_INTERVALS}>=0;

var raw_quantity_1 {SUPPLIERS, RAW_MATERIALS}>=0; /*Total quantity of raw materials*/
var raw_quantity_2 {SUPPLIERS, RAW_MATERIALS}>=0;
var raw_quantity_3 {SUPPLIERS, RAW_MATERIALS}>=0;
var raw_quantity_4 {SUPPLIERS, RAW_MATERIALS}>=0;
var raw_quantity_5 {SUPPLIERS, RAW_MATERIALS}>=0;

var inv_raw {RAW_MATERIALS, TIME_PERIOD_1}>=0; /*Inventory for raw materials*/
var inv_raw1 {RAW_MATERIALS}>=0;
var inv_raw2 {RAW_MATERIALS}>=0;
var inv_raw3 {RAW_MATERIALS}>=0;
var inv_raw4 {RAW_MATERIALS}>=0;
/*var inv_raw5 {RAW_MATERIALS}>=0;*/

var inv_pro1 {PRODUCTS, STAGES2}>=0; /*Inventory for final products*/
var inv_pro2 {PRODUCTS, STAGES2}>=0;
var inv_pro3 {PRODUCTS, STAGES2}>=0;
var inv_pro4 {PRODUCTS, STAGES2}>=0;
/*var inv_pro5 {PRODUCTS, STAGES}>=0;*/

var inv_pro2_1 {PRODUCTS}>=0;
var inv_pro2_2 {PRODUCTS}>=0;
var inv_pro2_3 {PRODUCTS}>=0;
var inv_pro2_4 {PRODUCTS}>=0;
/*var inv_pro2_5 {PRODUCTS}>=0;*/

var inv_pro3_1 {PRODUCTS}>=0;
var inv_pro3_2 {PRODUCTS}>=0;
var inv_pro3_3 {PRODUCTS}>=0;
var inv_pro3_4 {PRODUCTS}>=0;
/*var inv_pro3_5 {PRODUCTS}>=0;*/

var inv_pro4_1 {PRODUCTS}>=0;
var inv_pro4_2 {PRODUCTS}>=0;
var inv_pro4_3 {PRODUCTS}>=0;
var inv_pro4_4 {PRODUCTS}>=0;
/*var inv_pro4_5 {PRODUCTS}>=0;*/

var pro_size {PRODUCTS, TIME_PERIODS}>=0; /*production size*/
var pro_size1 {PRODUCTS}>=0;
var pro_size2 {PRODUCTS}>=0;
var pro_size3 {PRODUCTS}>=0;
var pro_size4 {PRODUCTS}>=0;
var pro_size5 {PRODUCTS}>=0;

var rep_size_1 {PRODUCTS, STAGES2}>=0;
var rep_size_12 {PRODUCTS}>=0;
var rep_size_13 {PRODUCTS}>=0;

var rep_size_2 {PRODUCTS, STAGES2}>=0; /*Replenish order*/
var rep_size_22 {PRODUCTS}>=0;
var rep_size_23 {PRODUCTS}>=0;

var rep_size_3 {PRODUCTS, STAGES2}>=0;
var rep_size_32 {PRODUCTS}>=0;
var rep_size_33 {PRODUCTS}>=0;

var rep_size_4 {PRODUCTS, STAGES2}>=0;
var rep_size_42 {PRODUCTS}>=0;
var rep_size_43 {PRODUCTS}>=0;

var rep_size_5 {PRODUCTS, STAGES2}>=0;
var rep_size_52 {PRODUCTS}>=0;
var rep_size_53 {PRODUCTS}>=0;

/*The amount of trucks should be integer*/
var truck_raw_1 {SUPPLIERS, TRUCKS} >=0 integer;
var truck_raw_2 {SUPPLIERS, TRUCKS} >=0 integer;
var truck_raw_3 {SUPPLIERS, TRUCKS} >=0 integer;
var truck_raw_4 {SUPPLIERS, TRUCKS} >=0 integer;
var truck_raw_5 {SUPPLIERS, TRUCKS} >=0 integer;

var truck_pro_1 {STAGES4, TRUCKS} >=0 integer;
var truck_pro_2 {STAGES4, TRUCKS} >=0 integer;
var truck_pro_3 {STAGES4, TRUCKS} >=0 integer;
var truck_pro_4 {STAGES4, TRUCKS} >=0 integer;
var truck_pro_5 {STAGES4, TRUCKS} >=0 integer;

/*Below are binary variables*/
var repl_order_1 {SUPPLIERS, TIME_PERIODS} binary; /*Major for suppliers*/
var repl_order_11 {SUPPLIERS} binary;
var repl_order_12 {SUPPLIERS} binary;
var repl_order_13 {SUPPLIERS} binary;
var repl_order_14 {SUPPLIERS} binary;
var repl_order_15 {SUPPLIERS} binary;

var repl_raw1 {SUPPLIERS, RAW_MATERIALS} binary;/*Minor in suppliers*/
var repl_raw2 {SUPPLIERS, RAW_MATERIALS} binary;
var repl_raw3 {SUPPLIERS, RAW_MATERIALS} binary;
var repl_raw4 {SUPPLIERS, RAW_MATERIALS} binary;
var repl_raw5 {SUPPLIERS, RAW_MATERIALS} binary;

var repl_order_k {STAGES2, TIME_PERIODS} binary;/*Major cost in later stages*/
var repl_order_k1 {STAGES2} binary;
var repl_order_k2 {STAGES2} binary;
var repl_order_k3 {STAGES2} binary;
var repl_order_k4 {STAGES2} binary;
var repl_order_k5 {STAGES2} binary;

var manu_order {PRODUCTS, TIME_PERIODS} binary;/*Minor for final products*/
var repl_manu1  binary;/*For stage 1*/
var repl_manu2  binary;
var repl_manu3  binary;
var repl_manu4  binary;
var repl_manu5  binary;

var raw_order1_1 {RAW_MATERIALS, PRICE_INTERVALS} binary;
var raw_order1_2 {RAW_MATERIALS, PRICE_INTERVALS} binary;
var raw_order1_3 {RAW_MATERIALS, PRICE_INTERVALS} binary;
var raw_order1_4 {RAW_MATERIALS, PRICE_INTERVALS} binary;
var raw_order1_5 {RAW_MATERIALS, PRICE_INTERVALS} binary;

var raw_order2_1 {RAW_MATERIALS, PRICE_INTERVALS} binary;
var raw_order2_2 {RAW_MATERIALS, PRICE_INTERVALS} binary;
var raw_order2_3 {RAW_MATERIALS, PRICE_INTERVALS} binary;
var raw_order2_4 {RAW_MATERIALS, PRICE_INTERVALS} binary;

var raw_order3_1 {RAW_MATERIALS, PRICE_INTERVALS} binary;
var raw_order3_2 {RAW_MATERIALS, PRICE_INTERVALS} binary;
var raw_order3_3 {RAW_MATERIALS, PRICE_INTERVALS} binary;
var raw_order3_4 {RAW_MATERIALS, PRICE_INTERVALS} binary;

/*Maximize the objective function*/

Min  Z = sum {j in SUPPLIERS, t in TIME_PERIODS} major_cost[j,t]*repl_order_1[j,t]
                   + sum {j in SUPPLIERS, m in RAW_MATERIALS} minor_cost[j,m]*(repl_raw1[j,m] + repl_raw2[j,m] + repl_raw3[j,m] + repl_raw4[j,m] + repl_raw5[j,m])
                   + sum {m in RAW_MATERIALS, q in PRICE_INTERVALS} (unit_price1[m,q]*raw_quantity1_1[m,q]
                                                   + unit_price1[m,q]*raw_quantity1_2[m,q]
   + unit_price1[m,q]*raw_quantity1_3[m,q]
   + unit_price1[m,q]*raw_quantity1_4[m,q]
   + unit_price1[m,q]*raw_quantity1_5[m,q]
                                                                   + unit_price2[m,q]*raw_quantity2_1[m,q]
   + unit_price2[m,q]*raw_quantity2_2[m,q]
   + unit_price2[m,q]*raw_quantity2_3[m,q]
   + unit_price2[m,q]*raw_quantity2_4[m,q]
                                                   + unit_price3[m,q]*raw_quantity3_1[m,q]
   + unit_price3[m,q]*raw_quantity3_2[m,q]
   + unit_price3[m,q]*raw_quantity3_3[m,q]
   + unit_price3[m,q]*raw_quantity3_4[m,q])
   + sum {p in PRODUCTS, t in TIME_PERIODS} (minor_cost_1[p,t]*manu_order[p,t] + produce_cost[p,t]*pro_size[p,t])
   + sum {k in STAGES2, t in TIME_PERIODS} major_cost_1[k,t]*repl_order_k[k,t] - major_order_1*(repl_manu1 + repl_manu2 + repl_manu3 + repl_manu4 + repl_manu5)
                   + sum {m in RAW_MATERIALS, t in TIME_PERIOD_1} holding_1[m,t]*inv_raw[m,t]
   + sum {p in PRODUCTS, k in STAGES2} holding_2[p,k]*(inv_pro1[p,k] + inv_pro2[p,k] + inv_pro3[p,k] + inv_pro4[p,k])
   + sum {p in PRODUCTS} holding_3

*(inv_pro4_1

+ inv_pro4_2

+ inv_pro4_3

+ inv_pro4_4

)

                   + sum {j in SUPPLIERS, m in RAW_MATERIALS} in_transit_1[j,m]*(raw_quantity_1[j,m] + raw_quantity_2[j,m] + raw_quantity_3[j,m]
                                                                               + raw_quantity_4[j,m] +raw_quantity_5[j,m])
   + sum {p in PRODUCTS, k in STAGES2} in_transit_2[p,k]*(rep_size_1[p,k] + rep_size_2[p,k] + rep_size_3[p,k] + rep_size_4[p,k] + rep_size_5[p,k])
   + sum {j in SUPPLIERS, r in TRUCKS} truck_cost_1[j,r]*(truck_raw_1[j,r] + truck_raw_2[j,r] + truck_raw_3[j,r] + truck_raw_4[j,r] + truck_raw_5[j,r])
                   + sum {k in STAGES2, r in TRUCKS} truck_cost_2[k,r]*(truck_pro_1[k,r] + truck_pro_2[k,r] + truck_pro_3[k,r] + truck_pro_4[k,r] + truck_pro_5[k,r])
;

/*Declare constraints*/
                 /*Constraint 2.2*/
constraint inv_flow1 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} raw_quantity_1[j,m] + initial_1 = inv_raw1 + sum {p in Products} bill_ratio[m,p]*pro_size1

;

constraint inv_flow2 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} raw_quantity_2[j,m] + inv_raw1 = inv_raw2 + sum {p in Products} bill_ratio[m,p]*pro_size2

;

constraint inv_flow3 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} raw_quantity_3[j,m] + inv_raw2 = inv_raw3 + sum {p in Products} bill_ratio[m,p]*pro_size3

;

constraint inv_flow4 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} raw_quantity_4[j,m] + inv_raw3 = inv_raw4 + sum {p in Products} bill_ratio[m,p]*pro_size4

;

                 constraint inv_flow5 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} raw_quantity_5[j,m] + inv_raw4 = ending_1 + sum {p in Products} bill_ratio[m,p]*pro_size5

;

                 /*Constraint 2.3*/
con raw_interval1 {m in RAW_MATERIALS}:
     sum {q in PRICE_INTERVALS} (raw_quantity1_1[m,q]+raw_quantity2_1[m,q]+raw_quantity3_1[m,q]) = sum {j in SUPPLIERS} raw_quantity_1[j,m];
con raw_interval2 {m in RAW_MATERIALS}:
                     sum {q in PRICE_INTERVALS} (raw_quantity1_2[m,q]+raw_quantity2_2[m,q]+raw_quantity3_2[m,q]) = sum {j in SUPPLIERS} raw_quantity_2[j,m];
con raw_interval3 {m in RAW_MATERIALS}:
sum {q in PRICE_INTERVALS} (raw_quantity1_3[m,q]+raw_quantity2_3[m,q]+raw_quantity3_3[m,q]) = sum {j in SUPPLIERS} raw_quantity_3[j,m];
con raw_interval4 {m in RAW_MATERIALS}:
sum {q in PRICE_INTERVALS} (raw_quantity1_4[m,q]+raw_quantity2_4[m,q]+raw_quantity3_4[m,q]) = sum {j in SUPPLIERS} raw_quantity_4[j,m];
con raw_interval5 {m in RAW_MATERIALS}:
sum {q in PRICE_INTERVALS} raw_quantity1_5[m,q] = sum {j in SUPPLIERS} raw_quantity_5[j,m];

                 /*Constraint 2.4*/
constraint inv_stage2_1 {p in PRODUCTS}:
                     pro_size1

+ initial_2

= inv_pro2_1

+ rep_size_12

;

constraint inv_stage2_2 {p in PRODUCTS}:
     pro_size2

+ inv_pro2_1

= inv_pro2_2

+ rep_size_22

;

constraint inv_stage2_3 {p in PRODUCTS}:
     pro_size3

+ inv_pro2_2

= inv_pro2_3

+ rep_size_32

;

constraint inv_stage2_4 {p in PRODUCTS}:
     pro_size4

+ inv_pro2_3

= inv_pro2_4

+ rep_size_42

;

constraint inv_stage2_5 {p in PRODUCTS}:
     pro_size5

+ inv_pro2_4

= ending_2

+ rep_size_52

;

                
     /*Constraint 2.5*/
     constraint inv_stage3_1 {p in PRODUCTS}:
     rep_size_12

+ initial_3

= inv_pro3_1

+ rep_size_13

;

                 constraint inv_stage3_2 {p in PRODUCTS}:
                     rep_size_22

+ inv_pro3_1

= inv_pro3_2

+ rep_size_23

;

                 constraint inv_stage3_3 {p in PRODUCTS}:
                     rep_size_32

+ inv_pro3_2

= inv_pro3_3

+ rep_size_33

;

     constraint inv_stage3_4 {p in PRODUCTS}:
                     rep_size_42

+ inv_pro3_3

= inv_pro3_4

+ rep_size_43

;

                 constraint inv_stage3_5 {p in PRODUCTS}:
                     rep_size_52

+ inv_pro3_4

= ending_3

+ rep_size_53

;

                
/*Constraint 2.6*/
     constraint inv_stage4_1 {p in PRODUCTS}:
     rep_size_13

+ initial_4

= demand_1

+ inv_pro4_1

;

     constraint inv_stage4_2 {p in PRODUCTS}:
                     rep_size_23

+ inv_pro4_1

= demand_2

+ inv_pro4_2

;

                 constraint inv_stage4_3 {p in PRODUCTS}:
                     rep_size_33

+ inv_pro4_2

= demand_3

+ inv_pro4_3

;

                 constraint inv_stage4_4 {p in PRODUCTS}:
                     rep_size_43

+ inv_pro4_3

= demand_4

+ inv_pro4_4

;

     constraint inv_stage4_5 {p in PRODUCTS}:
                     rep_size_53

+ inv_pro4_4

= demand_5

+ ending_4

;

                
     /*Constraint 2.7*/
                 constraint perfect_rate1 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} perfect_rate[j,m]*raw_quantity_1[j,m] >= sum {j in SUPPLIERS} raw_quantity_1[j,m]*min_perfect;
constraint perfect_rate2 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} perfect_rate[j,m]*raw_quantity_2[j,m] >= sum {j in SUPPLIERS} raw_quantity_2[j,m]*min_perfect;
     constraint perfect_rate3 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} perfect_rate[j,m]*raw_quantity_3[j,m] >= sum {j in SUPPLIERS} raw_quantity_3[j,m]*min_perfect;
constraint perfect_rate4 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} perfect_rate[j,m]*raw_quantity_4[j,m] >= sum {j in SUPPLIERS} raw_quantity_4[j,m]*min_perfect;
constraint perfect_rate5 {m in RAW_MATERIALS}:
     sum {j in SUPPLIERS} perfect_rate[j,m]*raw_quantity_5[j,m] >= sum {j in SUPPLIERS} raw_quantity_5[j,m]*min_perfect;
/*Constraint 2.8*/
     constraint supplier_cap1 {j in SUPPLIERS, m in RAW_MATERIALS}:
     raw_quantity_1[j,m] <= supplier_cap[j,m]*repl_raw1[j,m];
                 constraint supplier_cap2 {j in SUPPLIERS, m in RAW_MATERIALS}:
     raw_quantity_2[j,m] <= supplier_cap[j,m]*repl_raw2[j,m];
constraint supplier_cap3 {j in SUPPLIERS, m in RAW_MATERIALS}:
     raw_quantity_3[j,m] <= supplier_cap[j,m]*repl_raw3[j,m];
constraint supplier_cap4 {j in SUPPLIERS, m in RAW_MATERIALS}:
     raw_quantity_4[j,m] <= supplier_cap[j,m]*repl_raw4[j,m];
                 constraint supplier_cap5 {j in SUPPLIERS, m in RAW_MATERIALS}:
     raw_quantity_5[j,m] <= supplier_cap[j,m]*repl_raw5[j,m];

/*Constraint 2.9*/
                 constraint binary_minor1 {j in SUPPLIERS}:
                     sum {m in RAW_MATERIALS} repl_raw1[j,m]<= BIGM * repl_order_11;
constraint binary_minor2 {j in SUPPLIERS}:
                     sum {m in RAW_MATERIALS} repl_raw2[j,m]<= BIGM * repl_order_12;
                 constraint binary_minor3 {j in SUPPLIERS}:
                     sum {m in RAW_MATERIALS} repl_raw3[j,m]<= BIGM * repl_order_13;
                 constraint binary_minor4 {j in SUPPLIERS}:
                     sum {m in RAW_MATERIALS} repl_raw4[j,m]<= BIGM * repl_order_14;
                 constraint binary_minor5 {j in SUPPLIERS}:
                     sum {m in RAW_MATERIALS} repl_raw5[j,m]<= BIGM * repl_order_15;
                
/*Constraint 2.10*/
constraint binary_manu {p in PRODUCTS, t in TIME_PERIODS}:
     pro_size[p,t] <= B * manu_order[p,t];
                
/*Supplement constraints*/
constraint cal_pro_size {p in PRODUCTS}:
      sum {t in TIME_PERIODS} pro_size[p,t] = pro_size1

+ pro_size2

+ pro_size3

+ pro_size4

+ pro_size5

;

/*Constraint 2.11*/
constraint produce_rate1 {p in PRODUCTS}:
                      pro_size1

/pro_rate

<= produce_cap1*repl_manu1;

                 constraint produce_rate2 {p in PRODUCTS}:
                      pro_size2

/pro_rate

<= produce_cap2*repl_manu2;

     constraint produce_rate3 {p in PRODUCTS}:
                      pro_size3

/pro_rate

<= produce_cap3*repl_manu3;

     constraint produce_rate4 {p in PRODUCTS}:
                      pro_size4

/pro_rate

<= produce_cap4*repl_manu4;

     constraint produce_rate5 {p in PRODUCTS}:
                      pro_size5

/pro_rate

<= produce_cap5*repl_manu5;

/*Constraint 2.12*/
constraint repl_order1 {k in STAGES2}:
     sum {p in PRODUCTS} rep_size_1[p,k] <= B*repl_order_k1;
constraint repl_order2 {k in STAGES2}:
     sum {p in PRODUCTS} rep_size_2[p,k] <= B*repl_order_k2;
                 constraint repl_order3 {k in STAGES2}:
     sum {p in PRODUCTS} rep_size_3[p,k] <= B*repl_order_k3;
                 constraint repl_order4 {k in STAGES2}:
     sum {p in PRODUCTS} rep_size_4[p,k] <= B*repl_order_k4;
     constraint repl_order5 {k in STAGES2}:
     sum {p in PRODUCTS} rep_size_5[p,k] <= B*repl_order_k5;

/*Constraint 2.13*/
                 constraint raw_inv1 :
     sum {m in RAW_MATERIALS} fill1*inv_raw1 <= inv_cap1;
                 constraint raw_inv2 :
     sum {m in RAW_MATERIALS} fill1*inv_raw2 <= inv_cap1;
constraint raw_inv3 :
     sum {m in RAW_MATERIALS} fill1*inv_raw3 <= inv_cap1;
constraint raw_inv4 :
     sum {m in RAW_MATERIALS} fill1*inv_raw4 <= inv_cap1;
/* constraint raw_inv5:*/
/*     sum {m in RAW_MATERIALS} fill1*inv_raw5 <= inv_cap1;*/

                 /*Constraint 2.13 add*/
constraint raw_cal {m in RAW_MATERIALS}:
     sum {t in TIME_PERIOD_1} inv_raw[m,t] = inv_raw1 + inv_raw2 + inv_raw3 + inv_raw4;
   
/*Constraint 2.14*/
constraint pro_inv2_1 :
     sum {p in PRODUCTS} fill2

*inv_pro2_1

<= inv_capk;

constraint pro_inv2_2 :
     sum {p in PRODUCTS} fill2

*inv_pro2_2

<= inv_capk;

constraint pro_inv2_3 :
     sum {p in PRODUCTS} fill2

*inv_pro2_3

<= inv_capk;

constraint pro_inv2_4 :
     sum {p in PRODUCTS} fill2

*inv_pro2_4

<= inv_capk;

/* constraint pro_inv2_5 {p in PRODUCTS}:*/
/*     sum {p in PRODUCTS} fill2

*inv_pro2_5

<= inv_capk;*/

constraint pro_inv3_1 :
     sum {p in PRODUCTS} fill2

*inv_pro3_1

<= inv_capk;

constraint pro_inv3_2 :
     sum {p in PRODUCTS} fill2

*inv_pro3_2

<= inv_capk;

constraint pro_inv3_3 :
     sum {p in PRODUCTS} fill2

*inv_pro3_3

<= inv_capk;

constraint pro_inv3_4 :
     sum {p in PRODUCTS} fill2

*inv_pro3_4

<= inv_capk;

/* constraint pro_inv3_5:*/
/*     sum {p in PRODUCTS} fill2

*inv_pro3_5

<= inv_capk;*/

constraint pro_inv4_1 :
     sum {p in PRODUCTS} fill2

*inv_pro4_1

<= inv_capk;

constraint pro_inv4_2 :
     sum {p in PRODUCTS} fill2

*inv_pro4_2

<= inv_capk;

constraint pro_inv4_3 :
     sum {p in PRODUCTS} fill2

*inv_pro4_3

<= inv_capk;

constraint pro_inv4_4 :
     sum {p in PRODUCTS} fill2

*inv_pro4_4

<= inv_capk;

/*Constraint 2.15*/
constraint truck_raw1 {j in SUPPLIERS}:
                     sum {m in RAW_MATERIALS} fill1*raw_quantity_1[j,m] <= sum {r in TRUCKS} truck_cap*truck_raw_1[j,r];
constraint truck_raw2 {j in SUPPLIERS}:
                     sum {m in RAW_MATERIALS} fill1*raw_quantity_2[j,m] <= sum {r in TRUCKS} truck_cap*truck_raw_2[j,r];
                 constraint truck_raw3 {j in SUPPLIERS}:
                     sum {m in RAW_MATERIALS} fill1*raw_quantity_3[j,m] <= sum {r in TRUCKS} truck_cap*truck_raw_3[j,r];
constraint truck_raw4 {j in SUPPLIERS}:
                     sum {m in RAW_MATERIALS} fill1*raw_quantity_4[j,m] <= sum {r in TRUCKS} truck_cap*truck_raw_4[j,r];
constraint truck_raw5 {j in SUPPLIERS}:
                     sum {m in RAW_MATERIALS} fill1*raw_quantity_5[j,m] <= sum {r in TRUCKS} truck_cap*truck_raw_5[j,r];
     /*Constraint 2.16*/
                 constraint truck_pro1 {k in STAGES2}:
     sum {p in PRODUCTS} fill2

*rep_size_1[p,k] <= sum {r in TRUCKS} truck_cap*truck_pro_1[k,r];

constraint truck_pro2 {k in STAGES2}:
     sum {p in PRODUCTS} fill2

*rep_size_2[p,k] <= sum {r in TRUCKS} truck_cap*truck_pro_2[k,r];

constraint truck_pro3 {k in STAGES2}:
     sum {p in PRODUCTS} fill2

*rep_size_3[p,k] <= sum {r in TRUCKS} truck_cap*truck_pro_3[k,r];

constraint truck_pro4 {k in STAGES2}:
     sum {p in PRODUCTS} fill2

*rep_size_4[p,k] <= sum {r in TRUCKS} truck_cap*truck_pro_4[k,r];

constraint truck_pro5 {k in STAGES2}:
     sum {p in PRODUCTS} fill2

*rep_size_5[p,k] <= sum {r in TRUCKS} truck_cap*truck_pro_5[k,r];

                 /*Constraint 2.17*/
constraint truck_raw_size1 {j in SUPPLIERS}:
     sum {r in TRUCKS} truck_cap*truck_raw_1[j,r] >= sum {m in RAW_MATERIALS} raw_quantity_1[j,m];
constraint truck_raw_size2 {j in SUPPLIERS}:
     sum {r in TRUCKS} truck_cap*truck_raw_2[j,r] >= sum {m in RAW_MATERIALS} raw_quantity_2[j,m];
constraint truck_raw_size3 {j in SUPPLIERS}:
     sum {r in TRUCKS} truck_cap*truck_raw_3[j,r] >= sum {m in RAW_MATERIALS} raw_quantity_3[j,m];
constraint truck_raw_size4 {j in SUPPLIERS}:
     sum {r in TRUCKS} truck_cap*truck_raw_4[j,r] >= sum {m in RAW_MATERIALS} raw_quantity_4[j,m];
constraint truck_raw_size5 {j in SUPPLIERS}:
     sum {r in TRUCKS} truck_cap*truck_raw_5[j,r] >= sum {m in RAW_MATERIALS} raw_quantity_5[j,m];
/*Constraint 2.18*/
constraint truck_pro_size1 {k in STAGES2}:
     sum {r in TRUCKS} truck_cap*truck_pro_1[k,r] >= sum {p in PRODUCTS} rep_size_1[p,k];
constraint truck_pro_size2 {k in STAGES2}:
     sum {r in TRUCKS} truck_cap*truck_pro_2[k,r] >= sum {p in PRODUCTS} rep_size_2[p,k];
constraint truck_pro_size3 {k in STAGES2}:
     sum {r in TRUCKS} truck_cap*truck_pro_3[k,r] >= sum {p in PRODUCTS} rep_size_3[p,k];
constraint truck_pro_size4 {k in STAGES2}:
     sum {r in TRUCKS} truck_cap*truck_pro_4[k,r] >= sum {p in PRODUCTS} rep_size_4[p,k];
constraint truck_pro_size5 {k in STAGES2}:
     sum {r in TRUCKS} truck_cap*truck_pro_5[k,r] >= sum {p in PRODUCTS} rep_size_5[p,k];

/*Constraint 2.19*/
                 constraint price_cons1_1 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity1_1[m,q] <= raw_order1_1[m,q]*boundary_quantity[m,q];
constraint price_cons1_2 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity1_2[m,q] <= raw_order1_2[m,q]*boundary_quantity[m,q];
constraint price_cons1_3 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity1_3[m,q] <= raw_order1_3[m,q]*boundary_quantity[m,q];
constraint price_cons1_4 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity1_4[m,q] <= raw_order1_4[m,q]*boundary_quantity[m,q];
constraint price_cons1_5 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity1_5[m,q] <= raw_order1_5[m,q]*boundary_quantity[m,q];

constraint price_cons2_1 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity2_1[m,q] <= raw_order2_1[m,q]*boundary_quantity[m,q];
                 constraint price_cons2_2 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity2_2[m,q] <= raw_order2_2[m,q]*boundary_quantity[m,q];
constraint price_cons2_3 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity2_3[m,q] <= raw_order2_3[m,q]*boundary_quantity[m,q];
constraint price_cons2_4 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity2_4[m,q] <= raw_order2_4[m,q]*boundary_quantity[m,q];
constraint price_cons3_1 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity3_1[m,q] <= raw_order3_1[m,q]*boundary_quantity[m,q];
constraint price_cons3_2 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity3_2[m,q] <= raw_order3_2[m,q]*boundary_quantity[m,q];
constraint price_cons3_3 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity3_3[m,q] <= raw_order3_3[m,q]*boundary_quantity[m,q];
constraint price_cons3_4 {m in RAW_MATERIALS, q in PRICE_INTERVALS}:
     raw_quantity3_4[m,q] <= raw_order3_4[m,q]*boundary_quantity[m,q];

/*Constraint 2.20*/
     constraint binary_price1_1 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order1_1[m,q] <= 1;
constraint binary_price1_2 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order1_2[m,q] <= 1;
                 constraint binary_price1_3 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order1_3[m,q] <= 1;
constraint binary_price1_4 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order1_4[m,q] <= 1;
constraint binary_price1_5 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order1_5[m,q] <= 1;

constraint binary_price2_1 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order2_1[m,q] <= 1;
constraint binary_price2_2 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order2_2[m,q] <= 1;
                 constraint binary_price2_3 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order2_3[m,q] <= 1;
constraint binary_price2_4 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order2_4[m,q] <= 1;
     constraint binary_price3_1 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order3_1[m,q] <= 1;
constraint binary_price3_2 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order3_2[m,q] <= 1;
                 constraint binary_price3_3 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order3_3[m,q] <= 1;
constraint binary_price3_4 {m in RAW_MATERIALS}:
     sum{q in PRICE_INTERVALS} raw_order3_4[m,q] <= 1;

                 /*Constraint added*/
constraint repl_order_sum {k in STAGES2}:
     sum {t in TIME_PERIODS} repl_order_k[k,t] = repl_order_k1 + repl_order_k2 + repl_order_k3
                                           + repl_order_k4 + repl_order_k5;

     constraint repl_order1_sum {j in SUPPLIERS}:
     sum {t in TIME_PERIODS} repl_order_1[j,t] = repl_order_11 + repl_order_12 + repl_order_13
                                           + repl_order_14 + repl_order_15;

/*Constraint rep_size added*/
                 constraint rep_cal1 {p in PRODUCTS}:
                     sum {k in STAGES2} rep_size_1[p,k] = rep_size_12

+ rep_size_13

;

                 constraint rep_cal2 {p in PRODUCTS}:
                     sum {k in STAGES2} rep_size_2[p,k] = rep_size_22

+ rep_size_23

;

                 constraint rep_cal3 {p in PRODUCTS}:
                     sum {k in STAGES2} rep_size_3[p,k] = rep_size_32

+ rep_size_33

;

                 constraint rep_cal4 {p in PRODUCTS}:
                     sum {k in STAGES2} rep_size_4[p,k] = rep_size_42

+ rep_size_43

;

                 constraint rep_cal5 {p in PRODUCTS}:
                     sum {k in STAGES2} rep_size_5[p,k] = rep_size_52

+ rep_size_53

;

/*Constraint inv_pro */
                 constraint inv_cal1 {p in PRODUCTS}:
                     sum {k in STAGES2} inv_pro1[p,k] = inv_pro2_1

+ inv_pro3_1

;

                 constraint inv_cal2 {p in PRODUCTS}:
                     sum {k in STAGES2} inv_pro2[p,k] = inv_pro2_2

+ inv_pro3_2

;

                 constraint inv_cal3 {p in PRODUCTS}:
                     sum {k in STAGES2} inv_pro3[p,k] = inv_pro2_3

+ inv_pro3_3

;

                 constraint inv_cal4 {p in PRODUCTS}:
                     sum {k in STAGES2} inv_pro4[p,k] = inv_pro2_4

+ inv_pro3_4

;

/*                 constraint inv_cal5 {p in PRODUCTS}:*/
/*                     sum {k in STAGES} inv_pro5[p,k] = inv_pro2_5

+ inv_pro3_5

;*/

/*Constraint repl & order binary vairables*/
constraint re_or_mamu1 {j in SUPPLIERS}:
     sum {m in RAW_MATERIALS} repl_raw1[j,m] = repl_order_11;

                constraint re_or_mamu2 {j in SUPPLIERS}:
     sum {m in RAW_MATERIALS} repl_raw2[j,m] = repl_order_12;

    constraint re_or_mamu3 {j in SUPPLIERS}:
     sum {m in RAW_MATERIALS} repl_raw3[j,m] = repl_order_13;

constraint re_or_mamu4 {j in SUPPLIERS}:
     sum {m in RAW_MATERIALS} repl_raw4[j,m] = repl_order_14;

constraint re_or_mamu5 {j in SUPPLIERS}:
     sum {m in RAW_MATERIALS} repl_raw5[j,m] = repl_order_15;

/*To solve the problem*/
solve with LP relaxint / iis=on;
                expand / iis;
print _VAR_;

QUIT;

Thanks and I cannot upload file, sorry.

SAS Employee
Posts: 416

Re: "Infeasible or Unbounded" Solution Status

When you solve with IIS=on, the resulting variable values are the same as before the solve.

That option is just to diagnose infeasibility, and it looks like you have made changes so that your problem is now feasible.  If you run as follows, you should get an integer optimal solution in under a minute, and it is not the zero solution:

solve with MILP / logfreq=10000;

Frequent Contributor
Posts: 86

Re: "Infeasible or Unbounded" Solution Status

So nice of you!!!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 8 replies
  • 488 views
  • 0 likes
  • 2 in conversation