lemon-project-template-glpk
view src/main.cc @ 11:4fc6ad2fb8a6
Test GLPK in src/main.cc
author | Alpar Juttner <alpar@cs.elte.hu> |
---|---|
date | Sun, 06 Nov 2011 21:43:29 +0100 |
parents | c941f748eaa8 |
children |
line source
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 */
19 #include<lemon/arg_parser.h>
20 #include<lemon/list_graph.h>
21 #include<lemon/glpk.h>
23 ///The main entry point
24 int main(int argc, char **argv)
25 {
27 lemon::ArgParser ap(argc,argv);
28 ap.run();
30 lemon::ListGraph g;
31 g.addNode();
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();
44 }