Hello friends, i have to make this problem, i have errors while doing the equations. can you halp me out?
An airline operates the San FranciscoLos Angeles route. The demand for each flight clearly has two distinct components. There is a demand for business, with a price that responds to the curve p = 6004q and a demand for leisure: p = 450q. The costs of the company are 5 + 3q, where q represents the total number of seats sold.
1) Analyze the model to be solved. Define (by hand) the parameters, variables and equations of the model. What kind of model is it, linear or nonlinear? Nonlinear
2) Program the model in GAMS. How many sets do we have? Solve it. How many seats will the company sell in each class and at what price? Calculate the elasticity of each of the demands at this point and export them to an excel file.
3) How will the solution change if the plane has a maximum capacity of 260 seats?
4) Program a routine that allows you to solve the model for business demands p = a * (6004q), where a takes the values from 1 to 1.5 in increments of 0.05. Export the results of the quantities, prices and benefits in each case. 11 times res optimization /01*11/
$title AIRLINE COMPANY PROBLEM
SET
i 'flight' / business, leisure /
Parameter
a(i)
/ business 600
leisure 450 /
b(i)
/ business 4
leisure 1 /;
VARIABLE
cost
price(i) "p1,p2"
quantity(i) "q1,q2"
profit
income(i)
Scalar f "numbers of seats" / 260 /;
Positive Variable price,quantity;
Equation
eqcost
eqprofit
eqprice(i)
eqincome(i)
eqquantity(i)
eqcost.. =e= sum(i, quantity(i),*3+5));
eqprice(i).. a(i)b(i)*quantity(i) =e=price(i);
eqquantity(i).. sum (5/3 ,cost(i)/3)), =e=;
eqincome(i).. price(i)*q(i), =e=income(i);
eqprofit sum (i,income(i)), cost, =e=profit;
Model airline / all /;
solve airline using lp minimizing cost;
nonlinear problem
Re: nonlinear problem
Several issues.
1. the equation eqcost should be cost =e=..
2. There should be a ; at the end of equation block.
3. sum(5/3,..) is meaningless. Not sure what you try to achieve
4. Many unmatched parantheses and simple syntax errors in equations
Please follow some tutorials in the GAMS documentation before you start.
https://www.gams.com/latest/docs/UG_MAI ... l_Examples
 Atharv
1. the equation eqcost should be cost =e=..
2. There should be a ; at the end of equation block.
3. sum(5/3,..) is meaningless. Not sure what you try to achieve
4. Many unmatched parantheses and simple syntax errors in equations
Please follow some tutorials in the GAMS documentation before you start.
https://www.gams.com/latest/docs/UG_MAI ... l_Examples
 Atharv

 User
 Posts: 4
 Joined: 2 months ago
Re: nonlinear problem
when I divide by 3, I want to get the quantities
eqcost.. cost =e= sum(i, quantity(i),*3+5)); in this line i still have the error 8
eqcost.. cost =e= sum(i, quantity(i),*3+5)); in this line i still have the error 8

 User
 Posts: 4
 Joined: 2 months ago
Re: nonlinear problem
i have problems in eqquantity(i)
An airline operates the San FranciscoLos Angeles route. The demand for each flight clearly has two distinct components. There is a demand for business, with a price that responds to the curve p = 6004q and a demand for leisure: p = 450q. The costs of the company are 5 + 3q, where q represents the total number of seats sold.
1) Analyze the model to be solved. Define (by hand) the parameters, variables and equations of the model. What kind of model is it, linear or nonlinear? Nonlinear
2) Program the model in GAMS. How many sets do we have? Solve it. How many seats will the company sell in each class and at what price? Calculate the elasticity of each of the demands at this point and export them to an excel file.
3) How will the solution change if the plane has a maximum capacity of 260 seats?
4) Program a routine that allows you to solve the model for business demands p = a * (6004q), where a takes the values from 1 to 1.5 in increments of 0.05. Export the results of the quantities, prices and benefits in each case. 11 times res optimization /01*11/
$title AIRLINE COMPANY PROBLEM
SET
i 'flight' / business, leisure /
Parameter
a(i)
/ business 600
leisure 450 /
b(i)
/ business 4
leisure 1 /;
VARIABLE
cost
price(i) "p1,p2"
quantity(i) "q1,q2"
profit
income(i)
Scalar f "numbers of seats" / 260 /;
Positive Variable price,quantity;
Equation
eqcost
eqprofit
eqprice(i)
eqincome(i)
eqquantity(i);
eqcost.. cost =e= sum(i, quantity(i)*3+5);
eqprice(i).. a(i)b(i)*quantity(i) =e=price(i);
eqquantity(i).. sum (5/3, cost(i)/3)), =e=;
eqincome(i).. price(i)*q(i), =e=income(i);
eqprofit sum (i,income(i)), cost, =e=profit;
Model airline / all /;
solve airline using nlp minimizing cost;
An airline operates the San FranciscoLos Angeles route. The demand for each flight clearly has two distinct components. There is a demand for business, with a price that responds to the curve p = 6004q and a demand for leisure: p = 450q. The costs of the company are 5 + 3q, where q represents the total number of seats sold.
1) Analyze the model to be solved. Define (by hand) the parameters, variables and equations of the model. What kind of model is it, linear or nonlinear? Nonlinear
2) Program the model in GAMS. How many sets do we have? Solve it. How many seats will the company sell in each class and at what price? Calculate the elasticity of each of the demands at this point and export them to an excel file.
3) How will the solution change if the plane has a maximum capacity of 260 seats?
4) Program a routine that allows you to solve the model for business demands p = a * (6004q), where a takes the values from 1 to 1.5 in increments of 0.05. Export the results of the quantities, prices and benefits in each case. 11 times res optimization /01*11/
$title AIRLINE COMPANY PROBLEM
SET
i 'flight' / business, leisure /
Parameter
a(i)
/ business 600
leisure 450 /
b(i)
/ business 4
leisure 1 /;
VARIABLE
cost
price(i) "p1,p2"
quantity(i) "q1,q2"
profit
income(i)
Scalar f "numbers of seats" / 260 /;
Positive Variable price,quantity;
Equation
eqcost
eqprofit
eqprice(i)
eqincome(i)
eqquantity(i);
eqcost.. cost =e= sum(i, quantity(i)*3+5);
eqprice(i).. a(i)b(i)*quantity(i) =e=price(i);
eqquantity(i).. sum (5/3, cost(i)/3)), =e=;
eqincome(i).. price(i)*q(i), =e=income(i);
eqprofit sum (i,income(i)), cost, =e=profit;
Model airline / all /;
solve airline using nlp minimizing cost;

 User
 Posts: 4
 Joined: 2 months ago
Re: nonlinear problem
error in eqproft line
$title AIRLINE COMPANY PROBLEM
SET
i 'flight' / business, leisure /
Parameter
a(i)
/ business 600
leisure 450 /
b(i)
/ business 4
leisure 1 /;
VARIABLE
cost
price(i) "p1,p2"
profit
income(i)
Scalar f "numbers of seats" / 260 /;
Positive Variable price,quantity;
Equation
eqcost
eqprofit
eqprice(i)
eqincome(i);
eqcost.. cost =e= sum(i, quantity(i)*3+5);
eqprice(i).. a(i)b(i)*quantity(i) =e=price(i);
eqincome(i).. (price(i)*a(i)) =e=income(i);
eqprofit sum (i,income(i), cost) =e=profit;
Model airline / all /;
solve airline using nlp minimizing cost;
$title AIRLINE COMPANY PROBLEM
SET
i 'flight' / business, leisure /
Parameter
a(i)
/ business 600
leisure 450 /
b(i)
/ business 4
leisure 1 /;
VARIABLE
cost
price(i) "p1,p2"
profit
income(i)
Scalar f "numbers of seats" / 260 /;
Positive Variable price,quantity;
Equation
eqcost
eqprofit
eqprice(i)
eqincome(i);
eqcost.. cost =e= sum(i, quantity(i)*3+5);
eqprice(i).. a(i)b(i)*quantity(i) =e=price(i);
eqincome(i).. (price(i)*a(i)) =e=income(i);
eqprofit sum (i,income(i), cost) =e=profit;
Model airline / all /;
solve airline using nlp minimizing cost;
Re: nonlinear problem
Please use code block while posting a code.
sum (i,income(i), cost) what is the purpose of this comma after income(i), please do not make up your own syntax. Try to read the error and check the syntax in GAMS documentation.
Good luck.
 Atharv
sum (i,income(i), cost) what is the purpose of this comma after income(i), please do not make up your own syntax. Try to read the error and check the syntax in GAMS documentation.
Good luck.
 Atharv