Commit f05e1008 authored by Robert Ricci's avatar Robert Ricci

'port' assign to compile under gcc 3 (specifically tested with 3.3.1).

This mostly required messing with the STL #includes.

Still builds under gcc 2.95, and won't be built with 3.3 by default
until I've spent more time testing it.

One reason for doing this is that gcc 3.3 seems to generate faster
code from templated functions. Tests so far show that the
gcc3-compiled binary shaves 15-30% off of assign's runtime.

The other reason for doing this is forward-looking. When we end up
getting boss running on FreeBSD 5 or a recent Linux distro, the
compiler is likely to be from the gcc 3 branch.
parent ec0d1650
...@@ -9,6 +9,13 @@ MAKEFILE_IN = @srcdir@/GNUmakefile.in ...@@ -9,6 +9,13 @@ MAKEFILE_IN = @srcdir@/GNUmakefile.in
include $(OBJDIR)/Makeconf include $(OBJDIR)/Makeconf
#
# Uncomment these to build with gcc3.3
#
#CC=gcc33
#CPP=cpp33
#CXX=g++33
all: assign all: assign
include $(TESTBED_SRCDIR)/GNUmakerules include $(TESTBED_SRCDIR)/GNUmakerules
......
...@@ -6,6 +6,13 @@ ...@@ -6,6 +6,13 @@
#include "anneal.h" #include "anneal.h"
#include "virtual.h"
#include "maps.h"
#include "common.h"
#include "score.h"
#include "solution.h"
#include "vclass.h"
/* /*
* Internal variables * Internal variables
*/ */
...@@ -51,7 +58,7 @@ inline int accept(double change, double temperature) ...@@ -51,7 +58,7 @@ inline int accept(double change, double temperature)
} else { } else {
p = expf(change/temperature) * 1000; p = expf(change/temperature) * 1000;
} }
r = std::random() % 1000; r = random() % 1000;
if (r < p) { if (r < p) {
return 1; return 1;
} }
...@@ -175,8 +182,8 @@ tb_pnode *find_pnode_connected(vvertex vv, tb_vnode *vn) { ...@@ -175,8 +182,8 @@ tb_pnode *find_pnode_connected(vvertex vv, tb_vnode *vn) {
visit_order[i] = *vedge_it; visit_order[i] = *vedge_it;
} }
for (int i = 0; i < visit_order.size(); i++) { for (int i = 0; i < visit_order.size(); i++) {
int i1 = std::random() % visit_order.size(); int i1 = random() % visit_order.size();
int i2 = std::random() % visit_order.size(); int i2 = random() % visit_order.size();
vedge tmp = visit_order[i1]; vedge tmp = visit_order[i1];
visit_order[i1] = visit_order[i2]; visit_order[i1] = visit_order[i2];
visit_order[i2] = tmp; visit_order[i2] = tmp;
...@@ -234,8 +241,8 @@ tb_pnode *find_pnode(tb_vnode *vn) ...@@ -234,8 +241,8 @@ tb_pnode *find_pnode(tb_vnode *vn)
traversal_order[i] = i; traversal_order[i] = i;
} }
for (int i = 0; i < num_types; i++) { for (int i = 0; i < num_types; i++) {
int i1 = std::random() % num_types; int i1 = random() % num_types;
int i2 = std::random() % num_types; int i2 = random() % num_types;
int tmp = traversal_order[i1]; int tmp = traversal_order[i1];
traversal_order[i1] = traversal_order[i2]; traversal_order[i1] = traversal_order[i2];
traversal_order[i2] = tmp; traversal_order[i2] = tmp;
...@@ -444,7 +451,7 @@ void anneal(bool scoring_selftest, double scale_neighborhood, ...@@ -444,7 +451,7 @@ void anneal(bool scoring_selftest, double scale_neighborhood,
absassignment[*vit] = vn->assignment; absassignment[*vit] = vn->assignment;
abstypes[*vit] = vn->type; abstypes[*vit] = vn->type;
} else { } else {
unassigned_nodes.push(vvertex_int_pair(*vit,std::random())); unassigned_nodes.push(vvertex_int_pair(*vit,random()));
} }
} }
...@@ -578,7 +585,7 @@ void anneal(bool scoring_selftest, double scale_neighborhood, ...@@ -578,7 +585,7 @@ void anneal(bool scoring_selftest, double scale_neighborhood,
assert(!get(vvertex_pmap,vv)->assigned); assert(!get(vvertex_pmap,vv)->assigned);
unassigned_nodes.pop(); unassigned_nodes.pop();
} else { } else {
int start = std::random()%nnodes; int start = random()%nnodes;
int choice = start; int choice = start;
while (get(vvertex_pmap,virtual_nodes[choice])->fixed) { while (get(vvertex_pmap,virtual_nodes[choice])->fixed) {
choice = (choice +1) % nnodes; choice = (choice +1) % nnodes;
...@@ -619,7 +626,7 @@ void anneal(bool scoring_selftest, double scale_neighborhood, ...@@ -619,7 +626,7 @@ void anneal(bool scoring_selftest, double scale_neighborhood,
// Actually find a pnode // Actually find a pnode
tb_pnode *newpnode = NULL; tb_pnode *newpnode = NULL;
if ((use_connected_pnode_find != 0) if ((use_connected_pnode_find != 0)
&& ((std::random() % 1000) < (use_connected_pnode_find * 1000))) { && ((random() % 1000) < (use_connected_pnode_find * 1000))) {
newpnode = find_pnode_connected(vv,vn); newpnode = find_pnode_connected(vv,vn);
} }
if (newpnode == NULL) { if (newpnode == NULL) {
...@@ -634,7 +641,7 @@ void anneal(bool scoring_selftest, double scale_neighborhood, ...@@ -634,7 +641,7 @@ void anneal(bool scoring_selftest, double scale_neighborhood,
if (newpnode == NULL) { if (newpnode == NULL) {
// We're not going to be re-assigning this one // We're not going to be re-assigning this one
#ifndef SMART_UNMAP #ifndef SMART_UNMAP
unassigned_nodes.push(vvertex_int_pair(vv,std::random())); unassigned_nodes.push(vvertex_int_pair(vv,random()));
#endif #endif
// need to free up nodes // need to free up nodes
#ifdef SMART_UNMAP #ifdef SMART_UNMAP
...@@ -649,7 +656,7 @@ void anneal(bool scoring_selftest, double scale_neighborhood, ...@@ -649,7 +656,7 @@ void anneal(bool scoring_selftest, double scale_neighborhood,
pclass_vector *acceptable_types = tt.second; pclass_vector *acceptable_types = tt.second;
// Find a node to kick out // Find a node to kick out
bool foundnode = false; bool foundnode = false;
int offi = std::random(); int offi = random();
int index; int index;
for (int i = 0; i < size; i++) { for (int i = 0; i < size; i++) {
index = (i + offi) % size; index = (i + offi) % size;
...@@ -668,14 +675,14 @@ void anneal(bool scoring_selftest, double scale_neighborhood, ...@@ -668,14 +675,14 @@ void anneal(bool scoring_selftest, double scale_neighborhood,
assert((*acceptable_types)[index]->used_members[vn->type]->size()); assert((*acceptable_types)[index]->used_members[vn->type]->size());
tb_pclass::tb_pnodeset::iterator it = tb_pclass::tb_pnodeset::iterator it =
(*acceptable_types)[index]->used_members[vn->type]->begin(); (*acceptable_types)[index]->used_members[vn->type]->begin();
int j = std::random() % int j = random() %
(*acceptable_types)[index]->used_members[vn->type]->size(); (*acceptable_types)[index]->used_members[vn->type]->size();
while (j > 0) { while (j > 0) {
it++; it++;
j--; j--;
} }
tb_vnode_set::iterator it2 = (*it)->assigned_nodes.begin(); tb_vnode_set::iterator it2 = (*it)->assigned_nodes.begin();
int k = std::random() % (*it)->assigned_nodes.size(); int k = random() % (*it)->assigned_nodes.size();
while (k > 0) { while (k > 0) {
it2++; it2++;
k--; k--;
...@@ -686,13 +693,13 @@ void anneal(bool scoring_selftest, double scale_neighborhood, ...@@ -686,13 +693,13 @@ void anneal(bool scoring_selftest, double scale_neighborhood,
newpnode = *it; newpnode = *it;
remove_node(toremove); remove_node(toremove);
unassigned_nodes.push(vvertex_int_pair(toremove, unassigned_nodes.push(vvertex_int_pair(toremove,
std::random())); random()));
} else { } else {
cerr << "Failed to find a replacement!" << endl; cerr << "Failed to find a replacement!" << endl;
} }
#else #else
int start = std::random()%nnodes; int start = random()%nnodes;
int toremove = start; int toremove = start;
#ifdef SMART_UNMAP #ifdef SMART_UNMAP
...@@ -741,7 +748,7 @@ void anneal(bool scoring_selftest, double scale_neighborhood, ...@@ -741,7 +748,7 @@ void anneal(bool scoring_selftest, double scale_neighborhood,
RDEBUG(cout << "removing: freeing up nodes" << endl;) RDEBUG(cout << "removing: freeing up nodes" << endl;)
remove_node(virtual_nodes[toremove]); remove_node(virtual_nodes[toremove]);
unassigned_nodes.push(vvertex_int_pair(virtual_nodes[toremove], unassigned_nodes.push(vvertex_int_pair(virtual_nodes[toremove],
std::random())); random()));
} }
continue; continue;
#endif /* SMART_UNMAP */ #endif /* SMART_UNMAP */
...@@ -779,12 +786,12 @@ void anneal(bool scoring_selftest, double scale_neighborhood, ...@@ -779,12 +786,12 @@ void anneal(bool scoring_selftest, double scale_neighborhood,
} }
} }
if (add_node(vv,newpos,false,false) != 0) { if (add_node(vv,newpos,false,false) != 0) {
unassigned_nodes.push(vvertex_int_pair(vv,std::random())); unassigned_nodes.push(vvertex_int_pair(vv,random()));
continue; continue;
} }
} else { } else {
#ifdef SMART_UNMAP #ifdef SMART_UNMAP
unassigned_nodes.push(vvertex_int_pair(vv,std::random())); unassigned_nodes.push(vvertex_int_pair(vv,random()));
#endif #endif
if (freednode) { if (freednode) {
continue; continue;
......
...@@ -16,21 +16,27 @@ ...@@ -16,21 +16,27 @@
#include <boost/graph/adjacency_list.hpp> #include <boost/graph/adjacency_list.hpp>
using namespace boost; using namespace boost;
#include <rope>
#include <queue>
#include <iostream> #include <iostream>
using namespace std;
/*
* We have to do these includes differently depending on which version of gcc
* we're compiling with
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#include <ext/hash_map>
#include <ext/slist>
using namespace __gnu_cxx;
#else
#include <hash_map>
#include <slist>
#endif
#include <math.h> #include <math.h>
#include "common.h"
#include "delay.h" #include "delay.h"
#include "physical.h" #include "physical.h"
#include "virtual.h"
#include "vclass.h"
#include "maps.h"
#include "score.h"
#include "pclass.h" #include "pclass.h"
#include "solution.h"
// Some defaults for #defines // Some defaults for #defines
#ifndef NO_REVERT #ifndef NO_REVERT
...@@ -76,4 +82,7 @@ tb_pnode *find_pnode(tb_vnode *vn); ...@@ -76,4 +82,7 @@ tb_pnode *find_pnode(tb_vnode *vn);
void anneal(bool scoring_selftest, double scale_neighborhood, void anneal(bool scoring_selftest, double scale_neighborhood,
double *initial_temperature, double use_connected_pnode_find); double *initial_temperature, double use_connected_pnode_find);
typedef hash_map<crope,crope> name_name_map;
typedef slist<crope> name_slist;
#endif #endif
...@@ -6,10 +6,6 @@ ...@@ -6,10 +6,6 @@
#include "port.h" #include "port.h"
#include <hash_map>
#include <rope>
#include <queue>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/property_map.hpp> #include <boost/property_map.hpp>
...@@ -28,6 +24,7 @@ ...@@ -28,6 +24,7 @@
#include <sys/resource.h> #include <sys/resource.h>
#include <signal.h> #include <signal.h>
#include <sys/signal.h> #include <sys/signal.h>
#include <queue>
using namespace boost; using namespace boost;
...@@ -775,7 +772,7 @@ int main(int argc,char **argv) ...@@ -775,7 +772,7 @@ int main(int argc,char **argv)
#endif #endif
cout << "seed = " << seed << endl; cout << "seed = " << seed << endl;
std::srandom(seed); srandom(seed);
read_physical_topology(argv[0]); read_physical_topology(argv[0]);
calculate_switch_MST(); calculate_switch_MST();
......
...@@ -7,8 +7,21 @@ ...@@ -7,8 +7,21 @@
#ifndef __COMON_H #ifndef __COMON_H
#define __COMON_H #define __COMON_H
/*
* We have to do these includes differently depending on which version of gcc
* we're compiling with
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#include <ext/hash_map>
using namespace __gnu_cxx;
#else
#include <hash_map>
#endif
#include "config.h" #include "config.h"
#include <boost/graph/adjacency_list.hpp>
/* /*
* Exit vaules from assign * Exit vaules from assign
*/ */
...@@ -170,9 +183,6 @@ namespace boost { ...@@ -170,9 +183,6 @@ namespace boost {
BOOST_INSTALL_PROPERTY(vertex,data); BOOST_INSTALL_PROPERTY(vertex,data);
} }
typedef hash_map<crope,crope> name_name_map;
typedef slist<crope> name_slist;
/* /*
* Used to count the number of nodes in each ptype and vtype * Used to count the number of nodes in each ptype and vtype
*/ */
...@@ -197,4 +207,14 @@ template <class T> struct hashptr { ...@@ -197,4 +207,14 @@ template <class T> struct hashptr {
#define RDEBUG(a) #define RDEBUG(a)
#endif #endif
/*
* Needed for the transition from gcc 2.95 to 3.x - the new gcc puts some
* non-standard (ie. SGI) STL extensions in different place
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#define HASH_MAP <ext/hash_map>
#else
#define HASH_MAP
#endif
#endif #endif
...@@ -7,8 +7,11 @@ ...@@ -7,8 +7,11 @@
#ifndef __DELAY_H #ifndef __DELAY_H
#define __DELAY_H #define __DELAY_H
class tb_pnode; // For DBL_MAX
#include <float.h>
#include <iostream>
using namespace std;
template <class T> inline double basic_distance(T a,T b) { template <class T> inline double basic_distance(T a,T b) {
if (b == 0) { if (b == 0) {
...@@ -68,5 +71,5 @@ public: ...@@ -68,5 +71,5 @@ public:
} }
}; };
#endif __DELAY_H #endif
...@@ -6,24 +6,12 @@ ...@@ -6,24 +6,12 @@
#include "port.h" #include "port.h"
#include <hash_map>
#include <slist>
#include <rope>
#include <hash_set>
#include <boost/config.hpp>
#include <boost/utility.hpp>
#include <boost/property_map.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp> #include <boost/graph/adjacency_list.hpp>
#include <iostream.h> #include <iostream.h>
using namespace boost; using namespace boost;
using namespace boost;
#include "common.h"
#include "delay.h" #include "delay.h"
#include "physical.h" #include "physical.h"
#include "parser.h" #include "parser.h"
......
...@@ -6,11 +6,6 @@ ...@@ -6,11 +6,6 @@
#include "port.h" #include "port.h"
#include <hash_map>
#include <slist>
#include <queue>
#include <rope>
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/property_map.hpp> #include <boost/property_map.hpp>
...@@ -27,6 +22,7 @@ using namespace boost; ...@@ -27,6 +22,7 @@ using namespace boost;
#include "physical.h" #include "physical.h"
#include "virtual.h" #include "virtual.h"
#include "parser.h" #include "parser.h"
#include "anneal.h"
extern name_vvertex_map vname2vertex; extern name_vvertex_map vname2vertex;
extern name_name_map fixed_nodes; extern name_name_map fixed_nodes;
......
...@@ -4,14 +4,10 @@ ...@@ -4,14 +4,10 @@
* All rights reserved. * All rights reserved.
*/ */
#include <vector>
#include <rope>
#include <algo.h>
#include <iostream.h>
#include "parser.h" #include "parser.h"
#include <iostream>
#ifdef DEBUG_PARSER #ifdef DEBUG_PARSER
#define DEBUG(x) x #define DEBUG(x) x
#else #else
......
...@@ -7,11 +7,15 @@ ...@@ -7,11 +7,15 @@
#ifndef __PARSER_H #ifndef __PARSER_H
#define __PARSER_H #define __PARSER_H
#include "port.h"
#include <vector>
using namespace std;
typedef vector<crope> string_vector; typedef vector<crope> string_vector;
int split_two(crope line,char split_char,crope &a,crope &b); int split_two(crope line,char split_char,crope &a,crope &b);
int split_two(crope line,char split_char,crope &a,crope &b,crope default_b); int split_two(crope line,char split_char,crope &a,crope &b,crope default_b);
string_vector split_line(crope line,char split_char); string_vector split_line(crope line,char split_char);
#endif #endif
...@@ -8,12 +8,21 @@ ...@@ -8,12 +8,21 @@
#include <stdlib.h> #include <stdlib.h>
#include <hash_map>
#include <rope>
#include <queue> #include <queue>
#include <list> #include <list>
#include <algorithm> #include <algorithm>
/*
* We have to do these includes differently depending on which version of gcc
* we're compiling with
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#include <ext/hash_map>
using namespace __gnu_cxx;
#else
#include <hash_map>
#endif
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/utility.hpp> #include <boost/utility.hpp>
#include <boost/property_map.hpp> #include <boost/property_map.hpp>
......
...@@ -8,7 +8,30 @@ ...@@ -8,7 +8,30 @@
#define __PHYSICAL_H #define __PHYSICAL_H
#include "common.h" #include "common.h"
#include <set> #include <set>
#include <list>
using namespace std;
#include <boost/config.hpp>
#include <boost/utility.hpp>
#include <boost/property_map.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
using namespace boost;
/*
* We have to do these includes differently depending on which version of gcc
* we're compiling with
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#include <ext/hash_set>
#include <ext/hash_map>
using namespace __gnu_cxx;
#else
#include <hash_set>
#include <hash_map>
#endif
// Icky, but I can't include virtual.h here // Icky, but I can't include virtual.h here
class tb_vnode; class tb_vnode;
......
...@@ -5,8 +5,24 @@ ...@@ -5,8 +5,24 @@
*/ */
// This file may need to be changed depending on the architecture. // This file may need to be changed depending on the architecture.
#ifndef __PORT_H
#include <limits.h> #include <limits.h>
#define WCHAR_MIN INT_MIN #define WCHAR_MIN INT_MIN
#define WCHAR_MAX INT_MAX #define WCHAR_MAX INT_MAX
/*
* We have to do these includes differently depending on which version of gcc
* we're compiling with
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#include <ext/rope>
using namespace __gnu_cxx;
#else
#include <rope>
#endif
#else
#define PORT_H
#endif
...@@ -10,11 +10,18 @@ ...@@ -10,11 +10,18 @@
#include <iostream.h> #include <iostream.h>
#include <float.h> #include <float.h>
/*
* We have to do these includes differently depending on which version of gcc
* we're compiling with
*/
#if __GNUC__ == 3 && __GNUC_MINOR__ > 0
#include <ext/hash_map>
#include <ext/hash_set>
using namespace __gnu_cxx;
#else
#include <hash_map> #include <hash_map>
#include <rope>
#include <queue>
#include <slist>
#include <hash_set> #include <hash_set>
#endif
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/utility.hpp> #include <boost/utility.hpp>
...@@ -302,8 +309,10 @@ void unscore_link_info(vedge ve,tb_pnode *src_pnode,tb_pnode *dst_pnode, tb_vnod ...@@ -302,8 +309,10 @@ void unscore_link_info(vedge ve,tb_pnode *src_pnode,tb_pnode *dst_pnode, tb_vnod
if (old_over_bw) { if (old_over_bw) {
// Count how many multiples of the maximum bandwidth we're at // Count how many multiples of the maximum bandwidth we're at
int num_violations = (int)(floor((old_bw -1)/src_pnode->trivial_bw) int num_violations = (int)(
- floor((src_pnode->trivial_bw_used -1) / src_pnode->trivial_bw)); floor((double)(old_bw -1)/src_pnode->trivial_bw)
- floor((double)(src_pnode->trivial_bw_used -1) /
src_pnode->trivial_bw));
violated -= num_violations; violated -= num_violations;
vinfo.bandwidth -= num_violations; vinfo.bandwidth -= num_violations;
double removed_bandwidth_percent = (old_over_bw - new_over_bw) * 1.0 / double removed_bandwidth_percent = (old_over_bw - new_over_bw) * 1.0 /
...@@ -622,8 +631,9 @@ void score_link_info(vedge ve, tb_pnode *src_pnode, tb_pnode *dst_pnode, tb_vnod ...@@ -622,8 +631,9 @@ void score_link_info(vedge ve, tb_pnode *src_pnode, tb_pnode *dst_pnode, tb_vnod
if (new_over_bw) { if (new_over_bw) {
// Count how many multiples of the maximum bandwidth we're at // Count how many multiples of the maximum bandwidth we're at
int num_violations = int num_violations =
(int)(floor((src_pnode->trivial_bw_used -1) / src_pnode->trivial_bw) (int)(floor((double)((src_pnode->trivial_bw_used -1)
- floor((old_bw -1)/src_pnode->trivial_bw)); / src_pnode->trivial_bw))
- floor((double)((old_bw -1)/src_pnode->trivial_bw)));
violated += num_violations; violated += num_violations;
vinfo.bandwidth += num_violations; vinfo.bandwidth += num_violations;
...@@ -1057,7 +1067,7 @@ int add_node(vvertex vv,pvertex pv, bool deterministic, bool is_fixed) ...@@ -1057,7 +1067,7 @@ int add_node(vvertex vv,pvertex pv, bool deterministic, bool is_fixed)
int index; int index;
if (!deterministic && !greedy_link_assignment) { if (!deterministic && !greedy_link_assignment) {
float choice; float choice;
choice = std::random()%(int)total_weight; choice = random()%(int)total_weight;
for (index = 0;index < resolution_index;++index) { for (index = 0;index < resolution_index;++index) {
switch (resolutions[index].type_used) { switch (resolutions[index].type_used) {
case tb_link_info::LINK_DIRECT: case tb_link_info::LINK_DIRECT:
...@@ -1405,8 +1415,8 @@ void score_link(pedge pe,vedge ve,tb_pnode *src_pnode, tb_pnode *dst_pnode) ...@@ -1405,8 +1415,8 @@ void score_link(pedge pe,vedge ve,tb_pnode *src_pnode, tb_pnode *dst_pnode)
if (new_over_bw) { if (new_over_bw) {
// Count how many multiples of the maximum bandwidth we're at // Count how many multiples of the maximum bandwidth we're at
int num_violations = int num_violations =
(int)(floor((plink->bw_used -1) / plink->delay_info.bandwidth) (int)(floor((double)((plink->bw_used -1) / plink->delay_info.bandwidth))
- floor((old_bw -1)/plink->delay_info.bandwidth)); - floor((double)((old_bw -1)/plink->delay_info.bandwidth)));
violated += num_violations; violated += num_violations;
vinfo.bandwidth += num_violations; vinfo.bandwidth += num_violations;
...@@ -1553,8 +1563,9 @@ void unscore_link(pedge pe,vedge ve, tb_pnode *src_pnode, tb_pnode *dst_pnode) ...@@ -1553,8 +1563,9 @@ void unscore_link(pedge pe,vedge ve, tb_pnode *src_pnode, tb_pnode *dst_pnode)
if (old_over_bw) { if (old_over_bw) {
// Count how many multiples of the maximum bandwidth we're at // Count how many multiples of the maximum bandwidth we're at
int num_violations = (int)(floor((old_bw -1)/plink->delay_info.bandwidth) int num_violations = (int)
- floor((plink->bw_used -1) / plink->delay_info.bandwidth)); (floor((double)((old_bw -1)/plink->delay_info.bandwidth))
- floor((double)((plink->bw_used -1) / plink->delay_info.bandwidth)));
violated -= num_violations; violated -= num_violations;
vinfo.bandwidth -= num_violations; vinfo.bandwidth -= num_violations;
double removed_bandwidth_percent = (old_over_bw - new_over_bw) * 1.0 / double removed_bandwidth_percent = (old_over_bw - new_over_bw) * 1.0 /
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
*/ */
#include "solution.h" #include "solution.h"
#include "vclass.h"
bool compare_scores(double score1, double score2) { bool compare_scores(double score1, double score2) {
if ((score1 < (score2 + ITTY_BITTY)) && (score1 > (score2 - ITTY_BITTY))) { if ((score1 < (score2 + ITTY_BITTY)) && (score1 > (score2 - ITTY_BITTY))) {
......
...@@ -14,17 +14,9 @@ ...@@ -14,17 +14,9 @@
#include "port.h" #include "port.h"