COIN-OR::LEMON - Graph Library

Opened 14 years ago

Closed 14 years ago

#350 closed defect (fixed)

min_cost_flow_test does not build with VS2008

Reported by: Alpar Juttner Owned by: Peter Kovacs
Priority: critical Milestone: LEMON 1.2 release
Component: core Version: hg main
Keywords: Cc: Geleji János
Revision id: 2c35bef44dd1

Description

The compiler says

[ 79%] Building CXX object test/CMakeFiles/min_cost_flow_test.dir/min_cost_flow_
test.cc.obj
min_cost_flow_test.cc
L:\projects\LEMON\hg\win\lemon/cost_scaling.h(947) : error C2668: 'sqrt' : ambig
uous call to overloaded function
        C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(581): cou
ld be 'long double sqrt(long double)'
        C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(533): or
      'float sqrt(float)'
        C:\Program Files\Microsoft Visual Studio 9.0\VC\INCLUDE\math.h(128): or
      'double sqrt(double)'
        while trying to match the argument list '(int)'
        L:\projects\LEMON\hg\win\lemon/cost_scaling.h(920) : while compiling cla
ss template member function 'void lemon::CostScaling<GR>::startAugment(int)'
        with
        [
            GR=Digraph
        ]
        L:\projects\LEMON\hg\win\test\min_cost_flow_test.cc(528) : see reference
 to class template instantiation 'lemon::CostScaling<GR>' being compiled
        with
        [
            GR=Digraph
        ]
NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~1.0\VC\bin\cl.exe' : return code
'0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN
\nmake.exe"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files\Microsoft Visual Studio 9.0\VC\BIN
\nmake.exe"' : return code '0x2'
Stop.

Attachments (1)

acf6cb96c7d4.patch (1.2 KB) - added by Alpar Juttner 14 years ago.

Download all attachments as: .zip

Change History (6)

Changed 14 years ago by Alpar Juttner

Attachment: acf6cb96c7d4.patch added

comment:1 Changed 14 years ago by Alpar Juttner

The attached changeset [acf6cb96c7d4] solves this issue but a there is still warning saying that

[ 79%] Building CXX object test/CMakeFiles/min_cost_flow_test.dir/min_cost_flow_
test.cc.obj
min_cost_flow_test.cc
L:\projects\LEMON\hg\win\lemon/cycle_canceling.h(1143) : warning C4244: 'initial
izing' : conversion from '__int64' to 'int', possible loss of data
        L:\projects\LEMON\hg\win\lemon/cycle_canceling.h(957) : while compiling
class template member function 'void lemon::CycleCanceling<GR>::startCancelAndTi
ghten(void)'
        with
        [
            GR=Digraph
        ]
        L:\projects\LEMON\hg\win\test\min_cost_flow_test.cc(536) : see reference
 to class template instantiation 'lemon::CycleCanceling<GR>' being compiled
        with
        [
            GR=Digraph
        ]
L:\projects\LEMON\hg\win\lemon/cycle_canceling.h(1143) : warning C4244: 'initial
izing' : conversion from '__int64' to 'int', possible loss of data
        L:\projects\LEMON\hg\win\lemon/cycle_canceling.h(957) : while compiling
class template member function 'void lemon::CycleCanceling<GR>::startCancelAndTi
ghten(void)'
        with
        [
            GR=GR
        ]
        L:\projects\LEMON\hg\win\test\min_cost_flow_test.cc(197) : see reference
 to class template instantiation 'lemon::CycleCanceling<GR>' being compiled
        with
        [
            GR=GR
        ]
        L:\projects\LEMON\hg\win\lemon/concept_check.h(54) : see reference to cl
ass template instantiation 'McfClassConcept<GR,Value,Cost>::Constraints<MCF>' be
ing compiled
        with
        [
            GR=GR,
            Value=int,
            Cost=int,
            MCF=lemon::CycleCanceling<GR>
        ]
        L:\projects\LEMON\hg\win\test\min_cost_flow_test.cc(496) : see reference
 to function template instantiation 'void lemon::checkConcept<McfClassConcept<GR
,Value,Cost>,lemon::CycleCanceling<GR>>(void)' being compiled
        with
        [
            GR=GR,
            Value=int,
            Cost=int
        ]
Linking CXX executable min_cost_flow_test.exe

comment:2 in reply to:  1 ; Changed 14 years ago by Peter Kovacs

Status: newassigned

Replying to alpar:

The attached changeset [acf6cb96c7d4] solves this issue

It is also solved in [f3bc4e9b5f3a] in #340, thus I prefer to apply that patch. (It would not be easy to merge them, since [f3bc4e9b5f3a] reworks these parts of the code.)

but a there is still warning saying that

This is an actual problem. Now, the min. mean cycle classes (see #179) returns the length (cost) of the found cycle in long long if they are instantiated with int. This is just because the internal storage needs such a big number type to avoid overflow problems when the cycle costs are computed and usually multiplied by the size of the cycle. But it is not clear whether we should use this type as a return value, too, or not.

So, where should we fix this problem? In the min. mean cycle algorithms, i.e.

LargeValue cycleLength() --> Value cycleLength()

or in the min cost flow classes, e.g. store the result of cycleLength() in larger number type.

comment:3 in reply to:  2 ; Changed 14 years ago by Alpar Juttner

Replying to kpeter:

Replying to alpar:

The attached changeset [acf6cb96c7d4] solves this issue

It is also solved in [f3bc4e9b5f3a] in #340, thus I prefer to apply that patch. (It would not be easy to merge them, since [f3bc4e9b5f3a] reworks these parts of the code.)

but a there is still warning saying that

This is an actual problem. Now, the min. mean cycle classes (see #179) returns the length (cost) of the found cycle in long long if they are instantiated with int. This is just because the internal storage needs such a big number type to avoid overflow problems when the cycle costs are computed and usually multiplied by the size of the cycle. But it is not clear whether we should use this type as a return value, too, or not.

So, where should we fix this problem? In the min. mean cycle algorithms, i.e.

LargeValue cycleLength() --> Value cycleLength()

or in the min cost flow classes, e.g. store the result of cycleLength() in larger number type.

Both are acceptable for me. Choose whichever you want.

comment:4 in reply to:  3 ; Changed 14 years ago by Peter Kovacs

Replying to alpar:

Both are acceptable for me. Choose whichever you want.

See [aa8c9008b3de] in #179. Using the original value type for that query function seems to be more natural (similarly to the path length query funtions for shortest path algorithms).

Could you please check whether this patch solves the problem?

comment:5 in reply to:  4 Changed 14 years ago by Alpar Juttner

Resolution: fixed
Status: assignedclosed

Replying to kpeter:

Could you please check whether this patch solves the problem?

Yes, it does. As of [aa8c9008b3de] the repository now compiles without errors and warnings with VS2008.

Note: See TracTickets for help on using tickets.