Brand new to AMPL and don't understand the error at all. I've tried removing the variable definitions and get the error (no variables identified) so anyway here is the error message:
syntax error
context: subject to >>> 90 <<< * x1 + 120 * x2 + 106 * x3 + 97 * x4 + 130 * x5 + 180 * x6 >= 300;
here is my code
reset;
var x1 >=0;
var x2 >=1;
var x3 >=0;
var x4 >=0;
var x5 >=.5;
var x6 >=0;
minimize cost: 2 * x1 + 3.5 * x2 + 8 * x3 + 1.5 * x4 + 11 * x5 + x6;
subject to 90 * x1 + 120 * x2 + 106 * x3 + 97 * x4 + 130 * x5 + 180 * x6 >= 300;
subject to 4 * x1 + 8 * x2 + 7 * x3 + 1.3 * x4 + 8 * x5 + 9.2 * x6 >= 10;
subject to 15 * x1 + 11.7 * x2 + .4 * x3 + 22.6 * x4 + 17 * x6 >= 10;
subject to x1 + 5 * x2 + 9 * x3 + 0.1 * x4 + 7 * x5 + 7 * x6 >= 8;
You are experiencing a syntax error because you are not using a valid syntax to declare your constraints. More specifically, your constraints are missing a name and a colon. So, instead of
subject to 90 * x1 + 120 * x2 + 106 * x3 + 97 * x4 + 130 * x5 + 180 * x6 >= 300;
you should write
subject to c1: 90 * x1 + 120 * x2 + 106 * x3 + 97 * x4 + 130 * x5 + 180 * x6 >= 300;
where c1
is whatever name you want to give to that constraint --- just don't use the same name twice.
You can find more info about AMPL's syntax here.