You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.6 KiB

2 months ago
  1. CREATE DATABASE glpk;
  2. CREATE USER glpk@localhost IDENTIFIED BY 'gnu';
  3. GRANT ALL PRIVILEGES ON glpk.* TO glpk@localhost;
  4. USE glpk;
  5. # production capacity
  6. DROP TABLE transp_capa;
  7. CREATE TABLE transp_capa (
  8. PLANT TEXT(127),
  9. CAPA REAL,
  10. PRIMARY KEY ( PLANT(127) )
  11. );
  12. INSERT INTO transp_capa ( PLANT, CAPA ) VALUES ( 'Seattle', 350 );
  13. INSERT INTO transp_capa ( PLANT, CAPA ) VALUES ( 'San Diego', 600 );
  14. # demand
  15. DROP TABLE transp_demand;
  16. CREATE TABLE transp_demand (
  17. MARKET TEXT(127),
  18. DEMAND REAL,
  19. PRIMARY KEY ( MARKET(127) )
  20. );
  21. INSERT INTO transp_demand ( MARKET, DEMAND ) VALUES ( 'New York', 325 );
  22. INSERT INTO transp_demand ( MARKET, DEMAND ) VALUES ( 'Chicago', 300 );
  23. INSERT INTO transp_demand ( MARKET, DEMAND ) VALUES ( 'Topeka', 275 );
  24. # distance
  25. DROP TABLE transp_dist;
  26. CREATE TABLE transp_dist (
  27. LOC1 TEXT(127),
  28. LOC2 TEXT(127),
  29. DIST REAL,
  30. PRIMARY KEY ( LOC1(127), LOC2(127) )
  31. );
  32. INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'Seattle', 'New York', 2.5 );
  33. INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'Seattle', 'Chicago', 1.7 );
  34. INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'Seattle', 'Topeka', 1.8 );
  35. INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'San Diego', 'New York', 2.5 );
  36. INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'San Diego', 'Chicago', 1.8 );
  37. INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'San Diego', 'Topeka', 1.4 );
  38. # result
  39. DROP TABLE transp_result;
  40. CREATE TABLE transp_result (
  41. LOC1 TEXT(127),
  42. LOC2 TEXT(127),
  43. QUANTITY REAL,
  44. PRIMARY KEY ( LOC1(127), LOC2(127) )
  45. );