source: interfaces/stable/1.0/src/lib/TCC.cpp @ 6183

Revision 6183, 2.6 KB checked in by wehart, 5 years ago (diff)

Merged revisions 6022-6182 via svnmerge from
 https://software.sandia.gov/svn/public/acro/interfaces/trunk

........

r6032 | jdsiiro | 2008-12-07 18:53:11 -0700 (Sun, 07 Dec 2008) | 2 lines


Bugfix to Hooke interface. Fixes ticket #4276.

........

r6040 | wehart | 2008-12-07 20:37:24 -0700 (Sun, 07 Dec 2008) | 2 lines


Update.

........

r6049 | wehart | 2008-12-07 22:51:08 -0700 (Sun, 07 Dec 2008) | 2 lines


Updating parsing mechanism for COLIN optimizers.

........

r6050 | wehart | 2008-12-07 22:51:38 -0700 (Sun, 07 Dec 2008) | 3 lines


Reformatting.
Adding COLIN options that are inherited.

........

r6051 | wehart | 2008-12-07 22:51:53 -0700 (Sun, 07 Dec 2008) | 2 lines


Adding COLIN options that are inherited.

........

r6052 | jdsiiro | 2008-12-07 23:08:24 -0700 (Sun, 07 Dec 2008) | 3 lines


Cleaning up the connection between interfaces and scolib so that scolib
solvers are registered in coliny if they are present.

........

r6053 | wehart | 2008-12-07 23:13:52 -0700 (Sun, 07 Dec 2008) | 2 lines


Adding registration of the reset method.

........

r6057 | wehart | 2008-12-07 23:44:17 -0700 (Sun, 07 Dec 2008) | 2 lines


Update to illustrate OPT++ bug.

........

r6059 | wehart | 2008-12-07 23:47:36 -0700 (Sun, 07 Dec 2008) | 2 lines


Adding OPT++ experiments.

........

r6060 | wehart | 2008-12-07 23:57:49 -0700 (Sun, 07 Dec 2008) | 2 lines


Fixes to link in scolib and register its solvers.

........

r6066 | jdsiiro | 2008-12-08 13:30:46 -0700 (Mon, 08 Dec 2008) | 3 lines


  • fix for logic error introduced in r6060 (see ticket #4282)
  • standardizing colin in-source references to libutilib.a to use libutilib.la

........

r6070 | jdsiiro | 2008-12-08 16:25:11 -0700 (Mon, 08 Dec 2008) | 2 lines


Bugfixes to initialize NLF pointers to NULL

........

r6094 | jdsiiro | 2008-12-10 15:01:44 -0700 (Wed, 10 Dec 2008) | 11 lines


Renaming several core COLIN classes to remove the "Opt" prefix:


This goes a long way toward closing #4217.

........

r6114 | jdsiiro | 2008-12-10 17:40:06 -0700 (Wed, 10 Dec 2008) | 17 lines


Removing deprecated colin headers


Removing deprecated object files:

  • LoadAMPL.cpp (colin)
  • LoadXML.cpp (colin)
  • factory.cpp (scolib & interfaces)


This goes a long way toward addressing ticket #4274.

........

r6130 | wehart | 2008-12-10 21:56:55 -0700 (Wed, 10 Dec 2008) | 2 lines


Misc update to tags, to avoid applying these tests.

........

r6182 | wehart | 2008-12-14 13:37:38 -0700 (Sun, 14 Dec 2008) | 2 lines


Documentation updates.

........

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
Line 
1/*  _________________________________________________________________________
2 *
3 *  Acro: A Common Repository for Optimizers
4 *  Copyright (c) 2008 Sandia Corporation.
5 *  This software is distributed under the BSD License.
6 *  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
7 *  the U.S. Government retains certain rights in this software.
8 *  For more information, see the README.txt file in the top Acro directory.
9 *  _________________________________________________________________________
10 */
11
12//
13// TCC.cpp
14//
15
16#include <acro_config.h>
17#ifdef USING_TCC
18
19#include <utilib/Uniform.h>
20#include <interfaces/TCC.h>
21
22namespace interfaces {
23
24using colin::real;
25
26extern double (*urandom)();
27extern void (*cluster_gopt_fn)(BasicArray<double>&, real&, int ,int );
28extern int cluster_gopt(BasicArray<double>& amin, BasicArray<double>& amax, const int nparm,
29                const int m, int n100, int ng0, ostream& ostr,
30                const int nsig, const int max_num_clusters,
31                DoubleMatrix& x0,
32                int& nc, BasicArray<double>& f0, int& nfe, BasicArray<double>& work);
33
34static Uniform urnd;
35double Dummy_urandom() {return urnd();}
36
37//
38// Junk for computing the function
39//
40#ifdef ACRO_HAVE_TEMPLATES_AS_TEMPLATE_ARGUMENTS
41static colin::Problem<BasicArray<double>,BasicArray > *localFn;
42#else
43static colin::Problem<BasicArray<double> >* localFn;
44#endif
45static BasicArray<double> vec;
46
47void DummyFunc(BasicArray<double>& x, real& f, int nparam, int)
48{
49vec.set_data(nparam,&(x[1]));
50localFn->EvalF(vec,f);
51//ucout << "TCC Feval: " << f << ": " << vec << endl;
52}
53
54//
55// Constructor
56//
57TCC::TCC()
58{
59cluster_gopt_fn = &DummyFunc;
60urandom=Dummy_urandom;
61num_samples=300;
62max_nmins=20;
63}
64
65
66void TCC::reset()
67{
68urnd.generator(&rng);
69}
70
71
72void TCC::minimize()
73{
74//localFn = &problem;
75opt_init();
76
77if (problem.numConstraints() > 0)
78   EXCEPTION_MNGR(runtime_error, "TCCluster::minimize -- no constraints can be handled by this method!");
79
80int m=1;
81int nfe;
82int nc;
83work.resize(problem.num_real_vars() * (problem.num_real_vars()+1)/2 + 1);
84 
85problem.get_real_bounds(lower,upper);
86x0.resize((problem.num_real_vars()+1),max_nmins+1);
87f0.resize(max_nmins+1);
88 
89int nparams=problem.num_real_vars();
90/*
91cluster_gopt(lower,upper,nparams,m,num_samples,
92        num_selected,ucout,
93        nsig, max_nmins, x0, nc,f0,nfe,work);
94*/
95
96//
97// Setup best value of function
98//
99int ndx=0;
100for (int i=1; i<nc; i++)
101  if (f0[i] < f0[ndx]) ndx=i;
102for (unsigned int j=0; j<problem.num_real_vars(); j++)
103  best_point[j] = x0[j][ndx];
104best_val  = f0[ndx];
105}
106
107} // namespace interfaces
108
109#endif
Note: See TracBrowser for help on using the repository browser.