I've faced a problem with AMPL. I'm using 32-bit version of Linux OS. I'm trying to solve a simple linear programmin problem but I can't understand what is wrong... Here is model, data files and session script as well. The answer to command "solve" is: Cannot find "minos". But the solver is currently in my folder! Changing the solvers doesn't help. Any suggestions?
Model of the problem:
param n;
param t;
param p{i in 1..n};
param r{i in 1..n};
param m{i in 1..n};
#Declaration of variables
var x {i in 1..n} >=0;
#Objective Function
maximize revenues: sum {i in 1..n} p[i]*x[i] ;
#Constraints
subject to Aval_Time: sum{i in 1..n} x[i]/r[i]<=t;
subject to Max_Flavor {i in 1..n}: x[i]<=m[i];
Data of the problem:
param n := 4;# No of Flavors
param t := 40; # Total labor hour in a week
param p := 1 1 2 1.5 3 1 4 1.5; # Revenue per package flavor i
param r := 1 40 2 30 3 50 4 20; # Production rate of package flavor i
param m := 1 1000 2 900 3 500 4 800; # Maximum demand package flavor i
AMPL session:
reset;
model example2.mod;
data example2.dat;
solve;
display x;
Answer of the system:
Cannot find "minos"
The error message is trying to tell you that the solver is missing. AMPL doesn't solve your problem, it just transforms your model into a form suitable for the solver, passes that to the solver and the actual solution is done by the solver. That is about the error message.
You need a solver to resolve this issue. Download and the extract the minos solver. Make it exectuable: In the Bash shell (not the AMPL shell) issue the following:
chmod +x minos
You also have tell AMPL where the solver is before you issue the solve;
command. Before the solve command, issue this either in the AMPL shell or in your model file:
option solver "/path/to/minos";
where you change /path/to/minos
according to your installation.
That's all.
On Unix and Unix-like operating systems such as Linux, the current directory is usually not on the search path. You have the following options:
option solver './minos';
before the solve
command.PATH
environment variable.minos
to some directory on the search path such as /usr/local/bin
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With