lemon-project-template-glpk

annotate deps/glpk/examples/sql/transp.sql @ 9:33de93886c88

Import GLPK 4.47
author Alpar Juttner <alpar@cs.elte.hu>
date Sun, 06 Nov 2011 20:59:10 +0100
parents
children
rev   line source
alpar@9 1 CREATE DATABASE glpk;
alpar@9 2 CREATE USER glpk@localhost IDENTIFIED BY 'gnu';
alpar@9 3 GRANT ALL PRIVILEGES ON glpk.* TO glpk@localhost;
alpar@9 4 USE glpk;
alpar@9 5 # production capacity
alpar@9 6 DROP TABLE transp_capa;
alpar@9 7 CREATE TABLE transp_capa (
alpar@9 8 PLANT TEXT(127),
alpar@9 9 CAPA REAL,
alpar@9 10 PRIMARY KEY ( PLANT(127) )
alpar@9 11 );
alpar@9 12 INSERT INTO transp_capa ( PLANT, CAPA ) VALUES ( 'Seattle', 350 );
alpar@9 13 INSERT INTO transp_capa ( PLANT, CAPA ) VALUES ( 'San Diego', 600 );
alpar@9 14 # demand
alpar@9 15 DROP TABLE transp_demand;
alpar@9 16 CREATE TABLE transp_demand (
alpar@9 17 MARKET TEXT(127),
alpar@9 18 DEMAND REAL,
alpar@9 19 PRIMARY KEY ( MARKET(127) )
alpar@9 20 );
alpar@9 21 INSERT INTO transp_demand ( MARKET, DEMAND ) VALUES ( 'New York', 325 );
alpar@9 22 INSERT INTO transp_demand ( MARKET, DEMAND ) VALUES ( 'Chicago', 300 );
alpar@9 23 INSERT INTO transp_demand ( MARKET, DEMAND ) VALUES ( 'Topeka', 275 );
alpar@9 24 # distance
alpar@9 25 DROP TABLE transp_dist;
alpar@9 26 CREATE TABLE transp_dist (
alpar@9 27 LOC1 TEXT(127),
alpar@9 28 LOC2 TEXT(127),
alpar@9 29 DIST REAL,
alpar@9 30 PRIMARY KEY ( LOC1(127), LOC2(127) )
alpar@9 31 );
alpar@9 32 INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'Seattle', 'New York', 2.5 );
alpar@9 33 INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'Seattle', 'Chicago', 1.7 );
alpar@9 34 INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'Seattle', 'Topeka', 1.8 );
alpar@9 35 INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'San Diego', 'New York', 2.5 );
alpar@9 36 INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'San Diego', 'Chicago', 1.8 );
alpar@9 37 INSERT INTO transp_dist ( LOC1, LOC2, DIST ) VALUES ( 'San Diego', 'Topeka', 1.4 );
alpar@9 38 # result
alpar@9 39 DROP TABLE transp_result;
alpar@9 40 CREATE TABLE transp_result (
alpar@9 41 LOC1 TEXT(127),
alpar@9 42 LOC2 TEXT(127),
alpar@9 43 QUANTITY REAL,
alpar@9 44 PRIMARY KEY ( LOC1(127), LOC2(127) )
alpar@9 45 );