00001 #include<scil/scil.h>
00002
00003 using namespace SCIL;
00004
00005 int main() {
00006
00007 int s=6;
00008
00009 ILP_Problem IP(Optsense_Min);
00010
00011 var x[20];
00012
00013 for(int i=0; i<13; i++) {
00014 x[i]=IP.add_variable(0,0,10,Vartype_Integer);
00015 };
00016
00017 for(int i=13; i<19; i++) {
00018 x[i]=IP.add_variable(0,0,1000000, Vartype_Integer);
00019 };
00020
00021 x[19]=IP.add_variable(-1,0, 1000000, Vartype_Integer);
00022
00023 IP.add_basic_constraint((s+1)*x[0]-x[1] >= s-1);
00024
00025 double d;
00026 for(int i=1; i<19; i++) {
00027 if(i % 2 == 0) d=-1; else d=1;
00028 IP.add_basic_constraint(-s*x[i-1]+(s+1)*x[i]-x[i+1] >= d*(s+1));
00029 };
00030
00031 IP.add_basic_constraint(-s*x[17]-(3*s-1)*x[18]+3*x[19]>=-(5*s-7));
00032
00033
00034
00035 IP.optimize();
00036
00037 for(int i=0; i<20; i++) {
00038 cout<<IP.get_solution(x[i])<<" ";
00039 };
00040 cout<<"Solution\n";
00041
00042 return 0;
00043 };