00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef AAP_VAR_H
00013 #define AAP_VAR_H
00014
00015 #include "BCP_var.hpp"
00016 #include "BCP_buffer.hpp"
00017 #include "AAP.hpp"
00018 #include "CoinHelperFunctions.hpp"
00019
00020 #include <iostream>
00021 #include <vector>
00022 using namespace std;
00023
00024
00025
00026
00027
00028
00029
00030 class AAP_var : public BCP_var_algo{
00031 public:
00032 vector<int> ap;
00033 double cost;
00034
00035 public:
00036 AAP_var() :
00037 BCP_var_algo(BCP_BinaryVar, 0.0, 0.0, 1.0), ap(0), cost(0.0) {}
00038
00039 AAP_var(const vector<int> & ap_, const double cost_) :
00040 BCP_var_algo(BCP_BinaryVar, cost_, 0.0, 1.0), ap(ap_), cost(cost_) {}
00041
00042 AAP_var(const AAP_var & x) :
00043 BCP_var_algo(BCP_BinaryVar, x.cost, 0.0, 1.0), ap(x.ap), cost(x.cost) {}
00044
00045 AAP_var(BCP_buffer & buf)
00046 : BCP_var_algo(BCP_BinaryVar, 0.0, 0.0, 1.0), ap(0), cost(0.0) {
00047
00048
00049 unpack(buf);
00050 set_obj(cost);
00051 }
00052
00053 ~AAP_var() {};
00054
00055 public:
00056 void pack(BCP_buffer & buf) const {
00057
00058 buf.pack(ap).pack(cost);
00059 }
00060
00061 void unpack(BCP_buffer & buf){
00062
00063 buf.unpack(ap).unpack(cost);
00064 }
00065
00066 void print(const int dimension, ostream * os = &cout) const {
00067
00068 (*os) << " AP Cost: " << cost << endl;
00069 for(unsigned int p = 0; p < ap.size(); p++){
00070 (*os) << " index : " << ap[p] << " : ";
00071 ijk_print(ap[p], dimension, os);
00072 (*os) << endl;
00073 }
00074 }
00075
00076 };
00077
00078 #endif