[AMPL 18405] syntax error - Ampl

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

[AMPL 18405] syntax error - Ampl

mihir.mehta2017
# define variables
var x1 >= 0;
var x2 >= 0;
var x3 >= 0;
var x4 >= 0;
var y1 binary;
var y2 binary;
var y3 binary;
var y4 binary;

#objective function
minimize cost: 2500*x1+10000*y1 + 2450*x2 +20000*y2 +2510*x3 + 0*y3 + 2470*x4 + 13000*y4;

#constraints
subject to c1: x1 <= 1000*y1
subject to c2: x2 <= 1200*y2
subject to c3: x3 <= 2510*y3
subject to c4: x4 <= 1100*y4
subject to c5: x1 + x2 +x 3 + x4 = 2000

The error is get is: 
syntax error
context:   >>> subject  <<< to c2: x2 <= 1200*y2

please help?

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: [AMPL 18406] syntax error - Ampl

Juan Diego PLAZA CANO
Hello. 
In my opinion you have to put ; at the end of the line, like this
#constraints
subject to c1: x1 <= 1000*y1;
subject to c2: x2 <= 1200*y2;
subject to c3: x3 <= 2510*y3;
subject to c4: x4 <= 1100*y4;
subject to c5: x1 + x2 +x 3 + x4 = 2000;



El 18 mar. 2019 2:11 PM, <[hidden email]> escribió:
# define variables
var x1 >= 0;
var x2 >= 0;
var x3 >= 0;
var x4 >= 0;
var y1 binary;
var y2 binary;
var y3 binary;
var y4 binary;

#objective function
minimize cost: 2500*x1+10000*y1 + 2450*x2 +20000*y2 +2510*x3 + 0*y3 + 2470*x4 + 13000*y4;

#constraints
subject to c1: x1 <= 1000*y1
subject to c2: x2 <= 1200*y2
subject to c3: x3 <= 2510*y3
subject to c4: x4 <= 1100*y4
subject to c5: x1 + x2 +x 3 + x4 = 2000

The error is get is: 
syntax error
context:   >>> subject  <<< to c2: x2 <= 1200*y2

please help?

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[AMPL 18406] Re: syntax error - Ampl

Juan Diego PLAZA CANO
In reply to this post by mihir.mehta2017

in my opinion you have to write ; at the end of each line, like this

#constraints
subject to c1: x1 <= 1000*y1;
subject to c2: x2 <= 1200*y2;
subject to c3: x3 <= 2510*y3;
subject to c4: x4 <= 1100*y4;
subject to c5: x1 + x2 +x 3 + x4 = 2000;


--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

[AMPL 18407] Re: syntax error - Ampl

mihir.mehta2017
Thank you, it worked.

On Tuesday, March 19, 2019 at 12:49:16 AM UTC+5:30, [hidden email] wrote:

in my opinion you have to write ; at the end of each line, like this

#constraints
subject to c1: x1 <= 1000*y1;
subject to c2: x2 <= 1200*y2;
subject to c3: x3 <= 2510*y3;
subject to c4: x4 <= 1100*y4;
subject to c5: x1 + x2 +x 3 + x4 = 2000;


--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.