I am building a simple model on Minizinc 2.5.3 (latest version) and Gecode 6.3.0 to try and organize a weapons production operation. When running the code, the following error appears:
Error: Gecode: Float::linear: Number out of limits
I've been reading about some limitations to float variables with Gecode, but I don't know whether the problem is with the solver or with my code (attached). I've tried changing all to integer variables but the resource requirements are floating point parameters. I've also tried to change the solver but none of them have worked (there is no MIP solver available).
enum WEAPONS; %product
enum RESOURCES; %resources
array [RESOURCES] of float: capacity; %resource constraints
array [WEAPONS] of float: pwr; %profit/objective
array [WEAPONS,RESOURCES] of float: consumption; %consumption of resources for each product unit
array [WEAPONS] of var int: amt; %amount to produce
constraint forall(i in WEAPONS)(amt[i]>=0); %non-negative
constraint forall(r in RESOURCES)(sum(i in WEAPONS)(consumption[i,r]*amt[i])<=capacity[r]); %availability of resources must not be exceeded
solve maximize sum(i in WEAPONS)(pwr[i]*amt[i]);
output ["\(i): \(amt[i])\n" | i in WEAPONS];
I am using the following data file:
%Product
WEAPONS = {AXE, SWORD, PIKE, SPEAR, CLUB};
%Resoruces
RESOURCES = {IRON, WOOD, BLACKSMITHHR, CARPENTERHR};
%capacity
capacity = [5000, 7500, 4000, 3000];
%consumption: [Product,Resources]
consumption = [| 1.5, 1, 1, 1
| 2, 0, 2, 0
| 1.5, 0.5, 1, 1
| 0.5, 1, 0.9, 1.5
| 0.1, 2.5, 0.1, 2.5 |];
%profit
pwr = [11, 18, 15, 17, 11];