COIN-OR::LEMON - Graph Library

source: lemon-project-template-glpk/src/main.cc @ 11:4fc6ad2fb8a6

tip
Last change on this file since 11:4fc6ad2fb8a6 was 11:4fc6ad2fb8a6, checked in by Alpar Juttner <alpar@…>, 13 years ago

Test GLPK in src/main.cc

File size: 1.1 KB
Line 
1/* -*- mode: C++; indent-tabs-mode: nil; -*-
2 *
3 * This file is a part of LEMON, a generic C++ optimization library.
4 *
5 * Copyright (C) 2003-2009
6 * Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport
7 * (Egervary Research Group on Combinatorial Optimization, EGRES).
8 *
9 * Permission to use, modify and distribute this software is granted
10 * provided that this copyright notice appears in all copies. For
11 * precise terms see the accompanying LICENSE file.
12 *
13 * This software is provided "AS IS" with no warranty of any kind,
14 * express or implied, and with no claim as to its suitability for any
15 * purpose.
16 *
17 */
18
19#include<lemon/arg_parser.h>
20#include<lemon/list_graph.h>
21#include<lemon/glpk.h>
22
23///The main entry point
24int main(int argc, char **argv)
25{
26
27  lemon::ArgParser ap(argc,argv);
28  ap.run();
29
30  lemon::ListGraph g;
31  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
44}
Note: See TracBrowser for help on using the repository browser.