Error

24 views
Skip to first unread message

mark.kovalen...@gmail.com

unread,
Jun 21, 2017, 4:37:58 PM6/21/17
to AMPL Modeling Language

Hello all!
Please hepl us, we have a project work in uni
Excel file with data also attached.

/* Задание множеств */

set PRD; #product groups
set PLA; #plants
set DC; #warehouse
set MKT; #demand markets


/* Объявление параметров модели */
param MAXPROD {PRD,PLA}; # amount of product i produced at plant j
param PRODCOST {PRD,PLA}; # production costs for each product at each plant
param tariff {PLA,DC};
param tariff1 {PLA,MKT};
param tariff2 {DC,MKT};
param HAND {PRD,DC};
param STORE {PRD,DC};
param PENALTY {PRD,MKT};
param DEMAND {PRD,MKT};
param UNSAT {PRD,MKT};
param TRNCON {PRD,DC}; #
param DCCAP {PRD,DC};

 /* Объявление переменных модели */
var volume {PRD,PLA} >=0;

var trans {PRD,PLA,DC} >=0;
var trans1 {PRD,PLA,MKT} >=0; 
var trans2 {PRD,DC,MKT} >=0;
var throughput {PRD,DC} >=0;
var capacity {PRD,DC} >=0;

 /* Целевая функция */
 minimize Cost: sum {n in PRD, p in PLA} PRODCOST[n,p]*volume[n,p]
 + sum {n in PRD, p in PLA, m in MKT} tariff1 [p,m] * trans1[n,p,m]
 + sum {n in PRD, p in PLA,k in DC} tariff [p,k]*trans[n,p,k]
 +sum {n in PRD, k in DC,m in MKT} tariff2 [k,m]*trans2[n,k,m]
 +sum {n in PRD, k in DC} HAND [n,k]*throughput [n,k]
 + sum {n in PRD, k in DC} STORE [n,k]*throughput[n,k]  
 +sum {n in PRD, u in MKT} PENALTY[n,u]*UNSAT[n,u];   
  /* Система ограничений */
  
  subject to Volume {n in PRD, p in PLA,k in DC, m in MKT}: volume [n,p] = 
                                          trans[n,p,k]+ 
                                           trans1[n,p,m];
 
  subject to Demand {n in PRD, m in MKT,p in PLA, k in DC, u in MKT}:  trans1[n,p,m] +
                                           trans2[n,k,m] +
                                           UNSAT[m,u];
  subject to Throughput {n in PRD, k in DC, m in MKT} :  trans2[n,k,m] - 
                                               throughput [n,k];
           subject to Capacity {n in PRD, k in DC} :  TRNCON [n,k]*throughput [n,k]-
           DCCAP[n,k]<=0;
           
  
table Production IN "ODBC" "project.xlsx" "production$" :  [PRD, PLA],  MAXPROD;
table Production1 IN "ODBC" "project.xlsx" "production1$" :  [PRD, PLA],  PRODCOST;

table Transportation IN "ODBC" "project.xlsx" "transportation$" :  [origin,destination], tariff;

table Transportation1 IN "ODBC" "project.xlsx" "transportation1$" :  [origin,destination], tariff1;
table Transportation2 IN "ODBC" "project.xlsx" "transportation2$" :  [origin,destination],tariff2;

table Handlingstorage IN "ODBC" "project.xlsx" "handlingstorage$" :  [DC, Product], HAND,STORE;

table Market IN "ODBC" "project.xlsx" "market$" :  [Market,Product], PENALTY,UNSAT ;

table Dc IN "ODBC" "project.xlsx" "dc$" : [DC, Product],TRNCON,DCCAP;

reset;
model project.mod;
data project.dat;
read table Production;
read table Production1;
read table Transportation;
read table Transportation1;
read table Transportation2;
read table Handlingstorage;
read table Market;
read table Dc;

option solver gurobi;
solve;

display Cost;
display trans;

ampl: include project.run
Error at _cmdno 12 executing "solve" command
(file project.run, line 14, offset 272):
error processing param PRODCOST[...]:
no data for set PRD

project.xlsx

Robert Fourer

unread,
Jun 22, 2017, 10:43:58 PM6/22/17
to am...@googlegroups.com
It appears that you are not reading data for the set PRD anywhere. Do you have data for PRD (and also PLA, DC, and MKT) in file project.dat? Perhaps you could also post that file. (You can attach it to your email to this forum.)

Bob Fourer
am...@googlegroups.com

=======

From: am...@googlegroups.com [mailto:am...@googlegroups.com] On Behalf Of mark.kovalen...@gmail.com
Sent: Wednesday, June 21, 2017 3:38 PM
To: AMPL Modeling Language
Subject: [AMPL 14277] Error

...

set PRD; #product groups
set PLA; #plants
set DC; #warehouse
set MKT; #demand markets

...

param MAXPROD {PRD,PLA}; # amount of product i produced at plant j
param PRODCOST {PRD,PLA}; # production costs for each product at each plant

...

mark.kovalen...@gmail.com

unread,
Jun 23, 2017, 9:33:48 AM6/23/17
to AMPL Modeling Language, 4...@ampl.com
We have data in excel, so in file project.dat we mentioned data

пятница, 23 июня 2017 г., 5:43:58 UTC+3 пользователь Robert Fourer написал:
It appears that you are not reading data for the set PRD anywhere.  Do you have data for PRD (and also PLA, DC, and MKT) in file project.dat?  Perhaps you could also post that file.  (You can attach it to your email to this forum.)

Bob Fourer
am...@googlegroups.com

=======

project.dat
project.mod
project.run
Reply all
Reply to author
Forward
0 new messages