	include "knapsack-data.cmpl"
	
	#calculating the relative value of each box	
	{j in boxes: val[j]:= w[j]/p[j]; } 
	
	M:=10000;
	sumSales:=0;
	sumWeight:=0;
	#initial solution 
	x[]:=(0,0,0,0,0,0,0,0,0,0);
	{sumSales < minSales: 
		maxVal:=min(val[]);
		{j in boxes: 
			{ maxVal=val[j] : 
					{ sumSales < minSales: 
							x[j]:=1;
							sumSales:=sumSales + p[j];
							sumWeight:=sumWeight + w[j]; 
					}

					val[j]:=M;
					break j;
			}
		}	
		repeat;
	}  
	echo "Solution found";
	echo "Optimal total weight : " + sumWeight;
	echo "Total sales: "+ sumSales;	
	{j in boxes: echo "x_"+ j + ": " + x[j]; } 
