Commit cf4d01cb authored by David Speck's avatar David Speck

fixed some minor bugs

parent c333ec8e
Bootstrap: docker
From: ubuntu
From: ubuntu:bionic
%setup
## The "%setup"-part of this script is called to bootstrap an empty
......@@ -23,6 +23,8 @@ From: ubuntu
apt-get update
apt-get -y install cmake g++ make python automake autoconf libtool time gawk flex bison
gcc --version
## Build your planner
cd /planner
./build -j4
......
......@@ -20,7 +20,7 @@ SEARCHDIRS := -I${MYCODEDIR} -I${PARSER}
# makemake variables
DEPENDFLAGS := -g -Wall -Werror ${SEARCHDIRS}
DEPENDFLAGS := -g -Wall ${SEARCHDIRS}
# C preprocessor (C, C++, FORTRAN)
......
......@@ -84,7 +84,7 @@ DEPEND = g++ -MM
CCOPT =
CCOPT += #-m32
CCOPT += -g
CCOPT += -Wall -W -Wno-sign-compare -Wno-deprecated -ansi -pedantic -Werror
CCOPT += -Wall -W -Wno-sign-compare -Wno-deprecated -ansi -pedantic #-Werror
## The following lines contain workarounds for bugs when
## cross-compiling to 64 bit on 32-bit systems using gcc 4.4 or gcc
......
......@@ -524,7 +524,7 @@ void CausalGraph::optimize_ordering_gamer(){
cout << ordering[i]->get_name()<<" - ";
cout << ": " << compute_function(ordering) << endl;
long value_optimization_function = optimize_variable_ordering_gamer(ordering, 50000);
double value_optimization_function = optimize_variable_ordering_gamer(ordering, 50000);
cout << "New value: " << compute_function(ordering) << endl;
......@@ -551,7 +551,7 @@ void CausalGraph::optimize_ordering_gamer(){
}
//cout << "Init value: " << compute_function(new_order) << endl;
long new_value = optimize_variable_ordering_gamer(new_order, 50000);
double new_value = optimize_variable_ordering_gamer(new_order, 50000);
if (new_value < value_optimization_function){
value_optimization_function = new_value;
......@@ -633,8 +633,8 @@ void CausalGraph::optimize_ordering_gamer(){
}*/
long CausalGraph::optimize_variable_ordering_gamer(vector <Variable *> & order, int iterations){
long totalDistance = compute_function(order);
double CausalGraph::optimize_variable_ordering_gamer(vector <Variable *> & order, int iterations){
double totalDistance = compute_function(order);
/*for(int i = 0; i < order.size(); i++){
for(int j = 0; j < order.size(); j++){
......@@ -645,7 +645,7 @@ long CausalGraph::optimize_variable_ordering_gamer(vector <Variable *> & order,
}*/
// cout << "initiale distance: " << totalDistance << endl;
long oldTotalDistance = totalDistance;
double oldTotalDistance = totalDistance;
//Repeat iterations times
for (int counter = 0; counter < iterations; counter++) {
// cout << "Counter: " << counter << endl;
......@@ -690,8 +690,8 @@ long CausalGraph::optimize_variable_ordering_gamer(vector <Variable *> & order,
}
long CausalGraph::compute_function(vector <Variable *> & order){
long totalDistance = 0;
double CausalGraph::compute_function(vector <Variable *> & order){
double totalDistance = 0;
for (int i = 0; i < order.size() - 1; i++) {
for (int j = i+1; j < order.size(); j++) {
if(influence(order[i], order[j])){
......@@ -702,7 +702,7 @@ long CausalGraph::compute_function(vector <Variable *> & order){
return totalDistance;
}
long CausalGraph::influence(Variable * v1, Variable * v2){
double CausalGraph::influence(Variable * v1, Variable * v2){
//long w = 0;
//WeightedSuccessors::iterator res = weighted_graph[v1].find(v2);
//if(res != weighted_graph[v1].end()) w += res->second;
......
......@@ -78,12 +78,12 @@ public:
void swap_scc(vector <Variable * > & result);
//Applies the variable ordering optimization, swaping variables in the same scc.
//long optimize_variable_ordering(vector <Variable *> & order, int iterations);
long optimize_variable_ordering_gamer(vector <Variable *> & order, int iterations);
double optimize_variable_ordering_gamer(vector <Variable *> & order, int iterations);
//Returns the value of the optimization function for a particular ordering
long compute_function(vector <Variable *> & order);
double compute_function(vector <Variable *> & order);
//Returns the influence between two variables.
long influence(Variable * v1, Variable * v2);
double influence(Variable * v1, Variable * v2);
};
......
......@@ -94,9 +94,9 @@ bool inverted) {
vals[2 * var + 1] = val;
}
for (int i = 0; i < op.get_pre_post().size(); i++) {
if (op.get_pre_post()[i].cond.size() > 0) {
/*if (op.get_pre_post()[i].cond.size() > 0) {
continue;
}
}*/
int var = op.get_pre_post()[i].var;
int val = op.get_pre_post()[i].pre;
vals[2 * var + 1] = val;
......
......@@ -2,6 +2,7 @@
// Author: David Speck <speckd>.
#include <algorithm>
#include <functional>
#include "symSearch.h"
#include "../image.h"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment