Debian Codegraph @

Bonmin/examples/amplExamples/toy.mod

raw
1 # An Ampl version of toy
2
3 reset;
4
5 var x binary;
6 var z integer >= 0 <= 5;
7 var y{1..2} >=0;
8 minimize cost:
9 - x - y[1] - y[2] ;
10
11 subject to
12 c1: ( y[1] - 1/2 )^2 + (y[2] - 1/2)^2 <= 1/4 ;
13 c2: x - y[1] <= 0 ;
14 c3: x + y[2] + z <= 2;
15
16 option solver bonmin; # Choose BONMIN as the solver (assuming
17 # that bonmin is in your PATH)
18
19 solve; # Solve the model
20 display x;
21 display y;
22