What does a simple FLOPC++ model look like?

For example like this:

#include "flopc.hpp"
using namespace flopc;

main() {
    enum  {seattle, sandiego, numS}; 
    enum  {newyork, chicago, topeka,numD};

    MP_set S(numS);          // Sources 
    MP_set D(numD);          // Destinations 
    MP_subset<2> Link(S,D);  // Transportation links (sparse subset of S*D)


    MP_data SUPPLY(S);
    MP_data DEMAND(D);

    SUPPLY(seattle)=350;  SUPPLY(sandiego)=600;
    DEMAND(newyork)=325;  DEMAND(chicago)=300;  DEMAND(topeka)=275;
    MP_data COST(Link);

    COST(Link(seattle,newyork)) = 2.5;  
    COST(Link(seattle,chicago)) = 1.7;  
    COST(Link(sandiego,chicago))= 1.8;  
    COST(Link(sandiego,topeka)) = 1.4;

    COST(Link) = 90 * COST(Link) / 1000.0;
    MP_variable x(Link);

    MP_constraint supply(S);
    MP_constraint demand(D);  

    supply(S) =  sum( Link(S,D), x(Link) ) <= SUPPLY(S);
    demand(D) =  sum( Link(S,D), x(Link) ) >= DEMAND(D);
    minimize( sum(Link, COST(Link)*x(Link)) );
    x.display("Optimal solution:");

For further examples, have a look at the ExamplesPage

What solver does FLOPC++ use?

To achieve solver independence, FLOPC++ uses the COIN Open Solver Interface (OSI) (a uniform API for calling math programming solvers), and may be linked to any solver with an OSI interface (CBC, CLP, CPLEX, dylp, GLPK, OSL, SOPLEX, VOL and XPRESS-MP).

In the examples, included in the source package, CBC which is part of COIN is used.

Does FLOPC++ leak memory?

Yes, at the moment it does. But it is the top priority for the current development to eliminate all memory leaks. This involves a redesign of the MP_domain class using reference count plus some further changes. Valgrind will be used to check.

What is the maximum dimension of data, variables and constraints?


Does FLOPC++ work with Windows/Visual? C++?

I do not actively test Windows/Visual? C++ compatibility. However, I have recieved many inquiries about this subject and it is important to me that the code can be used out-of-the-box with Windows/Visual? C++. As of revision 9 (17 May 2006) this has been reported to be the case (MSVC++ version 8 using static libries). Over the time, I have been applying changes to eliminate problems with Visual C++ compilation which have been reported to me, latest by Philip Walton (thanks). Continued feedback on MS (in)compatibilities is requested, and I'll do my best to keep the code Windows/Visual? C++ compatible.

Are there any known bugs / gotchas in FLOPC++

See the tickets.

Does FLOPC++ apply bounds checking?

Actually, there is bounds checking, but its implementation is perhaps surprising: out of bound references (variables or data) evaluates to zero. The reason why this is done so comes from models with leads and lags, such as

store(I) == store(I-1) + production(I);

which are generally more elegantly formulated with this convention. (BTW this is also the out of bound leads/lags are handled by GAMS) I will not change this (allthough I know people who doesnt like it), however (and that is important) it should be suplemented with a "symbolic" check which would also catch mistakes like

MP_variable X(I,J); ..... X(J,I) ....

even if I and J happens to be of the same size. Such a symbolic model check is on the TODO list.

Last modified 16 years ago Last modified on Jun 13, 2006 2:28:26 AM