gravatar
ladanyi@tmit.bme.hu
ladanyi@tmit.bme.hu
Remove superfluous HAVE_CONFIG_H (#278)
0 3 0
default
3 files changed with 0 insertions and 8 deletions:
↑ Collapse diff ↑
Ignore white space 192 line context
1 1
CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
2 2

	
3 3
IF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
4 4
  INCLUDE(${CMAKE_SOURCE_DIR}/cmake/version.cmake)
5 5
ELSE(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
6 6
  SET(PROJECT_NAME "LEMON")
7 7
  SET(PROJECT_VERSION "hg-tip" CACHE STRING "LEMON version string.")
8 8
ENDIF(EXISTS ${CMAKE_SOURCE_DIR}/cmake/version.cmake)
9 9

	
10 10
PROJECT(${PROJECT_NAME})
11 11

	
12 12
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)
13 13

	
14 14
INCLUDE(FindDoxygen)
15 15
INCLUDE(FindGhostscript)
16 16
FIND_PACKAGE(GLPK 4.33)
17 17
FIND_PACKAGE(CPLEX)
18 18
FIND_PACKAGE(COIN)
19 19

	
20
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
21

	
22 20
IF(MSVC)
23 21
  SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4250 /wd4355 /wd4800 /wd4996")
24 22
# Suppressed warnings:
25 23
# C4250: 'class1' : inherits 'class2::member' via dominance
26 24
# C4355: 'this' : used in base member initializer list
27 25
# C4800: 'type' : forcing value to bool 'true' or 'false' (performance warning)
28 26
# C4996: 'function': was declared deprecated
29 27
ENDIF(MSVC)
30 28

	
31
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
32

	
33 29
INCLUDE(CheckTypeSize)
34 30
CHECK_TYPE_SIZE("long long" LEMON_LONG_LONG)
35 31

	
36 32
ENABLE_TESTING()
37 33

	
38 34
ADD_SUBDIRECTORY(lemon)
39 35
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
40 36
  ADD_SUBDIRECTORY(demo)
41 37
  ADD_SUBDIRECTORY(tools)
42 38
  ADD_SUBDIRECTORY(doc)
43 39
  ADD_SUBDIRECTORY(test)
44 40
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
45 41

	
46 42
IF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
47 43
  IF(WIN32)
48 44
    SET(CPACK_PACKAGE_NAME ${PROJECT_NAME})
49 45
    SET(CPACK_PACKAGE_VENDOR "EGRES")
50 46
    SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY
51 47
      "LEMON - Library of Efficient Models and Optimization in Networks")
52 48
    SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
53 49

	
54 50
    SET(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
55 51

	
56 52
    SET(CPACK_PACKAGE_INSTALL_DIRECTORY
57 53
      "${PROJECT_NAME} ${PROJECT_VERSION}")
58 54
    SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY
59 55
      "${PROJECT_NAME} ${PROJECT_VERSION}")
60 56

	
61 57
    SET(CPACK_COMPONENTS_ALL headers library html_documentation bin)
62 58

	
63 59
    SET(CPACK_COMPONENT_HEADERS_DISPLAY_NAME "C++ headers")
64 60
    SET(CPACK_COMPONENT_LIBRARY_DISPLAY_NAME "Dynamic-link library")
65 61
    SET(CPACK_COMPONENT_BIN_DISPLAY_NAME "Command line utilities")
66 62
    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DISPLAY_NAME "HTML documentation")
67 63

	
68 64
    SET(CPACK_COMPONENT_HEADERS_DESCRIPTION
69 65
      "C++ header files")
70 66
    SET(CPACK_COMPONENT_LIBRARY_DESCRIPTION
71 67
      "DLL and import library")
72 68
    SET(CPACK_COMPONENT_BIN_DESCRIPTION
73 69
      "Command line utilities")
74 70
    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_DESCRIPTION
75 71
      "Doxygen generated documentation")
76 72

	
77 73
    SET(CPACK_COMPONENT_HEADERS_DEPENDS library)
78 74

	
79 75
    SET(CPACK_COMPONENT_HEADERS_GROUP "Development")
80 76
    SET(CPACK_COMPONENT_LIBRARY_GROUP "Development")
81 77
    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_GROUP "Documentation")
82 78

	
83 79
    SET(CPACK_COMPONENT_GROUP_DEVELOPMENT_DESCRIPTION
84 80
      "Components needed to develop software using LEMON")
85 81
    SET(CPACK_COMPONENT_GROUP_DOCUMENTATION_DESCRIPTION
86 82
      "Documentation of LEMON")
87 83

	
88 84
    SET(CPACK_ALL_INSTALL_TYPES Full Developer)
89 85

	
90 86
    SET(CPACK_COMPONENT_HEADERS_INSTALL_TYPES Developer Full)
91 87
    SET(CPACK_COMPONENT_LIBRARY_INSTALL_TYPES Developer Full)
92 88
    SET(CPACK_COMPONENT_HTML_DOCUMENTATION_INSTALL_TYPES Full)
93 89

	
94 90
    SET(CPACK_GENERATOR "NSIS")
95 91
    SET(CPACK_NSIS_MUI_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis/lemon.ico")
96 92
    SET(CPACK_NSIS_MUI_UNIICON "${PROJECT_SOURCE_DIR}/cmake/nsis/uninstall.ico")
97 93
    #SET(CPACK_PACKAGE_ICON "${PROJECT_SOURCE_DIR}/cmake/nsis\\\\installer.bmp")
98 94
    SET(CPACK_NSIS_INSTALLED_ICON_NAME "bin\\\\lemon.ico")
99 95
    SET(CPACK_NSIS_DISPLAY_NAME "${CPACK_PACKAGE_INSTALL_DIRECTORY} ${PROJECT_NAME}")
100 96
    SET(CPACK_NSIS_HELP_LINK "http:\\\\\\\\lemon.cs.elte.hu")
101 97
    SET(CPACK_NSIS_URL_INFO_ABOUT "http:\\\\\\\\lemon.cs.elte.hu")
102 98
    SET(CPACK_NSIS_CONTACT "lemon-user@lemon.cs.elte.hu")
103 99
    SET(CPACK_NSIS_CREATE_ICONS_EXTRA "
104 100
      CreateShortCut \\\"$SMPROGRAMS\\\\$STARTMENU_FOLDER\\\\Documentation.lnk\\\" \\\"$INSTDIR\\\\share\\\\doc\\\\index.html\\\"
105 101
      ")
106 102
    SET(CPACK_NSIS_DELETE_ICONS_EXTRA "
107 103
      !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
108 104
      Delete \\\"$SMPROGRAMS\\\\$MUI_TEMP\\\\Documentation.lnk\\\"
109 105
      ")
110 106

	
111 107
    INCLUDE(CPack)
112 108
  ENDIF(WIN32)
113 109
ENDIF(${CMAKE_SOURCE_DIR} STREQUAL ${PROJECT_SOURCE_DIR})
Ignore white space 6 line context
1 1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3 3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
5 5
 * Copyright (C) 2003-2009
6 6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 8
 *
9 9
 * Permission to use, modify and distribute this software is granted
10 10
 * provided that this copyright notice appears in all copies. For
11 11
 * precise terms see the accompanying LICENSE file.
12 12
 *
13 13
 * This software is provided "AS IS" with no warranty of any kind,
14 14
 * express or implied, and with no claim as to its suitability for any
15 15
 * purpose.
16 16
 *
17 17
 */
18 18

	
19 19
#include <sstream>
20 20
#include <lemon/lp_skeleton.h>
21 21
#include "test_tools.h"
22 22
#include <lemon/tolerance.h>
23 23

	
24
#ifdef HAVE_CONFIG_H
25 24
#include <lemon/config.h>
26
#endif
27 25

	
28 26
#ifdef LEMON_HAVE_GLPK
29 27
#include <lemon/glpk.h>
30 28
#endif
31 29

	
32 30
#ifdef LEMON_HAVE_CPLEX
33 31
#include <lemon/cplex.h>
34 32
#endif
35 33

	
36 34
#ifdef LEMON_HAVE_SOPLEX
37 35
#include <lemon/soplex.h>
38 36
#endif
39 37

	
40 38
#ifdef LEMON_HAVE_CLP
41 39
#include <lemon/clp.h>
42 40
#endif
43 41

	
44 42
using namespace lemon;
45 43

	
46 44
void lpTest(LpSolver& lp)
47 45
{
48 46

	
49 47
  typedef LpSolver LP;
50 48

	
51 49
  std::vector<LP::Col> x(10);
52 50
  //  for(int i=0;i<10;i++) x.push_back(lp.addCol());
53 51
  lp.addColSet(x);
54 52
  lp.colLowerBound(x,1);
55 53
  lp.colUpperBound(x,1);
56 54
  lp.colBounds(x,1,2);
57 55

	
58 56
  std::vector<LP::Col> y(10);
59 57
  lp.addColSet(y);
60 58

	
61 59
  lp.colLowerBound(y,1);
62 60
  lp.colUpperBound(y,1);
63 61
  lp.colBounds(y,1,2);
64 62

	
65 63
  std::map<int,LP::Col> z;
66 64

	
67 65
  z.insert(std::make_pair(12,INVALID));
68 66
  z.insert(std::make_pair(2,INVALID));
69 67
  z.insert(std::make_pair(7,INVALID));
70 68
  z.insert(std::make_pair(5,INVALID));
71 69

	
72 70
  lp.addColSet(z);
73 71

	
74 72
  lp.colLowerBound(z,1);
75 73
  lp.colUpperBound(z,1);
76 74
  lp.colBounds(z,1,2);
77 75

	
78 76
  {
79 77
    LP::Expr e,f,g;
80 78
    LP::Col p1,p2,p3,p4,p5;
81 79
    LP::Constr c;
82 80

	
83 81
    p1=lp.addCol();
84 82
    p2=lp.addCol();
85 83
    p3=lp.addCol();
86 84
    p4=lp.addCol();
87 85
    p5=lp.addCol();
88 86

	
89 87
    e[p1]=2;
90 88
    *e=12;
91 89
    e[p1]+=2;
92 90
    *e+=12;
93 91
    e[p1]-=2;
94 92
    *e-=12;
95 93

	
96 94
    e=2;
97 95
    e=2.2;
98 96
    e=p1;
99 97
    e=f;
100 98

	
101 99
    e+=2;
102 100
    e+=2.2;
103 101
    e+=p1;
104 102
    e+=f;
105 103

	
106 104
    e-=2;
107 105
    e-=2.2;
108 106
    e-=p1;
109 107
    e-=f;
110 108

	
111 109
    e*=2;
112 110
    e*=2.2;
113 111
    e/=2;
114 112
    e/=2.2;
115 113

	
116 114
    e=((p1+p2)+(p1-p2)+(p1+12)+(12+p1)+(p1-12)+(12-p1)+
117 115
       (f+12)+(12+f)+(p1+f)+(f+p1)+(f+g)+
118 116
       (f-12)+(12-f)+(p1-f)+(f-p1)+(f-g)+
119 117
       2.2*f+f*2.2+f/2.2+
120 118
       2*f+f*2+f/2+
121 119
       2.2*p1+p1*2.2+p1/2.2+
122 120
       2*p1+p1*2+p1/2
Ignore white space 6 line context
1 1
/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 2
 *
3 3
 * This file is a part of LEMON, a generic C++ optimization library.
4 4
 *
5 5
 * Copyright (C) 2003-2009
6 6
 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 7
 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 8
 *
9 9
 * Permission to use, modify and distribute this software is granted
10 10
 * provided that this copyright notice appears in all copies. For
11 11
 * precise terms see the accompanying LICENSE file.
12 12
 *
13 13
 * This software is provided "AS IS" with no warranty of any kind,
14 14
 * express or implied, and with no claim as to its suitability for any
15 15
 * purpose.
16 16
 *
17 17
 */
18 18

	
19 19
#include "test_tools.h"
20 20

	
21
#ifdef HAVE_CONFIG_H
22 21
#include <lemon/config.h>
23
#endif
24 22

	
25 23
#ifdef LEMON_HAVE_CPLEX
26 24
#include <lemon/cplex.h>
27 25
#endif
28 26

	
29 27
#ifdef LEMON_HAVE_GLPK
30 28
#include <lemon/glpk.h>
31 29
#endif
32 30

	
33 31
#ifdef LEMON_HAVE_CBC
34 32
#include <lemon/cbc.h>
35 33
#endif
36 34

	
37 35

	
38 36
using namespace lemon;
39 37

	
40 38
void solveAndCheck(MipSolver& mip, MipSolver::ProblemType stat,
41 39
                   double exp_opt) {
42 40
  using std::string;
43 41

	
44 42
  mip.solve();
45 43
  //int decimal,sign;
46 44
  std::ostringstream buf;
47 45
  buf << "Type should be: " << int(stat)<<" and it is "<<int(mip.type());
48 46

	
49 47

	
50 48
  //  itoa(stat,buf1, 10);
51 49
  check(mip.type()==stat, buf.str());
52 50

	
53 51
  if (stat ==  MipSolver::OPTIMAL) {
54 52
    std::ostringstream sbuf;
55 53
    buf << "Wrong optimal value: the right optimum is " << exp_opt;
56 54
    check(std::abs(mip.solValue()-exp_opt) < 1e-3, sbuf.str());
57 55
    //+ecvt(exp_opt,2)
58 56
  }
59 57
}
60 58

	
61 59
void aTest(MipSolver& mip)
62 60
{
63 61
  //The following example is very simple
64 62

	
65 63

	
66 64
  typedef MipSolver::Row Row;
67 65
  typedef MipSolver::Col Col;
68 66

	
69 67

	
70 68
  Col x1 = mip.addCol();
71 69
  Col x2 = mip.addCol();
72 70

	
73 71

	
74 72
  //Objective function
75 73
  mip.obj(x1);
76 74

	
77 75
  mip.max();
78 76

	
79 77
  //Unconstrained optimization
80 78
  mip.solve();
81 79
  //Check it out!
82 80

	
83 81
  //Constraints
84 82
  mip.addRow(2 * x1 + x2 <= 2);
85 83
  Row y2 = mip.addRow(x1 - 2 * x2 <= 0);
86 84

	
87 85
  //Nonnegativity of the variable x1
88 86
  mip.colLowerBound(x1, 0);
89 87

	
90 88

	
91 89
  //Maximization of x1
92 90
  //over the triangle with vertices (0,0),(4/5,2/5),(0,2)
93 91
  double expected_opt=4.0/5.0;
94 92
  solveAndCheck(mip, MipSolver::OPTIMAL, expected_opt);
95 93

	
96 94

	
97 95
  //Restrict x2 to integer
98 96
  mip.colType(x2,MipSolver::INTEGER);
99 97
  expected_opt=1.0/2.0;
100 98
  solveAndCheck(mip, MipSolver::OPTIMAL, expected_opt);
101 99

	
102 100

	
103 101
  //Restrict both to integer
104 102
  mip.colType(x1,MipSolver::INTEGER);
105 103
  expected_opt=0;
106 104
  solveAndCheck(mip, MipSolver::OPTIMAL, expected_opt);
107 105

	
108 106
  //Erase a variable
109 107
  mip.erase(x2);
110 108
  mip.rowUpperBound(y2, 8);
111 109
  expected_opt=1;
112 110
  solveAndCheck(mip, MipSolver::OPTIMAL, expected_opt);
113 111

	
114 112
}
115 113

	
116 114

	
117 115
template<class MIP>
118 116
void cloneTest()
119 117
{
0 comments (0 inline)