mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-26 22:57:00 +02:00
Merge pull request #51 from Mixaill/fuzzylite-fix-3
Fix fuzzylite compilation, again
This commit is contained in:
commit
3e724bc564
@ -1,21 +1,18 @@
|
||||
project(AI)
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
find_path(FUZZYLITE_INCLUDE_PATH NAMES fl/fuzzylite.h)
|
||||
find_library(FUZZYLITE_LIB NAMES fuzzylite PATH_SUFFIXES dynamic)
|
||||
mark_as_advanced(FUZZYLITE_INCLUDE_PATH FUZZYLITE_LIB)
|
||||
find_package(Fuzzylite)
|
||||
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FUZZYLITE FUZZYLITE_INCLUDE_PATH FUZZYLITE_LIB)
|
||||
if (FUZZYLITE_FOUND)
|
||||
set (FUZZYLITE_LIBRARIES ${FUZZYLITE_LIB})
|
||||
set (FUZZYLITE_INCLUDE_DIR ${FUZZYLITE_INCLUDE_PATH})
|
||||
endif()
|
||||
|
||||
if (NOT FUZZYLITE_FOUND)
|
||||
if (NOT FL_FOUND)
|
||||
set(FL_BUILD_BINARY OFF CACHE BOOL "")
|
||||
set(FL_BUILD_SHARED OFF CACHE BOOL "")
|
||||
if(NOT MSVC)
|
||||
add_definitions(-DFL_CPP11)
|
||||
set(FL_CPP11 ON CACHE BOOL "")
|
||||
endif()
|
||||
add_subdirectory(FuzzyLite/fuzzylite)
|
||||
endif()
|
||||
add_subdirectory(BattleAI)
|
||||
add_subdirectory(StupidAI)
|
||||
add_subdirectory(EmptyAI)
|
||||
add_subdirectory(VCAI)
|
||||
add_subdirectory(VCAI)
|
50
AI/FuzzyLite/.travis.yml
Normal file
50
AI/FuzzyLite/.travis.yml
Normal file
@ -0,0 +1,50 @@
|
||||
language: cpp
|
||||
|
||||
before_install:
|
||||
#new GCC
|
||||
- sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test
|
||||
#new Clang
|
||||
- sudo add-apt-repository --yes ppa:h-rayflood/llvm
|
||||
#new CMake
|
||||
- sudo add-apt-repository --yes ppa:andykimpe/cmake
|
||||
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq cmake
|
||||
- sudo apt-get install -qq $SUPPORT
|
||||
- sudo apt-get install -qq $PACKAGE
|
||||
|
||||
#setup compiler
|
||||
- export CC=${REAL_CC} CXX=${REAL_CXX}
|
||||
|
||||
before_script:
|
||||
- mkdir build
|
||||
- cd build
|
||||
- cmake ../fuzzylite
|
||||
|
||||
script:
|
||||
- make
|
||||
|
||||
env:
|
||||
- ignore=this
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
- env: ignore=this
|
||||
include:
|
||||
- compiler: clang
|
||||
env: REAL_CC=clang-3.2 REAL_CXX=clang++-3.2 PACKAGE=clang-3.2 SUPPORT=g++-4.8
|
||||
- compiler: clang
|
||||
env: REAL_CC=clang-3.3 REAL_CXX=clang++-3.3 PACKAGE=clang-3.3 SUPPORT=g++-4.8
|
||||
- compiler: clang
|
||||
env: REAL_CC=clang-3.4 REAL_CXX=clang++-3.4 PACKAGE=clang-3.4 SUPPORT=g++-4.8
|
||||
- compiler: gcc
|
||||
env: REAL_CC=gcc-4.7 REAL_CXX=g++-4.7 PACKAGE=g++-4.7 SUPPORT=
|
||||
- compiler: gcc
|
||||
env: REAL_CC=gcc-4.8 REAL_CXX=g++-4.8 PACKAGE=g++-4.8 SUPPORT=
|
||||
|
||||
notifications:
|
||||
email:
|
||||
recipients:
|
||||
- uzzylite.fail@mixaill.tk
|
||||
on_success: change
|
||||
on_failure: always
|
@ -232,7 +232,7 @@ The entire `fuzzylite` library has been thoroughly revised, refactored, validate
|
||||
* Added method `WeightedDefuzzifier::inferType(Term*)` to automatically determine the `WeightedDefuzzifier::Type` based on the class of `Term`.
|
||||
* **(important)** By default, `WeightedDefuzzifier::type = Automatic`, which automatically infers the type based on the `WeightedDefuzzifier::inferType()`.
|
||||
* **(important)** There is a small performance penalty when using `WeightedDefuzzifier::type = Automatic` because `WeightedDefuzzifier::inferType()` performs three `dynamic_cast<>`.
|
||||
* **(important)** Deleted class `Tsukamoto`. Its method `static tsukamoto()` was moved to `virtual WeightedDefuzzifier::tsukamoto()`, which allows to be overriden
|
||||
* **(important)** Deleted class `Tsukamoto`. Its method `static tsukamoto()` was moved to `virtual WeightedDefuzzifier::tsukamoto()`, which allows overriding it
|
||||
* Added support for `Tsukamoto` with `Concave` terms.
|
||||
+ **(EXTREMELY important)** In version 5.0, the traditional operation of Takagi-Sugeno and Tsukamoto controllers is achieved by setting `OutputVariable::accumulation = none`. Unlike version 4.0, the `RuleBlock::activation` will not have any effect on Takagi-Sugeno nor Tsukamoto controllers, for which `RuleBlock::activation` should also be set to `none`. More information about the roles of the `OutputVariable::accumulation` and `RuleBlock::activation` operators are detailed as follows. Refer to [sciweavers](http://www.sciweavers.org/free-online-latex-equation-editor) to convert LaTeX equations.
|
||||
+ **(VERY important)** In version 5.0, the role of the `RuleBlock::activation` `TNorm` on the `Weighted[Average|Sum]` always performs a regular multiplication of the weights and the values (i.e., $w_i \times z_j$) regardless of the `TNorm` chosen. In other words, selecting any `RuleBlock::activation` for `Weighted[Average|Sum]` is irrelevant, and should be set to `none` as every `TNorm` will have the same multiplication effect. This operation is different from `fuzzylite` version 4.0, where the `RuleBlock::activation` operator was utilized to multiply the weights and values (i.e. $w_i \otimes z_j$), and therefore the traditional operation of the `Weighted[Average|Sum]` was achieved when `RuleBlock::activation = AlgebraicProduct;`.
|
||||
|
@ -288,7 +288,7 @@ The entire `fuzzylite` library has been thoroughly revised, refactored, validate
|
||||
* Added method `WeightedDefuzzifier::inferType(Term*)` to automatically determine the `WeightedDefuzzifier::Type` based on the class of `Term`.
|
||||
* **(important)** By default, `WeightedDefuzzifier::type = Automatic`, which automatically infers the type based on the `WeightedDefuzzifier::inferType()`.
|
||||
* **(important)** There is a small performance penalty when using `WeightedDefuzzifier::type = Automatic` because `WeightedDefuzzifier::inferType()` performs three `dynamic_cast<>`.
|
||||
* **(important)** Deleted class `Tsukamoto`. Its method `static tsukamoto()` was moved to `virtual WeightedDefuzzifier::tsukamoto()`, which allows to be overriden
|
||||
* **(important)** Deleted class `Tsukamoto`. Its method `static tsukamoto()` was moved to `virtual WeightedDefuzzifier::tsukamoto()`, which allows overriding it
|
||||
* Added support for `Tsukamoto` with `Concave` terms.
|
||||
+ **(EXTREMELY important)** In version 5.0, the traditional operation of Takagi-Sugeno and Tsukamoto controllers is achieved by setting `OutputVariable::accumulation = none`. Unlike version 4.0, the `RuleBlock::activation` will not have any effect on Takagi-Sugeno nor Tsukamoto controllers, for which `RuleBlock::activation` should also be set to `none`. More information about the roles of the `OutputVariable::accumulation` and `RuleBlock::activation` operators are detailed as follows. Refer to [sciweavers](http://www.sciweavers.org/free-online-latex-equation-editor) to convert LaTeX equations.
|
||||
+ **(VERY important)** In version 5.0, the role of the `RuleBlock::activation` `TNorm` on the `Weighted[Average|Sum]` always performs a regular multiplication of the weights and the values (i.e., $w_i \times z_j$) regardless of the `TNorm` chosen. In other words, selecting any `RuleBlock::activation` for `Weighted[Average|Sum]` is irrelevant, and should be set to `none` as every `TNorm` will have the same multiplication effect. This operation is different from `fuzzylite` version 4.0, where the `RuleBlock::activation` operator was utilized to multiply the weights and values (i.e. $w_i \otimes z_j$), and therefore the traditional operation of the `Weighted[Average|Sum]` was achieved when `RuleBlock::activation = AlgebraicProduct;`.
|
||||
|
@ -1,20 +1,32 @@
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
cmake_minimum_required(VERSION 2.8.8)
|
||||
|
||||
project(fuzzylite CXX)
|
||||
|
||||
set(CMAKE_VERBOSE_MAKEFILE false)
|
||||
###DEFINES SECTION
|
||||
if(NOT CMAKE_VERBOSE_MAKEFILE)
|
||||
set(CMAKE_VERBOSE_MAKEFILE false)
|
||||
endif()
|
||||
|
||||
set(FL_VERSION 5.0)
|
||||
add_definitions(-DFL_VERSION="${FL_VERSION}")
|
||||
|
||||
set(FL_DATE "1408")
|
||||
add_definitions(-DFL_DATE="${FL_DATE}")
|
||||
|
||||
add_definitions(-DFL_BUILD_PATH="${CMAKE_SOURCE_DIR}") #used to determine FL__FILE__
|
||||
|
||||
option(FL_BUILD_SHARED "Build shared library" ON)
|
||||
option(FL_BUILD_STATIC "Build static library" ON)
|
||||
if(FL_BUILD_SHARED)
|
||||
option(FL_BUILD_BINARY "Build fuzzylite binary" ON)
|
||||
endif()
|
||||
|
||||
option(FL_USE_FLOAT "Use fl::scalar as float" OFF)
|
||||
option(FL_BACKTRACE "Provide backtrace information in case of errors" OFF)
|
||||
option(FL_CPP11 "Builds utilizing C++11, i.e., passing -std=c++11" ON)
|
||||
option(FL_CPP11 "Builds utilizing C++11, i.e., passing -std=c++11" OFF)
|
||||
|
||||
if(FL_CPP11 AND MSVC)
|
||||
message("Warning: MSVC not compatible with FL_CPP11 flag")
|
||||
endif()
|
||||
|
||||
if(FL_USE_FLOAT)
|
||||
add_definitions(-DFL_USE_FLOAT)
|
||||
@ -26,9 +38,9 @@ endif()
|
||||
|
||||
if(FL_CPP11)
|
||||
add_definitions(-DFL_CPP11)
|
||||
if(UNIX)
|
||||
if(NOT MSVC)
|
||||
add_definitions(-std=c++11)
|
||||
endif(UNIX)
|
||||
endif(NOT MSVC)
|
||||
endif(FL_CPP11)
|
||||
|
||||
|
||||
@ -36,29 +48,26 @@ if(WIN32)
|
||||
message("Windows")
|
||||
add_definitions(-DFL_WINDOWS)
|
||||
endif()
|
||||
|
||||
if (UNIX)
|
||||
message("Unix")
|
||||
add_definitions(-DFL_UNIX)
|
||||
endif()
|
||||
|
||||
if (APPLE)
|
||||
message("Apple")
|
||||
add_definitions(-DFL_APPLE)
|
||||
endif()
|
||||
|
||||
|
||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY bin)
|
||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY bin)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY bin)
|
||||
|
||||
if(UNIX)
|
||||
set(CMAKE_CXX_FLAGS "-pedantic -Werror -Wall -Wextra")
|
||||
if(NOT MSVC)
|
||||
set(CMAKE_CXX_FLAGS "-pedantic -Werror -Wall -Wextra ${CMAKE_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}")
|
||||
|
||||
if(NOT APPLE)
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined") #To avoid undefined methods in library
|
||||
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}") #To avoid undefined methods in library
|
||||
endif()
|
||||
endif()
|
||||
|
||||
@ -68,7 +77,17 @@ endif()
|
||||
|
||||
set(FL_LIBS)
|
||||
|
||||
if(WIN32)
|
||||
#link with rt lib on Linux. Fixes problem with clock_gettime()
|
||||
include(CheckLibraryExists)
|
||||
if(UNIX AND NOT APPLE)
|
||||
ENABLE_LANGUAGE(C)
|
||||
CHECK_LIBRARY_EXISTS(rt shm_open "" HAVE_RT_LIB)
|
||||
if(HAVE_RT_LIB)
|
||||
set(FL_LIBS ${FL_LIBS} rt)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
set(CMAKE_CXX_FLAGS "/WX /W4 /EHsc")
|
||||
#Wx: Treat warnings as errors. W4: All warnings
|
||||
#http://msdn.microsoft.com/en-us/library/thxezb7y.aspx
|
||||
@ -85,9 +104,13 @@ if(WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
###BUILD SECTION
|
||||
include_directories(.)
|
||||
cmake_policy(SET CMP0015 OLD)
|
||||
link_directories(.)
|
||||
cmake_policy(SET CMP0015 OLD)
|
||||
if (APPLE)
|
||||
cmake_policy(SET CMP0042 NEW)
|
||||
endif()
|
||||
|
||||
file(STRINGS FL_HEADERS fl-headers)
|
||||
file(STRINGS FL_SOURCES fl-sources)
|
||||
@ -96,51 +119,94 @@ string(REGEX REPLACE "\n" " " ${fl-headers} ${fl-headers})
|
||||
string(REGEX REPLACE "\n" " " ${fl-sources} ${fl-sources})
|
||||
|
||||
message("${exepath}")
|
||||
|
||||
|
||||
set(CMAKE_DEBUG_POSTFIX d)
|
||||
|
||||
INCLUDE(CheckLibraryExists)
|
||||
if (MSVC OR CMAKE_GENERATOR STREQUAL Xcode)
|
||||
if(FL_BUILD_SHARED)
|
||||
add_library(fl-shared SHARED ${fl-headers} ${fl-sources})
|
||||
endif()
|
||||
|
||||
#check if some platform-specific libraries are needed for linking
|
||||
if(NOT WIN32)
|
||||
CHECK_LIBRARY_EXISTS(rt shm_open "" HAVE_RT_LIB)
|
||||
if(HAVE_RT_LIB)
|
||||
set(SYSTEM_LIBS ${SYSTEM_LIBS} rt)
|
||||
endif()
|
||||
if(FL_BUILD_STATIC)
|
||||
add_library(fl-static STATIC ${fl-headers} ${fl-sources})
|
||||
endif()
|
||||
else()
|
||||
if(FL_BUILD_SHARED OR FL_BUILD_STATIC)
|
||||
add_library(fl-obj OBJECT ${fl-headers} ${fl-sources})
|
||||
if(NOT MINGW)
|
||||
set_target_properties(fl-obj PROPERTIES COMPILE_FLAGS "-fPIC")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(FL_BUILD_SHARED)
|
||||
add_library(fl-shared SHARED $<TARGET_OBJECTS:fl-obj>)
|
||||
endif(FL_BUILD_SHARED)
|
||||
|
||||
if(FL_BUILD_STATIC)
|
||||
add_library(fl-static STATIC $<TARGET_OBJECTS:fl-obj>)
|
||||
endif(FL_BUILD_STATIC)
|
||||
endif()
|
||||
|
||||
add_library(fl-shared SHARED ${fl-headers} ${fl-sources})
|
||||
set_target_properties(fl-shared PROPERTIES OUTPUT_NAME fuzzylite)
|
||||
set_target_properties(fl-shared PROPERTIES DEBUG_POSTFIX d)
|
||||
set_target_properties(fl-shared PROPERTIES COMPILE_DEFINITIONS "FL_EXPORT_LIBRARY")
|
||||
if (UNIX)
|
||||
set_target_properties(fl-shared PROPERTIES COMPILE_FLAGS "-fPIC")
|
||||
if(FL_BUILD_SHARED)
|
||||
set_target_properties(fl-shared PROPERTIES OUTPUT_NAME fuzzylite)
|
||||
set_target_properties(fl-shared PROPERTIES DEBUG_POSTFIX d)
|
||||
set_target_properties(fl-shared PROPERTIES COMPILE_DEFINITIONS "FL_EXPORT_LIBRARY")
|
||||
set_target_properties(fl-shared PROPERTIES VERSION 5.0)
|
||||
target_link_libraries(fl-shared ${FL_LIBS})
|
||||
endif()
|
||||
target_link_libraries(fl-shared ${FL_LIBS} ${SYSTEM_LIBS})
|
||||
|
||||
add_library(fl-static STATIC ${fl-headers} ${fl-sources})
|
||||
set_target_properties(fl-static PROPERTIES OUTPUT_NAME fuzzylite-static)
|
||||
set_target_properties(fl-static PROPERTIES DEBUG_POSTFIX d)
|
||||
if (UNIX)
|
||||
set_target_properties(fl-static PROPERTIES COMPILE_FLAGS "-fPIC")
|
||||
if(FL_BUILD_STATIC)
|
||||
set_target_properties(fl-static PROPERTIES OUTPUT_NAME fuzzylite-static)
|
||||
set_target_properties(fl-static PROPERTIES DEBUG_POSTFIX d)
|
||||
set_target_properties(fl-static PROPERTIES VERSION 5.0)
|
||||
target_link_libraries(fl-static ${FL_LIBS})
|
||||
endif()
|
||||
target_link_libraries(fl-static ${FL_LIBS} ${SYSTEM_LIBS})
|
||||
|
||||
add_executable(fl-bin src/main.cpp)
|
||||
set_target_properties(fl-bin PROPERTIES OUTPUT_NAME fuzzylite)
|
||||
set_target_properties(fl-bin PROPERTIES OUTPUT_NAME fuzzylite IMPORT_PREFIX tmp-) #To prevent LNK1149 in Windows
|
||||
set_target_properties(fl-bin PROPERTIES DEBUG_POSTFIX d)
|
||||
#set_target_properties(fl-bin PROPERTIES COMPILE_DEFINITIONS "FL_IMPORT_LIBRARY")
|
||||
#target_link_libraries(fl-bin fl-shared ${FL_LIBS})
|
||||
target_link_libraries(fl-bin fl-static ${FL_LIBS} ${SYSTEM_LIBS})
|
||||
if(FL_BUILD_BINARY)
|
||||
add_executable(fl-bin src/main.cpp)
|
||||
set_target_properties(fl-bin PROPERTIES OUTPUT_NAME fuzzylite)
|
||||
set_target_properties(fl-bin PROPERTIES OUTPUT_NAME fuzzylite IMPORT_PREFIX tmp-) #To prevent LNK1149 in Windows
|
||||
set_target_properties(fl-bin PROPERTIES DEBUG_POSTFIX d)
|
||||
|
||||
set_target_properties(fl-bin PROPERTIES COMPILE_DEFINITIONS "FL_IMPORT_LIBRARY")
|
||||
target_link_libraries(fl-bin fl-shared ${FL_LIBS})
|
||||
endif(FL_BUILD_BINARY)
|
||||
|
||||
install(TARGETS fl-bin fl-shared fl-static
|
||||
RUNTIME DESTINATION bin
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib
|
||||
)
|
||||
###INSTALL SECTION
|
||||
if(NOT FL_INSTALL_BINDIR)
|
||||
set(FL_INSTALL_BINDIR bin)
|
||||
endif()
|
||||
|
||||
if(NOT FL_INSTALL_LIBDIR)
|
||||
if(NOT CMAKE_INSTALL_LIBDIR)
|
||||
set(FL_INSTALL_LIBDIR lib)
|
||||
else()
|
||||
set(FL_INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(FL_BUILD_BINARY)
|
||||
install(TARGETS fl-bin
|
||||
RUNTIME DESTINATION ${FL_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${FL_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${FL_INSTALL_LIBDIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(FL_BUILD_SHARED)
|
||||
install(TARGETS fl-shared
|
||||
RUNTIME DESTINATION ${FL_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${FL_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${FL_INSTALL_LIBDIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
if(FL_BUILD_STATIC)
|
||||
install(TARGETS fl-static
|
||||
RUNTIME DESTINATION ${FL_INSTALL_BINDIR}
|
||||
LIBRARY DESTINATION ${FL_INSTALL_LIBDIR}
|
||||
ARCHIVE DESTINATION ${FL_INSTALL_LIBDIR}
|
||||
)
|
||||
endif()
|
||||
|
||||
install(DIRECTORY fl/ DESTINATION include/fl)
|
||||
|
||||
@ -149,10 +215,12 @@ message("fuzzylite v.${FL_VERSION}b${FL_DATE}\n")
|
||||
message("FL_USE_FLOAT=${FL_USE_FLOAT}")
|
||||
message("FL_BACKTRACE=${FL_BACKTRACE}")
|
||||
message("FL_CPP11=${FL_CPP11}")
|
||||
message("FL_INSTALL_BINDIR=${FL_INSTALL_BINDIR}")
|
||||
message("FL_INSTALL_LIBDIR=${FL_INSTALL_LIBDIR}")
|
||||
message("Build=${CMAKE_BUILD_TYPE}")
|
||||
message("=====================================\n")
|
||||
|
||||
# uninstall target
|
||||
###UNINSTALL SECTION
|
||||
#configure_file(
|
||||
#"${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
|
||||
#"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||
@ -162,4 +230,4 @@ message("=====================================\n")
|
||||
#COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/uninstall.cmake)
|
||||
|
||||
#unix uninstall
|
||||
#xargs rm < install_manifest.txt
|
||||
#xargs rm < install_manifest.txt
|
||||
|
@ -25,12 +25,12 @@
|
||||
#ifndef FL_FUZZYLITE_H
|
||||
#define FL_FUZZYLITE_H
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <algorithm>
|
||||
|
||||
#ifndef FL_VERSION
|
||||
#define FL_VERSION "?"
|
||||
@ -73,7 +73,9 @@
|
||||
|
||||
//TODO: Address warning 4251 by exporting members?
|
||||
//http://www.unknownroad.com/rtfm/VisualStudio/warningC4251.html
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (disable:4251)
|
||||
#endif
|
||||
|
||||
//fuzzylite as a shared library is exported
|
||||
//Applications linking with fuzzylite as a shared library need to import
|
||||
|
@ -44,8 +44,8 @@ namespace fl {
|
||||
FL_unique_ptr<SNorm> _accumulation;
|
||||
public:
|
||||
Accumulated(const std::string& name = "",
|
||||
scalar minimum = -fl::inf,
|
||||
scalar maximum = fl::inf,
|
||||
scalar minimum = fl::nan,
|
||||
scalar maximum = fl::nan,
|
||||
SNorm* accumulation = fl::null);
|
||||
Accumulated(const Accumulated& other);
|
||||
Accumulated& operator=(const Accumulated& other);
|
||||
|
@ -69,6 +69,10 @@ namespace fl {
|
||||
return this->_expression != fl::null;
|
||||
}
|
||||
|
||||
scalar Antecedent::activationDegree(const TNorm* conjunction, const SNorm* disjunction) const {
|
||||
return this->activationDegree(conjunction, disjunction, this->_expression);
|
||||
}
|
||||
|
||||
scalar Antecedent::activationDegree(const TNorm* conjunction, const SNorm* disjunction,
|
||||
const Expression* node) const {
|
||||
if (not isLoaded()) {
|
||||
@ -131,10 +135,6 @@ namespace fl {
|
||||
|
||||
}
|
||||
|
||||
scalar Antecedent::activationDegree(const TNorm* conjunction, const SNorm* disjunction) const {
|
||||
return this->activationDegree(conjunction, disjunction, this->_expression);
|
||||
}
|
||||
|
||||
void Antecedent::unload() {
|
||||
if (_expression) {
|
||||
delete _expression;
|
||||
|
@ -157,7 +157,7 @@ namespace fl {
|
||||
throw fl::Exception(os.str(), FL_AT);
|
||||
}
|
||||
|
||||
std::vector<std::pair<scalar, scalar> > result((xy.size() + 1) / 2);
|
||||
std::vector<Pair> result((xy.size() + 1) / 2);
|
||||
for (std::size_t i = 0; i + 1 < xy.size(); i += 2) {
|
||||
result.at(i / 2).first = xy.at(i);
|
||||
result.at(i / 2).second = xy.at(i + 1);
|
||||
@ -167,7 +167,7 @@ namespace fl {
|
||||
|
||||
std::vector<Discrete::Pair> Discrete::toPairs(const std::vector<scalar>& xy,
|
||||
scalar missingValue) FL_INOEXCEPT {
|
||||
std::vector<std::pair<scalar, scalar> > result((xy.size() + 1) / 2);
|
||||
std::vector<Pair> result((xy.size() + 1) / 2);
|
||||
for (std::size_t i = 0; i + 1 < xy.size(); i += 2) {
|
||||
result.at(i / 2).first = xy.at(i);
|
||||
result.at(i / 2).second = xy.at(i + 1);
|
||||
|
@ -575,8 +575,8 @@ namespace fl {
|
||||
//y x * sin 2 ^ x /
|
||||
|
||||
|
||||
text = "(Temperature is High and Oxigen is Low) or "
|
||||
"(Temperature is Low and (Oxigen is Low or Oxigen is High))";
|
||||
text = "(Temperature is High and Oxygen is Low) or "
|
||||
"(Temperature is Low and (Oxygen is Low or Oxygen is High))";
|
||||
FL_LOG(f.toPostfix(text));
|
||||
|
||||
f.variables["pi"] = 3.14;
|
||||
|
@ -1,10 +1,8 @@
|
||||
project(VCAI)
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
add_definitions(-DFL_CPP11) #TODO: Find a better way to set this macro for fuzzylite
|
||||
|
||||
if (FUZZYLITE_FOUND)
|
||||
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib ${FUZZYLITE_INCLUDE_DIR})
|
||||
if (FL_FOUND)
|
||||
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib ${FL_INCLUDE_DIRS})
|
||||
else()
|
||||
include_directories(${Boost_INCLUDE_DIRS} ${CMAKE_HOME_DIRECTORY} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/lib ${CMAKE_HOME_DIRECTORY}/AI/FuzzyLite/fuzzylite)
|
||||
endif()
|
||||
@ -19,8 +17,8 @@ set(VCAI_SRCS
|
||||
)
|
||||
|
||||
add_library(VCAI SHARED ${VCAI_SRCS})
|
||||
if (FUZZYLITE_FOUND)
|
||||
target_link_libraries(VCAI ${FUZZYLITE_LIBRARIES} vcmi)
|
||||
if (FL_FOUND)
|
||||
target_link_libraries(VCAI ${FL_LIBRARIES} vcmi)
|
||||
else()
|
||||
target_link_libraries(VCAI fl-static vcmi)
|
||||
endif()
|
||||
|
@ -162,7 +162,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR NOT WIN32) #so far all *nix compilers support suc
|
||||
set(CLANG_SPECIFIC_FLAGS "-Wno-mismatched-tags -Wno-unknown-warning-option")
|
||||
endif()
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -Wextra -Wpointer-arith -Wno-strict-aliasing -Wno-switch -Wno-sign-compare -Wno-unused-local-typedefs -Wno-unused-parameter -Wuninitialized -Wno-overloaded-virtual -Wno-type-limits ${CLANG_SPECIFIC_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -Wextra -Wpointer-arith -Wno-strict-aliasing -Wno-switch -Wno-sign-compare -Wno-unused-local-typedefs -Wno-unused-parameter -Wuninitialized -Wno-overloaded-virtual -Wno-type-limits -Wno-unknown-pragmas -Wno-reorder ${CLANG_SPECIFIC_FLAGS}")
|
||||
|
||||
if(UNIX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
|
||||
|
57
cmake_modules/FindFuzzylite.cmake
Normal file
57
cmake_modules/FindFuzzylite.cmake
Normal file
@ -0,0 +1,57 @@
|
||||
#.rst:
|
||||
# FindFuzzylite
|
||||
# --------
|
||||
#
|
||||
# Locate Fuzzylite library
|
||||
#
|
||||
#=============================================================================
|
||||
# Copyright 2003-2009 Kitware, Inc.
|
||||
# Copyright 2012 Benjamin Eikel
|
||||
# Copyright 2014 Mikhail Paulyshka
|
||||
#
|
||||
# Distributed under the OSI-approved BSD License (the "License");
|
||||
# see accompanying file kitware license.txt for details.
|
||||
#
|
||||
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
# See the License for more information.
|
||||
#=============================================================================
|
||||
# (To distribute this file outside of CMake, substitute the full
|
||||
# License text for the above reference.)
|
||||
|
||||
find_path(FL_INCLUDE_DIR
|
||||
fl/fuzzylite.h
|
||||
HINTS
|
||||
ENV FLDIR
|
||||
PATH_SUFFIXES
|
||||
fl
|
||||
include/fl
|
||||
include
|
||||
)
|
||||
|
||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
set(VC_LIB_PATH_SUFFIX lib/x64)
|
||||
else()
|
||||
set(VC_LIB_PATH_SUFFIX lib/x86)
|
||||
endif()
|
||||
|
||||
find_library(FL_LIBRARY
|
||||
NAMES
|
||||
fuzzylite
|
||||
HINTS
|
||||
ENV FLDIR
|
||||
PATH_SUFFIXES
|
||||
dynamic
|
||||
lib
|
||||
${VC_LIB_PATH_SUFFIX}
|
||||
)
|
||||
|
||||
set(FL_LIBRARIES ${FL_LIBRARY})
|
||||
set(FL_INCLUDE_DIRS ${FL_INCLUDE_DIR})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(FL
|
||||
REQUIRED_VARS FL_LIBRARIES FL_INCLUDE_DIRS)
|
||||
|
||||
mark_as_advanced(FL_LIBRARY FL_INCLUDE_DIR)
|
Loading…
Reference in New Issue
Block a user