17 Ocak 2013 Perşembe

Gams-Global Optimization Example


Given the bilinear NLP below:

min f = x1 - x2 - y1 -x1y1 + x1y2 + x2y1 -x2y2
st. x1 + 4x2 ≤ 8
4x1 + x2 ≤ 12
3x1 + 4x2 ≤ 12
2y1 + y2 ≤ 8
y1 + 2y2 ≤ 8
y1 + y2 ≤ 5
0 ≤ x1, x2, y1, y2 ≤ 10
 ¿¿¿¿¿¿Question??????? 
Solve the problem with a random strategy in which we start a local optimizer from several randomly generated initial guesses and keep finally the solution with better objective function value.  


Gams Programi ile cozum kodlari asagidadir.
Ve programi indirme linki de --  https://hotfile.com/dl/189462700/7fa60ac/a)bilinearnlp.rar.html


sets
i iterations/1*10/ ;


variables
x1,x2,y1,y2,func;

parameters
objfun(i)
x1par
x2par
y1par
y2par;
equations
eq,q1,q2,q3,q4,q5,q6;


eq.. func=e=x1-x2-y1-x1*y1+x1*y2+x2*y1-x2*y2;
q1.. x1+4*x2=l=8;
q2.. 4*x1+x2=l=12;
q3.. 3*x1+4*x2=l=12;
q4.. 2*y1+y2=l=8;
q5.. y1+2*y2=l=8;
q6.. y1+y2=l=5;

x1.lo=0;
x2.lo=0;
y1.lo=0;
y2.lo=0;
y2.up=10;
y1.up=10;
x2.up=10;
x1.up=10;


*starting point
*x1.l=0;
*x2.l=0;
*y1.l=0;
*y2.l=0;

*model Exercise /all/;
model bilinear/all/;

loop (i,
x1.l=uniform(0,10);
x1par(i)=x1.l;
x2.l=uniform(0,10);
x2par(i)=x2.l;
y1.l=uniform(0,10);
y1par(i)=y1.l;
y2.l=uniform(0,10);
y2par(i)=y2.l;
*solve the problem
solve bilinear minimizing func using NLP;
*store the value
);
display x1par,x2par,y1par,y2par;

*solve Exercise minimizing func using nlp;


sonuclar: 

16 Ocak 2013 Çarşamba

Secmeli- Optimization-Curve fitting


Optimization problem.

y=a*x^b

ilk verilen a ve b degerlerini degistirerek gercek y degerine bu fonksiyonla yaklasmaya calisyoruz....
a=1.25 b=2.6

x Y gercek
1 2.33
1.5 4.47
3 35.8
4.7 110.6

https://hotfile.com/dl/189257329/fff7f24/curvefitting.xlsx.html

indirme linki


Example- 4.5) Calculation of Number of Transfer Units


Air, containing 3 % acetone by volume is to be washed with water in  a packed column  operating counter-currently at 1 bar and 25 oC, to reduce the acetone content to 0.5 % by volume. The flow rates of the gas and acetone-free water to the column are

300 k-mol/h and 690 k-mol/h respectively.

       a) Write the operating line equation,

       b) Calculate the concentration of liquid solution leaving the column as mass percent,

       c) Calculate the percentage recovery of acetone,

       d) Calculate number of the over-all gas transfer units required.

At the operating pressure, temperature and the concentration range the equilibrium distribution of acetone between air and water is given as y*=2.2x, where y and x are the mole fraction of acetone in gas and liquid respectively.


Mass Transfer Kitabindan .... derste isledigimiz soru excele dokulmus hali....

https://hotfile.com/dl/189252580/7b76aba/ornekler.xlsx.html
indirme linki....

15 Ocak 2013 Salı

Foot to Meter basit bir birim cevirme ile baslangici yapalim

C# kodlari

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace fttometer
{
class Program
{
static void Main(string[] args)
{
decimal m = 0M;
decimal ft = 0M;

string ftgirilen = ""; ;

Console.WriteLine(" foot: ");
ftgirilen=Console.ReadLine();
ft = decimal.Parse(ftgirilen);
m = ft * 0.30481M;

Console.WriteLine(m+" meters" );
Console.ReadLine();

}
}
}

https://hotfile.com/dl/189170723/e9c9759/fttometer.exe.html 


programi indirebilirsiniz...