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

solution.cc

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 void solution::save_solution(subproblem& s) {
00009   var v;
00010   forall_variables(v, s) {
00011     if(s.value(v)!=0) {
00012       S[v]=s.value(v);
00013     }
00014   }
00015 };
00016 
00017 void solution::set_value(var v, double d) {
00018   S[v]=d;
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 
00036 #endif

Generated on Tue Nov 16 15:18:21 2004 for SCIL by doxygen1.2.16