Originally posted by: Kava
Hi,
I have just tried to create an example of a project similar to xsteel, where the data is read and written into an Excel file.
It is an extremely simple model of a transportation problem:
Model :
// Sets
{string} FACTORIES =...;
{string} CLIENTS =...;
// Data
float cost[FACTORIES][CLIENTS] =...;
float capacity[FACTORIES];
float demand[CLIENTS] =...;
// Variables
dvar float+ Send[FACTORIES][CLIENTS];
// Model
minimize sum(i in FACTORIES, j in CLIENTS) cost[i][j]*Send[i][j];
subject to {
forall (i in FACTORIES) ctCap: sum(j in CLIENTS) Send[i][j] <= capacity[i];
forall (j in CLIENTS) ctDem: sum(i in FACTORIES) Send[i][j] <= demand[j];
}
Data file:
SheetConnection sheet("Distribution_Examples.xslx");
FACTORIES from SheetRead(sheet,"Transport1!A9:A10");
CLIENTS from SheetRead(sheet,"Transport1!B8:F8");
cost from SheetRead(sheet,"Transport1!B9:F10");
capacity from SheetRead(sheet,"Transport1!Capacity");
demand from SheetRead(sheet,"Transport1!Demand");
Send to SheetWrite(sheet,"Transport1!Products_shipped");
When I try to run Cplex, I always get an error message "Distribution_Examples" file is not found". I have no clue what it can be. The Excel file is in the same folder as .mod and .dat files.
PS xsteel examples does not work as well, when I replace its Excel file with a similar new Excel file.
#DecisionOptimization#OPLusingCPLEXOptimizer