Algoritmo+de+Força+Bruta+(problema+2)

Exercicio das embalagens, panos e papeis

/* Função Objectiva: F(x, y) = x + 1.75y

tem as seguintes restriçoes: f(x) = x + y ; g(x) = x + y ; t(x) = x + 5 * y

*/ 

 Exercicio das embalagens, panos e papeis    <span style="font-family: Arial,Helvetica,sans-serif;">var maximo = 0; <span style="font-family: Arial,Helvetica,sans-serif;">var valorx=0; <span style="font-family: Arial,Helvetica,sans-serif;">var valory=0;

<span style="font-family: Arial,Helvetica,sans-serif;">/*Inicio dos ciclos FOR*/ <span style="font-family: Arial,Helvetica,sans-serif;">for(x=0;x<=1000;x++) <span style="font-family: Arial,Helvetica,sans-serif;">{ <span style="font-family: Arial,Helvetica,sans-serif;">for(y=0;y<=2000;y++)

<span style="font-family: Arial,Helvetica,sans-serif;">{ <span style="font-family: Arial,Helvetica,sans-serif;">if ((x + y <= 800) && (x + y <= 1000) && ( x + 5 * y <=2000)) <span style="font-family: Arial,Helvetica,sans-serif;">{ <span style="font-family: Arial,Helvetica,sans-serif;">/*obtenção do Lucro Máximo*/ <span style="font-family: Arial,Helvetica,sans-serif;">total = x + 1.75 * y <span style="font-family: Arial,Helvetica,sans-serif;">if (total > maximo) <span style="font-family: Arial,Helvetica,sans-serif;">{ <span style="font-family: Arial,Helvetica,sans-serif;">maximo = total <span style="font-family: Arial,Helvetica,sans-serif;">valorx = x <span style="font-family: Arial,Helvetica,sans-serif;">valory = y <span style="font-family: Arial,Helvetica,sans-serif;">} <span style="font-family: Arial,Helvetica,sans-serif;">} <span style="font-family: Arial,Helvetica,sans-serif;">} <span style="font-family: Arial,Helvetica,sans-serif;">} <span style="font-family: Arial,Helvetica,sans-serif;">/*Leitura dos valores*/ <span style="font-family: Arial,Helvetica,sans-serif;">document.write("valor x: "+valorx+" "); <span style="font-family: Arial,Helvetica,sans-serif;">document.write("valor y: "+valory+" "); <span style="font-family: Arial,Helvetica,sans-serif;">document.write("Maximo Lucro: "+maximo); <span style="font-family: Arial,Helvetica,sans-serif;"> <span style="font-family: Arial,Helvetica,sans-serif;"> <span style="font-family: Arial,Helvetica,sans-serif;">