00001 #include<scil/scil.h>
00002 #include<scil/core/boolfunction.h>
00003
00004 using namespace SCIL;
00005 using namespace std;
00006
00007 int main (int argc, char** argv)
00008 {
00009
00010 ILP_Problem IP(Optsense_Max);
00011
00012 var x0 = IP.add_binary_variable(0.);
00013 var x1 = IP.add_binary_variable(2.);
00014 var x2 = IP.add_binary_variable(0.);
00015 var x3 = IP.add_binary_variable(0.);
00016 var x4 = IP.add_binary_variable(1.);
00017
00018
00019 boolfunction* bf1 = new boolfunction(x0, true);
00020 boolfunction* bf2 = new boolfunction(x1, x2, OR, true);
00021 boolfunction* bf3 = new boolfunction(x3, x4, XOR);
00022 boolfunction* bf4 = new boolfunction(x0, x3, IMP);
00023 boolfunction* bf5 = new boolfunction(x0, x4, IMP);
00024
00025
00026 bf1->add(IMP, bf2);
00027 bf2->add(AND, bf3);
00028
00029 cout<<"bf1: "<<bf1<<endl;
00030 cout<<"bf2: "<<bf2<<endl;
00031 cout<<"bf3: "<<bf3<<endl;
00032 cout<<"bf4: "<<bf4<<endl;
00033 cout<<"bf5: "<<bf5<<endl;
00034
00035
00036 IP.add_boolfunction(bf1, 1.);
00037 IP.add_boolfunction(bf2, 10.);
00038
00039
00040 cout<<"bf1 (simplified): "<<bf1<<endl;
00041 cout<<"bf2 (simplified): "<<bf2<<endl;
00042
00043
00044 list<boolfunction*> cl;
00045 cl.push_back(bf4);
00046 cl.push_back(bf5);
00047 IP.add_bool_constraint(cl, C1);
00048
00049
00050 IP.optimize();
00051
00052
00053 delete bf3;
00054 }
00055
00056