00001 #ifndef SCIL_SOLUTION_CC
00002 #define SCIL_SOLUTION_CC
00003
00004 #include<scil/solution.h>
00005 #include<scil/subproblem.h>
00006 #include<scil/variable.h>
00007
00008 using namespace SCIL;
00009
00010 void solution::save_solution(subproblem& s) {
00011 var v;
00012 sp=&s;
00013 forall_variables(v, s) {
00014 if(s.value(v)!=0) {
00015 S[v]=s.value(v);
00016 }
00017 }
00018 };
00019
00020 subproblem* solution::originating_subproblem() {
00021 return sp;
00022 };
00023
00024 void solution::round_to_integer(var v) {
00025 S[v]=floor(S[v]+0.5);
00026 };
00027
00028 double solution::value(var v) {
00029 return S[v];
00030 };
00031
00032 double solution::value(row& r) {
00033 row_entry re;
00034 double d=0;
00035 forall(re, r) d+=re.coeff*value(re.Var);
00036 return d;
00037 };
00038
00039 #endif