source: trunk/Clp/examples/pdco.cpp

Last change on this file was 1938, checked in by stefan, 5 years ago

get pdco example working

  • Property svn:keywords set to Id
File size: 2.1 KB
Line 
1/* $Id: pdco.cpp 1938 2013-04-09 16:29:57Z forrest $ */
2// Copyright (C) 2003, International Business Machines
3// Corporation and others.  All Rights Reserved.
4// This code is licensed under the terms of the Eclipse Public License (EPL).
5
6
7// It also tests pdco
8
9// This reads a network problem created by netgen which can be
10// downloaded from www.netlib.org/lp/generators/netgen
11// This is a generator due to Darwin Klingman
12
13#include "ClpInterior.hpp"
14#include "myPdco.hpp"
15#include <stdio.h>
16#include <assert.h>
17#include <cmath>
18
19// easy way to allow compiling all sources for this example within one file,
20// so no need to do something special in Makefile
21#include "myPdco.cpp"
22
23int main(int argc, const char *argv[])
24{
25
26     // Get model in some way
27     ClpInterior model;
28     // Open graph and parameter files
29     //FILE *fpin = fopen("./g.graph","r");
30     //FILE *fpp = fopen("./gparm","r");
31     FILE *fpin = fopen("./g.tiny", "r");
32     FILE *fpp = fopen("./gparm.tiny", "r");
33     assert(fpin);
34     assert(fpp);
35     myPdco stuff(model, fpin, fpp);
36     Info info;
37     Outfo outfo;
38     Options options;
39
40
41     /*
42      *     Set the input parameters for LSQR.
43      */
44     options.gamma = stuff.getD1();
45     options.delta = stuff.getD2();
46     options.MaxIter = 40;
47     options.FeaTol = 5.0e-4;
48     options.OptTol = 5.0e-4;
49     options.StepTol = 0.99;
50     //  options.x0min = 10.0/num_cols;
51     options.x0min = 0.01;
52     options.z0min = 0.01;
53     options.mu0 = 1.0e-6;
54     options.LSmethod = 3;   // 1=Cholesky    2=QR    3=LSQR
55     options.LSproblem = 1;  // See below
56     options.LSQRMaxIter = 999;
57     options.LSQRatol1 = 1.0e-3; // Initial  atol
58     options.LSQRatol2 = 1.0e-6; // Smallest atol (unless atol1 is smaller)
59     options.LSQRconlim = 1.0e12;
60     info.atolmin = options.LSQRatol2;
61     info.LSdamp = 0.0;
62     // These are already set?
63     model.xsize_ = 50.0 / (model.numberColumns());
64     model.xsize_ = CoinMin(1.0, model.xsize_);
65
66     /*
67      *     Solve the test problem
68      */
69     model.pdco(&stuff, options, info, outfo);
70
71     /*
72      *     Examine the results.
73      *     Print the residual norms RNORM and ARNORM given by LSQR, and then compute
74      */
75     return 0;
76}
Note: See TracBrowser for help on using the repository browser.