Я учусь на последнем курсе и являюсь новичком в языке программирования CPLEX OPL.Я работал над моделью для определения размеров продуктов компании по производству напитков.Я рассмотрел модель небольшого сегмента, основанную на GLSP, в которой каждый макропериод имеет гибкие микропериоды, основанные на изменениях настройки.
Модель предполагает двухэтапный процесс с 3 производственными линиями и 3 смесительными резервуарами.,Мне не удалось представить следующие элементы в коде CPLEX.
- Набор микропериодов в каждом макропериоде
- переключений с продукта i к продукту j
- чтение строковых данных набора из MS Excel.
Академическая статья, на которую я ссылаюсь вмоя модель находится здесь Академическая бумага для модели
Есть ли кто-нибудь, кто может помочь мне перевести математику в статье в CPLEX OPL?
Ниже приведен мой коддалеко для объявления переменных модели и параметров
/*********************************************
* OPL 12.5 Model
* Author: HENRY
* Creation Date: Mar 9, 2019 at 7:30:27 PM
*********************************************/
//Model Parameters
int M = 4;
int F = 4;
int T = 5;
int N = 15;
int J = 4;
{int} micro_periods = {1,2,3};
{int} periods = {1,2,3,4,5};
tuple micro_period {
int micro1;
int micro2;
int micro3;
}
micro_period St[periods] = ...;//set of microperiods in period t
{string}machnes = {"line1","line2","line3"};
{string} lambda_j = ...;//set of lines that can produce item j
{string} alpha_m = ...;//set of items that can be produced on line m
{string} beta_m = ...;//set of liquid flavours that can be produced on tank m
{string} gamma_ml = ...;//set of items that can be produced on line m and need liquid flavour l
//ranges in the model
range products = 1..J;
range machines = 1..M;
range flavours = 1..F;
//range periods = 0..T-1;
//range micro_periods = 1..N; //total number of setups
tuple itm {
string line1;
string line2;
string line3;
}
//itm lambda_j[products] = ...;
tuple flvr {
string O;
string A;
string F;
string P;
}
//flvr beta_m[machines] = ...;
tuple lin {
string MA;
string MO;
string MF;
string PP;
}
//lin alpha_m[machines] = ...;
tuple gamma {
string line;
string flavor;
}
//gamma gamma_ml[machines][flavours] = ...;//revist this one
//Data Variables
float djt[products][periods] = ...;
float hj[products] = ...;
float gj[products] = ...;
float aIImj[machines][products] = ...;
float KIm[machines] = ...;//total capacity of tank m
float KIImt[machines][periods] = ...;//total available time
float rjl[products][flavours] = ...;
float qIm[machines] = ...;
float Ipj[products] = ...;//initial inventory of item j
float Imj[products] = ...;//inital back order of item j
//boolean yIml0[machines][flavours] = ...;
//boolean yIImj0[machines][products] = ...;
tuple flvr_edge {
int k;
int l;
}
tuple prdt_edge {
int i;
int j;
}
//sets in the model
setof(flvr_edge)flvrs = {<k,l> | k,l in flavours : k!=l};
float sIkl[flvrs] = ...;
float bIkl[flvrs] = ...;
setof(prdt_edge) prdts = {<i,j> | i,j in products: i!=j};
float sIIij[prdts] = ...;
float bIIij[prdts] = ...;
//Decision variables
dvar float+ Ipjt[products][periods];
dvar float+ Imjt[products][periods];
dvar float+ xIImjs[machines][products][micro_periods];
dvar float+ vIIms[machines][micro_periods];
dvar boolean yImls[machines][flavours][micro_periods];
dvar boolean yIImjs[machines][products][micro_periods];
dvar boolean zImkls[machines][flvrs][micro_periods];
dvar boolean zIImijs[machines][prdts][micro_periods];