No variables declared

define the variables

var wrenches >=0; #number of wrenches to produce

var pliers >=0;

objective function

maximize earnings: 0.13 * wrenches + 0.10 * pliers;


subject to steel: 1.5 * wrenches + 1.0 * pliers;

subject to molding: 1 * wrenches + 1 * pliers;

subject to assembly: 0.3 * wrenches + 0.5 * pliers;

subject to demand1: wrencehs <=15000;

subject to demand2: pliers <=16000;

subject to nonneg1: wrenches>=0;

subject to nonneg2: pliers>=0;

The above is my input

I tried this

ampl? model gtc.mod;

ampl: solve;

No variables declared.


ANd I get no variables declared

I see

ampl? model gtc.mod;

The ampl? prompt means that a command had already been started on a previous line, so something had already gone wrong.

To say exactly what went wrong, it would be necessary to see a transcript or screenshot of your whole AMPL session, and also an upload of the file gtc.mod. However, just looking at what you show here, I can see that your variable is misspelled in constraint demand1. Also your constraints steel, molding, and assembly need to have a relational operator (>= or <= or =) in them.