Main Page   Class Hierarchy   Compound List   File List   Contact   Download   Symbolic Constraints   Examples  

submodular.h

00001 #ifndef SUBMODULAR_H
00002 #define SUBMODULAR_H
00003 
00004 #include<scil/scil.h>
00005 #include<queue>
00006 
00007 namespace SCIL {
00008 
00009 class submodular : public sym_constraint {
00010 
00011    public:
00012       var v;
00013       var_map<int>& VM;
00014       int n;
00015       solution TS;
00016       double oldval;
00017 
00018    public:
00020       submodular(var& v_, var_map<int>& VM_, int n_)
00021         : v(v_), VM(VM_), n(n_) {
00022         feps = 1.0e-4;
00023       }
00024 
00025       virtual void init(subproblem& S) {
00026         return;
00027       }
00028 
00029       status standard_separation(subproblem& S);
00030 
00031       status feasible(solution& Sol) {
00032         return (Sol.value(v) > value(Sol) - .0001) ? feasible_solution : infeasible_solution;
00033       }
00034 
00035       virtual double value(solution& Sol) = 0;
00036    private:
00038       virtual double value(int p) {
00039         TS.set_value(VM[p], 1.);
00040         return value(TS);
00041       }
00043       virtual double value() {
00044         TS.set_zero();
00045         oldval = 0.;
00046         return 0.;
00047       }
00048 };
00049 
00050 };
00051 #endif
Generated on Mon Mar 28 22:03:50 2011 for SCIL by  doxygen 1.6.3