SHARE
TWEET

Untitled

a guest Jan 23rd, 2020 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. MODEL:
  2.  
  3. SETS:
  4.     PERSON/P1..P4/: SEX, ORIENTATION, EDUCATION, AGE;
  5.     PAIR(PERSON, PERSON): X, Q, SOM, EM, AM;
  6. ENDSETS
  7.  
  8. DATA:
  9.     EDUCATION = 0, 1, 2, 3;
  10.     SEX = 1, 1, 1, 0; !0 - kobieta, 1 - moezczynza;
  11.     ORIENTATION = 1, 0, 0, 1; !1 - hetero, 0 - homo;
  12.     AGE = 18, 28, 18, 30;
  13. ENDDATA
  14.  
  15. !funkcja celu;
  16. [OBJ] MIN = @SUM(PAIR(I,J): Q(I,J) * X(I,J));
  17.  
  18. !binarny wybor;
  19. @FOR(PAIR: @BIN(X));
  20.  
  21. !p sama ze soba;
  22. @FOR(PAIR(I,I): X(I,I) = 0);
  23.  
  24. !tylko jedna osoba;
  25. @FOR(PERSON(I): @SUM(PERSON(J): X(I,J)) + @SUM(PERSON(J): X(J,I)) = 1);
  26.  
  27. !zgodnosc plci i orientacji;
  28. @FOR(PAIR(I,J) | (ORIENTATION(I) #EQ# 1 #AND# SEX(I) #NE# SEX(J)): SOM(I,J) = 0);
  29. @FOR(PAIR(I,J) | (ORIENTATION(I) #EQ# 0 #AND# SEX(I) #EQ# SEX(J)): SOM(I,J) = 0);
  30.  
  31.  
  32. @FOR(PAIR(I,J) | (ORIENTATION(I) #EQ# 1 #AND# SEX(I) #EQ# SEX(J)): SOM(I,J) = 5);
  33. @FOR(PAIR(I,J) | (ORIENTATION(I) #EQ# 0 #AND# SEX(I) #NE# SEX(J)): SOM(I,J) = 5);
  34.  
  35.  
  36. CALC:
  37.     @FOR(PAIR(I,J): EM(I,J) = @ABS(EDUCATION(I) - EDUCATION(J)));
  38.     @FOR(PAIR(I,J): AM(I,J) = @ABS(AGE(I) - AGE(J)));
  39.     @FOR(PAIR(I,J): Q(I,J) = SOM(I,J) + EM(I,J) + AM(I,J));
  40.  
  41. ENDCALC
  42.  
  43. END
  44.  
  45. -----------------------------------------------------------------------------------------
  46.  
  47. MODEL:
  48. ! A 3 Warehouse, 4 Customer
  49.    Transportation Problem;
  50.  
  51. SETS:
  52.    WAREHOUSE / WH1, WH2, WH3/   : CAPACITY;
  53.    CUSTOMER   / C1, C2, C3/ : DEMAND;
  54.    bridge( WAREHOUSE, CUSTOMER) : VOLUME, COST;
  55. ENDSETS
  56.  
  57. ! The objective;
  58.  [OBJ] MIN = @SUM( bridge: @logb((volume^(2/3)),2)* VOLUME)
  59.  + @SUM( bridge: @logb((volume^(2/3)),2.1) * VOLUME)
  60.  + @SUM( bridge: @logb((volume^(2/3)),2.5) * VOLUME);
  61.  
  62. ! The demand constraints;
  63.  @FOR( CUSTOMER( J): [DEM]
  64.   @SUM( WAREHOUSE( I): VOLUME( I, J)) <=
  65.    DEMAND( J));
  66.  
  67. ! The supply constraints;
  68.  @FOR( WAREHOUSE( I): [SUP]
  69.   @SUM( CUSTOMER( J): VOLUME( I, J)) >=
  70.    CAPACITY( I));
  71.  
  72. ! Here are the parameters;
  73. DATA:
  74.    CAPACITY =   10, 25, 21 ;
  75.    DEMAND =   25, 17, 22;
  76.     COST = 2, 2, 2,
  77.         2.1,2.1,2.1,
  78.         2.5,2.5,2.5;
  79.        
  80. ENDDATA
  81. END
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top