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