-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
51 changed files
with
1,670 additions
and
241 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
# ================================================================== | ||
# codac / basics example - cmake configuration file | ||
# ================================================================== | ||
|
||
cmake_minimum_required(VERSION 3.0.2) | ||
project(codac_basics_09 LANGUAGES CXX) | ||
|
||
# Adding IBEX | ||
|
||
# In case you installed IBEX in a local directory, you need | ||
# to specify its path with the CMAKE_PREFIX_PATH option. | ||
# set(CMAKE_PREFIX_PATH "~/ibex-lib/build_install") | ||
|
||
find_package(IBEX REQUIRED) | ||
ibex_init_common() # IBEX should have installed this function | ||
message(STATUS "Found IBEX version ${IBEX_VERSION}") | ||
|
||
# Adding Eigen3 | ||
|
||
# In case you installed Eigen3 in a local directory, you need | ||
# to specify its path with the CMAKE_PREFIX_PATH option, e.g. | ||
# set(CMAKE_PREFIX_PATH "~/eigen/build_install") | ||
|
||
find_package(Eigen3 REQUIRED NO_MODULE) | ||
message(STATUS "Found Eigen3 version ${EIGEN3_VERSION}") | ||
|
||
# Adding Codac | ||
|
||
# In case you installed Codac in a local directory, you need | ||
# to specify its path with the CMAKE_PREFIX_PATH option. | ||
# set(CMAKE_PREFIX_PATH "~/codac/build_install") | ||
|
||
find_package(CODAC REQUIRED) | ||
message(STATUS "Found Codac version ${CODAC_VERSION}") | ||
|
||
# Compilation | ||
|
||
set(CMAKE_BUILD_TYPE Debug) | ||
add_executable(${PROJECT_NAME} main.cpp) | ||
target_compile_options(${PROJECT_NAME} PUBLIC ${CODAC_CXX_FLAGS}) | ||
target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC ${CODAC_INCLUDE_DIRS} ${EIGEN3_INCLUDE_DIRS}) | ||
target_link_libraries(${PROJECT_NAME} PUBLIC ${CODAC_LIBRARIES} Ibex::ibex ${CODAC_LIBRARIES}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# ================================================================== | ||
# tubex-lib - build script | ||
# ================================================================== | ||
|
||
#!/bin/bash | ||
|
||
mkdir build -p | ||
cd build | ||
cmake .. | ||
make | ||
cd .. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/** | ||
* Codac - Examples | ||
* Using CN for paving | ||
* ---------------------------------------------------------------------------- | ||
* | ||
* \brief Using CN for paving | ||
* \date 2021 | ||
* \author Simon Rohou | ||
* \copyright Copyright 2021 Codac Team | ||
* \license This program is distributed under the terms of | ||
* the GNU Lesser General Public License (LGPL). | ||
*/ | ||
|
||
#include <codac.h> | ||
|
||
using namespace std; | ||
using namespace codac; | ||
|
||
class FunctionPaving : public Paving | ||
{ | ||
public: | ||
|
||
FunctionPaving(const IntervalVector& init_box) : Paving(init_box, SetValue::UNKNOWN) | ||
{ | ||
|
||
} | ||
|
||
void compute(ContractorNetwork& cn, IntervalVectorVar& var_x, IntervalVar& var_y, float precision) | ||
{ | ||
assert(precision > 0.); | ||
|
||
Interval y; | ||
// Abstract variables replaced by actual domains | ||
// related to the current paving box | ||
cn.contract({ | ||
{var_x, box()}, | ||
{var_y, y} | ||
}); | ||
|
||
Interval zero(-0.5,0.5); | ||
|
||
if(y.is_subset(zero)) | ||
set_value(SetValue::IN); | ||
|
||
else if(!y.intersects(zero)) | ||
set_value(SetValue::OUT); | ||
|
||
else if(box().max_diam() < precision) | ||
set_value(SetValue::UNKNOWN); | ||
|
||
else | ||
{ | ||
bisect(); | ||
((FunctionPaving*)m_first_subpaving)->compute(cn, var_x, var_y, precision); | ||
((FunctionPaving*)m_second_subpaving)->compute(cn, var_x, var_y, precision); | ||
} | ||
} | ||
}; | ||
|
||
int main() | ||
{ | ||
CtcFunction ctc_f(Function("x[2]", "y", "x[0]*cos(x[0]-x[1])*sin(x[0])+x[1]-y")); | ||
|
||
ContractorNetwork cn; | ||
|
||
// Abstract variables are created, | ||
// they will be replaced afterwards by the values | ||
// corresponding to each box of the paving | ||
IntervalVar y; | ||
IntervalVectorVar x(2); | ||
|
||
// The CN is built only once, outside the Paving class | ||
cn.add(ctc_f, {x, y}); | ||
|
||
FunctionPaving paving(IntervalVector({{-3,3},{-3,3}})); | ||
paving.compute(cn, x, y, 0.05); | ||
|
||
vibes::beginDrawing(); | ||
VIBesFigPaving fig_paving("Paving", &paving); | ||
fig_paving.set_properties(100, 100, 400, 400); | ||
fig_paving.show(); | ||
vibes::endDrawing(); | ||
|
||
return EXIT_SUCCESS; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.