Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rational priced DBM #30

Open
wants to merge 33 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0d1488b
A few fixes
Slorup Oct 21, 2022
f032519
small
Slorup Oct 21, 2022
7fcc5ae
Few more fixes
Slorup Oct 21, 2022
e5aa83d
Messy const_iterator - probably doesn't work, just to avoid errors fo…
Slorup Oct 28, 2022
7b6d358
Hack for iterator errors and added lots of 'not implemented' functions
Slorup Oct 31, 2022
d81529d
Fixed linker errors - It now compiles with latest UPPAAL!
Slorup Nov 1, 2022
3474345
Fixed iterators
Ragusaen Nov 4, 2022
6ed33e4
Fixed gigantic delay bug
Ragusaen Nov 4, 2022
ce9dda7
???
Ragusaen Nov 29, 2022
0f6fbb2
Added pfed equals operator and resize function
Slorup Mar 13, 2023
e6175a6
Changed cost of priced zone functions to be int instead of uint
Slorup Mar 13, 2023
2eabfd0
Add strict/nonstrict cost comparison function to priced
Slorup Mar 14, 2023
d3d28d4
Changed priced DBMs to support doubles for cost, rate and cache. Need…
Slorup Mar 14, 2023
c269e6f
fixed some bugs with negative costs
Ragusaen Mar 15, 2023
1824e12
add offsetcost function
Ragusaen Mar 15, 2023
540096e
Fixed bugs with double changes
Slorup Mar 15, 2023
cc597c7
Merge branch 'price_testing' into float_price
Slorup Mar 15, 2023
382842a
smol
Slorup Mar 15, 2023
d66ca6b
bug fixes
Ragusaen Mar 17, 2023
6b72e92
changed double cost to rational cost type
Ragusaen Mar 24, 2023
009a1e1
fixed bug with inifinity in CostType
Ragusaen Mar 24, 2023
5821a64
setUniformCost
Ragusaen Mar 27, 2023
bd684d2
smoll
Ragusaen Mar 31, 2023
0907e93
something
Ragusaen Apr 11, 2023
2bfb353
the pdbm now remembers the cost-plane operations that have been appli…
Ragusaen Apr 28, 2023
3bfcb1c
Allow changes to cost plane of pdbm
Ragusaen May 9, 2023
c423c16
fixed some memory leaks
Ragusaen May 11, 2023
12a544d
Removed optimization when delaying with rate 0, as we need to know wh…
Ragusaen May 12, 2023
ba05195
Also remember cost plane operations when constraining to facets for u…
Ragusaen May 17, 2023
0c0dff2
Fixed bugs with cost-plane operations
Ragusaen May 18, 2023
3a445c9
small
Slorup May 23, 2023
98b5ec1
added doctest and some pfed tests
Ragusaen Sep 28, 2023
16eee00
Added a test for setUniformCost
Ragusaen Sep 29, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ include(GNUInstallDirs)
option(TESTING OFF)
option(STATIC OFF)

set(CMAKE_BUILD_TYPE Debug)

cmake_policy(SET CMP0048 NEW) # project() command manages VERSION variables
set(CMAKE_CXX_STANDARD 17)
set(UDBM_PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
Expand All @@ -14,17 +16,25 @@ set(ENABLE_STORE_MINGRAPH 1)
CONFIGURE_FILE("src/config.h.cmake" "include/dbm/config.h")

set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};${CMAKE_CURRENT_SOURCE_DIR}/libs")
find_package(doctest 2.4.11 REQUIRED)
find_package(xxHash 0.8.0 CONFIG REQUIRED)
find_package(UUtils 1.1.1 REQUIRED COMPONENTS base hash debug)

add_library(UDBM src/DBMAllocator.cpp src/dbm.c src/fed_dbm.cpp src/mingraph.c src/mingraph_read.c src/partition.cpp src/print.cpp src/gen.c src/mingraph_cache.cpp src/mingraph_relation.c src/pfed.cpp src/fed.cpp src/infimum.cpp src/mingraph_equal.c src/mingraph_write.c src/priced.cpp)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/libs)

add_library(UDBM src/DBMAllocator.cpp src/dbm.c src/fed_dbm.cpp src/mingraph.c src/mingraph_read.c src/partition.cpp src/print.cpp src/gen.c src/mingraph_cache.cpp src/mingraph_relation.c src/pfed.cpp src/fed.cpp src/infimum.cpp src/mingraph_equal.c src/mingraph_write.c src/priced.cpp src/cost_type.cpp)
target_link_libraries(UDBM UUtils::base UUtils::udebug UUtils::hash)

if(STATIC)
set(CMAKE_CXX_STANDARD_LIBRARIES "-static-libgcc -static-libstdc++ -lwsock32 -lws2_32 ${CMAKE_CXX_STANDARD_LIBRARIES}")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Bstatic,--whole-archive -lwinpthread -Wl,--no-whole-archive")
endif(STATIC)


set(CMAKE_BUILD_TYPE Release)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")


target_include_directories(UDBM
PRIVATE
# where the library itself will look for its internal headers
Expand Down
17 changes: 17 additions & 0 deletions getlibs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,20 @@ cd build
cmake $CMAKE_ARGS -DCMAKE_INSTALL_PREFIX="$SOURCE_DIR/libs/UUtils" ..
cmake --build . --config Release
cmake --install . --config Release

cd $SOURCE_DIR/libs/sources;
wget -nc https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.gz
tar -xvf boost_1_81_0.tar.gz
mkdir -p "$SOURCE_DIR/libs/sources/boost_1_81_0/build"
cd "$SOURCE_DIR/libs/sources/boost_1_81_0/build"
cp -r "$SOURCE_DIR/libs/sources/boost_1_81_0/boost" "$SOURCE_DIR/libs/"

cd $SOURCE_DIR/libs/sources;
wget https://github.com/doctest/doctest/archive/refs/tags/v2.4.11.tar.gz
tar -xvf v2.4.11.tar.gz
mkdir -p "$SOURCE_DIR/libs/sources/doctest-2.4.11/build"
cd "$SOURCE_DIR/libs/sources/doctest-2.4.11"
cd build
cmake $CMAKE_ARGS -DOCTEST_WITH_TESTS=OFF -DDOCTEST_WITH_MAIN_IN_STATIC_LIB=ON -DDOCTEST_USE_STD_HEADERS=ON -DCMAKE_INSTALL_PREFIX="$SOURCE_DIR/libs" ..
cmake --build . --config Release
cmake --install . --config Release
18 changes: 18 additions & 0 deletions include/dbm/cost_type.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
//
// Created by ragusa on 3/17/23.
//

#ifndef UDBM_COST_TYPE_H
#define UDBM_COST_TYPE_H

#include <boost/rational.hpp>

/**
* The type used to represent cost in the pdbm
*/
typedef boost::rational<int> CostType;
const CostType INFINITE_COST = (CostType)INT_MAX;

uint32_t hash_cost_type(const CostType& val);

#endif // UDBM_COST_TYPE_H
3 changes: 3 additions & 0 deletions include/dbm/fed.h
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,9 @@ namespace dbm
fed_t& unionWith(fed_t& arg);
fed_t& unionWithC(fed_t arg); // dummy wrapper

// Performs unionWith operation and returns whether the fed changed
bool unionWithChanged(const fed_t& arg);

/// Simply add (list concatenation) DBMs to this federation.
/// @pre same dimension.

Expand Down
6 changes: 6 additions & 0 deletions include/dbm/inline_fed.h
Original file line number Diff line number Diff line change
Expand Up @@ -512,6 +512,12 @@ namespace dbm
return *this;
}

bool unionWithChanged(dbmlist_t& arg) {
removeIncluded(arg);
append(arg);
return arg.size() > 0;
}

/// Simple reduction by inclusion check of DBMs.
void reduce(cindex_t dim);

Expand Down
1 change: 1 addition & 0 deletions include/dbm/partition.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#define INCLUDE_DBM_PARTITION_H

#include "dbm/fed.h"
#include "dbm/pfed.h"
#include "base/intutils.h"

/**
Expand Down
Loading