COIN-OR::LEMON - Graph Library

Changeset 11:4fc6ad2fb8a6 in lemon-project-template-glpk


Ignore:
Timestamp:
11/06/11 21:43:29 (7 years ago)
Author:
Alpar Juttner <alpar@…>
Branch:
default
Phase:
public
Tags:
tip
Message:

Test GLPK in src/main.cc

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/CMakeLists.txt

    r8 r11  
    2020
    2121TARGET_LINK_LIBRARIES(lemon-project
    22   ${LEMON_LIBRARIES}
     22  ${LEMON_LIBRARIES} glpk
    2323)
    2424
  • src/main.cc

    r7 r11  
    1717 */
    1818
     19#include<lemon/arg_parser.h>
    1920#include<lemon/list_graph.h>
     21#include<lemon/glpk.h>
    2022
    2123///The main entry point
    22 int main()
     24int main(int argc, char **argv)
    2325{
     26
     27  lemon::ArgParser ap(argc,argv);
     28  ap.run();
     29
    2430  lemon::ListGraph g;
    2531  g.addNode();
     32 
     33  typedef lemon::GlpkLp Solver;
     34  Solver lp;
     35  Solver::Col x = lp.addCol();
     36  Solver::Col y = lp.addCol();
     37  lp.colLowerBound(x,0);
     38  lp.colLowerBound(y,0);
     39  lp.addRow(3<=x+2*y<=10);
     40  lp.obj(-4*x+3*y);
     41  lp.max();
     42  lp.solve();
     43
    2644}
Note: See TracChangeset for help on using the changeset viewer.