Hello,
I'm making a problem to maximize the production in a certain refinery (college studies).
The software gives me the information that my problem is unbounded (badly scaled), what is the reason?
And the optimal solution is not correct.
The code is in attachment to this post.
Thank you in advance.
Model:
Set
a declaration of type of fuels /FO, G95, G98/
;
Parameters
costs(a) costs of production for each type of fuel in € per liter
revenue(a) revenue of selling each type of fuel in € per liter
mindemandgasoline minimum anticipated demand of gasoline (per day)
maxdemandfueloil production limit of fuel oil (per day)
;
*Import of the numerical data of the problem (input data file must be in project directory):
$call GDXXRW.exe i=data_input.xlsx o=data_input.gdx par=costs rng=Refinery!B2:C5 rdim=1 par=revenue rng=Refinery!B7:C10 rdim=1 par=maxdemandfueloil rng=Refinery!B13 dim=0 par=mindemandgasoline rng=Refinery!B16 dim=0
$GDXIN data_input.gdx
$LOAD costs, revenue, maxdemandfueloil, mindemandgasoline
$GDXIN
Positive Variables
totalrevenue total revenue in €
totalcosts total costs in €
;
Free Variables
totalprofit total profit in €
z(a) decision variable in kg per each paper type
;
Equations
objfunction objective function
totalrevenuecalc revenue calculation
totalcostscalc costs calculation
restriction1 restricting the minimum demand of gasoline per day
restriction2 restricting the maximum demand of fuel oil production per day
restriction3 restricting two parts of fuel oil for units of gasoline;
totalrevenuecalc
..totalrevenue =e=(sum(a,revenue(a)*z(a)));
totalcostscalc
..totalcosts =e=(sum(a,costs(a)*z(a)));
objfunction
..totalprofit=e=((sum(a,revenue(a)*z(a)))-((sum(a,costs(a)*z(a)))));
*Profit equals revenue minus costs
restriction1..((z("G95"))+(z("G98")))=g= mindemandgasoline;
*restricts the production of gasoline to a minimum demand value given
restriction2..(z("FO"))=l= maxdemandfueloil;
*restricts the maximum production of fuel oil
restriction3..(z("FO"))=g=(2*(z("G95")+z("G98")));
*restricts the amount of gasoline to at least half the amount
*fuel oil
Model
Refinery /all/
;
* Chosing of the minos solver for this solution
Option lp=minos; File opt 'Minos option file' /minos.opt/;
*Output file configuration in following code:
putclose opt 'Iteration limit 10000'/ 'Feasibility tolerance 1.0E-5'/;
File Dispatch this is the internal .doc /refinery_outputdata.doc/;
puttl Dispatch, "Economical evaluation of production refinery"///;
puthd "Products are the following:"/;
put
@10,"Fuel oil - FO"/
@10,"Gasoline 95 - G95"/
@10,"Gasoline 98 - G98"//
;
Solve
Refinery using lp maximizing totalprofit
Problem is unbounded
Problem is unbounded
- Attachments
-
- TP2.gms
- (4.42 KiB) Downloaded 185 times
Re: Problem is unbounded
It's hard to run this without the data. You might want to attach data_input.xlsx.
-Michael
-Michael
Re: Problem is unbounded
The input data file in attachment:
- Attachments
-
- data_input.xlsx
- (9.73 KiB) Downloaded 180 times
Re: Problem is unbounded
When I run this it solves to optimality:
Your numbers are awfully big. Solvers (especially NLP solvers) do not like this. Instead of unit Euro do millions of Euro or something like this. Read about proper scaling of your model here: https://www.gams.com/latest/docs/S_CONO ... PT_SCALING
-Michael
Code: Select all
S O L V E S U M M A R Y
MODEL Refinery OBJECTIVE totalprofit
TYPE LP DIRECTION MAXIMIZE
SOLVER MINOS FROM LINE 121
**** SOLVER STATUS 1 Normal Completion
**** MODEL STATUS 1 Optimal
**** OBJECTIVE VALUE 255000000.0000
RESOURCE USAGE, LIMIT 0.015 1000.000
ITERATION COUNT, LIMIT 2 2000000000
-Michael