Reputation: 45
I stopped at 1:31min, and this was the Engine log output: I am making a model using CP for goal programming - lexicographic. The data come from an excel file.
The problem is: the software is working, working.... with no answer.
I can see that it is working because the time is passing in the right bottom corner. The data is not too large, I used the same data for other analyses at CPLEX and it worked fine.
Excel file: https://drive.google.com/open?id=1rOKhqlegKo-BHJnJj9cnnpKMdwpktYlX
1) Someone could see what is wrong? 2) Just making sure, using CP is not possible to have a dvar as a float+, right?
Thank you
.mod
using CP;
// variable decision
{string} Forest = ...;
{string} Products = ...;
{string} Destination = ...;
float Demand [Destination][Products]= ...; //volume in Kg
float Distance [Forest][Destination]= ...; //in Km
float Stock [Forest][Products]= ...; //volume in Kg
float Freshness [Forest][Products]=...; `
//Decision Variables
dvar int+ Delivered [Forest][Destination][Products];
//Expressoes
dexpr float Opt_Distance = sum (u in Forest, c in Destination, p in Products) Distance[u][c] * Delivered[u][c][p];
dexpr float Opt_Freshness = sum (u in Forest, c in Destination, p in Products) Freshness[u][p] * Delivered[u][c][p];
//Objective Function
minimize staticLex (Opt_Distance,Opt_Freshness);
//Constraint
subject to {
forall (p in Products)
forall (u in Forest)
sum (c in Destination)
Delivered[u][c][p] <= Stock [u][p];
forall (p in Products)
forall (c in Destination)
sum (u in Forest)
Delivered[u][c][p] >= Demand[c][p];
}
.dat
// variable decision
Forest = {"F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12","F13","F14","F15","F16","F17","F18","F19","F20","F21","F22","F23","F24","F25","F26","F27","F28","F29","F30","F31","F32","F33","F34","F35","F36","F37","F38","F39","F40","F41","F42","F43","F44","F45","F46","F47","F48","F49","F50"};
Products = {"P1","P2","P3","P4"};
Destination = {"D1","D2","D3","D4","D5","D6","D7","D8","D9","D10"};
SheetConnection sheet("...Data_test.xlsx");
Demand from SheetRead(sheet,"Demand");
Distance from SheetRead(sheet,"Distance");
Stock from SheetRead(sheet,"Stock");
Freshness from SheetRead(sheet,"Freshness");
Upvotes: 1
Views: 342
Reputation: 175
It seems that you did not set any time limit. In this case the engine searches for the best solution until it could prove the current solution is optimal. In general, there is no guarantee that the search will end in a reasonable time (the problem could be NP).
As the log shows, you stopped the search manually ("by abort") after 88s and in the meantime 86 solutions were found. Each time a solution is found there is a line in the log starting by star. The current best objective value is also printed in the log (the first column).
So I suggest to add some time limit (or other type of limit) into your model. It could be done this way:
execute {
cp.param.timelimit = 120; // In seconds
}
And yes, it is not possible to have floating-point variables in CP model.
Upvotes: 3