help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] Setting Constarints


From: shruthi 98
Subject: [Help-glpk] Setting Constarints
Date: Tue, 2 Oct 2007 04:43:37 -0700 (PDT)

Dear ,
 
         I have modelled one of my linear programming using Glpk . I want to know how to set the mutiple constraints for my problem . I am attaching my problem with this . can you kindly help in setting mutiple constraints .
 
 
Thank you
Shruthi


Be a better Globetrotter. Get better travel answers from someone who knows.
Yahoo! Answers - Check it out.
     /* sets */
     set FOOD;
     set NEED;

      /* parameters */
      param NutrTable {i in FOOD, j in NEED};
      param Cost {i in FOOD};
      param Need {j in NEED};
      param NutrTable1 {i in FOOD,j in NEED};

      /* decision variables: x1: Brownie, x2: Ice cream, x3: soda, x4: cake*/
      var h {i in FOOD} >= 0;
       
      /* objective function */
      minimize z: sum{i in FOOD} Cost[i]*h[i];
     /* minimize z: sum{i in DAYS} x[i]; */


      /* Constraints */
    /*  s.t. const1 {j in NEED }: sum { i in FOOD }  h [i] >= NutrTable1 [i,j]; 
*/
      s.t. variable{j in NEED} : sum{i in FOOD} ( (NutrTable[i,j]*h[i] ) >= 
Need[j] ) and ( h[i] >= NutrTable1 [i,j] ) ;
      
/*      s.t. variable1{i in FOOD} : sum{i        in FOOD : i <> 1 and i <> 2 
and i >= 4 } h[i] >= 5; */
    /*  s.t. variable1(j in NEED) : sum{i in FOOD : h[i]} >= NutrTable1[i,j];*/
   

      /* data section */
      data;

      set FOOD := SMP Maltrodexin WPC SPI Sugar Inulin Coco MaltEx Fat VM MM;
      set NEED := Protien Fat Carb Cal Ph Fe VitA BCar B1 B2 B3 C B5 B6 Biotin 
Chol Inos;

     param NutrTable: Protien       Fat       Carb        Cal        Ph         
Fe        VitA        BCar       B1        B2         B3        C         B5    
      B6          Biotin       Chol       Inos:=
      SMP             360.0          15        540          1370           1000 
          1.4           0               0            0.45          1.64   1     
        5           0.31            0.03            0.0047           15     13  
      Maltrodexin     0             0       950     0              0            
  0             0               0            0     0              0             
0           0               0               0                5              0   
      WPC             800           0       50      400        300        0.3   
        0               0            0.1           0.5    0.3           1.5     
    0.1     0.01            0.0015           5          4
      SPI                   900               5         50          200    90   
          0.5           0.2             0.05         0.32          0.8    0.5   
        2           0.15            0.01            0.001        10         6
      Sugar         0               0         990           0          0        
          0             0               0            0         0                
  0             0           0               0               0            0      
    0   
      Inulin        0               0       950             0          0        
  0             0               0          0       0              0             
0           0               0               0                0          0
      Coco                250           120         510         0               
   0          0         0               0          0       0              0     
        0           0               0               0                0          0
      MaltEx        45        0             0           0                  0    
      0         0               0          0       0          0         0       
    0               0               0                0          0
      Fat                   10        500           400         0               
   0          0         0               0          0       0          0         
0           0               0               0                0      0   
      VM                  0             0           0           0               
   0              0             2500            1000       150       200        
  400           600         350     250             10           100        200 
       
      MM            0             0         0               3000       2000     
  0             0               0          0       0          0                 
0           0           0                   0              0        0;
 

      param Cost:=
      SMP              130.0
      Maltrodexin      40
      WPC              350
      SPI              220
      Sugar                  19
        Inulin       250
        Coco                 100
        MaltEx       300        
        Fat                  250        
        VM                   1000       
      MM               150;

      param Need:=
      Protien         321.7
      Fat             36.3
        Carb                521.1       
        Cal                 442.8       
        Ph                  317 
        Fe                  0.434
        VitA                12.52       
        BCar                5.005       
        B1                  0.906
        B2                  1.5536
        B3                  2.2338
        C                   4.64        
        B5                  1.8554
        B6                  1.2598      
        Biotin      0.051468    
        Chol                6.175       
      Inos            5.36;


     param NutrTable1: Protien       Fat      Carb   Cal  Ph    Fe    VitA    
BCar   B1    B2    B3   C   B5    B6    Biotin       Chol       Inos:=
      SMP             0             0        0      0      0       0     0      
      0 0       0       0    0   0         0        0             0             
 0
      Maltrodexin     0             0      0        0    0         0       0    
        0     0 0       0    0   0         0        0               0           
 0                      
      WPC             8             0      0        0    0     0           0    
        0     0 0     0    0   0           0        0           0               
 0
      SPI                   0         0        0      0    0     0     0        
        0     0 0     0    0   0           0        0             0             
 0
      Sugar         0               0        0      0    0     0     0          
0     0 0     0    0   0           0        0             0                0 
      Inulin        0               0      0        0    0     0     0          
0     0     0     0    0   0       0        0             0                0
      Coco                0             0          0      0        0       0    
 0              0       0     0     0    0   0     0        0             0     
           0 
      MaltEx        0               0              0      0        0       0    
 0              0       0     0     0    0   0     0        0             0     
           0 
      Fat                   0               0      0      0    0           0    
   0        0   0       0       0    0   0         0      0                 0   
         0
      VM                  0             0          0      0        0       0    
   0            0       0     0     0    0   0     0        0               0   
   0 
      MM            0             0        0        0    0     0           0    
        0       0     0     0    0   0     0        0             0          0;


      end;

reply via email to

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