1 /* Siconos is a program dedicated to modeling, simulation and control
2  * of non smooth dynamical systems.
3  *
4  * Copyright 2021 INRIA.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17 */
18 
19 #include <assert.h>
20 #include "PathSearch.h"
21 #include "SolverOptions.h"  // for SolverOptions
22 #include "line_search.h"    // for ARCSEARCH, LINESEARCH, NM_LS_MEAN
23 #include "lcp_cst.h"
24 
pathsearch_set_default(SolverOptions * options)25 void pathsearch_set_default(SolverOptions* options)
26 {
27   options->iparam[SICONOS_IPARAM_LSA_NONMONOTONE_LS] = NM_LS_MEAN;
28   options->iparam[SICONOS_IPARAM_LSA_NONMONOTONE_LS_M] = 10;
29   options->iparam[SICONOS_IPARAM_PATHSEARCH_STACKSIZE] = 5;
30   options->iparam[SICONOS_IPARAM_NMS_WATCHDOG_TYPE] = LINESEARCH;
31   options->iparam[SICONOS_IPARAM_NMS_PROJECTED_GRADIENT_TYPE] = ARCSEARCH;
32   options->iparam[SICONOS_IPARAM_NMS_N_MAX] = 10;
33 
34   options->dparam[SICONOS_DPARAM_NMS_DELTA] = 20;
35   options->dparam[SICONOS_DPARAM_NMS_DELTA_VAR] = .8;
36   options->dparam[SICONOS_DPARAM_NMS_SIGMA] = .01;
37   options->dparam[SICONOS_DPARAM_NMS_ALPHA_MIN_WATCHDOG] = 1e-12;
38   options->dparam[SICONOS_DPARAM_NMS_ALPHA_MIN_PGRAD] = 1e-12;
39   options->dparam[SICONOS_DPARAM_NMS_MERIT_INCR] = 1.1; /* XXX 1.1 ?*/
40 
41   assert(options->numberOfInternalSolvers == 1);
42   options->internalSolvers[0] = solver_options_create(SICONOS_LCP_PIVOT);
43 
44   SolverOptions * lcp_options = options->internalSolvers[0];
45 
46   /* We always allocate once and for all since we are supposed to solve
47    * many LCPs */
48   lcp_options->iparam[SICONOS_IPARAM_PREALLOC] = 1;
49   /* set the right pivot rule */
50   lcp_options->iparam[SICONOS_LCP_IPARAM_PIVOTING_METHOD_TYPE] = SICONOS_LCP_PIVOT_PATHSEARCH;
51   /* set the right stacksize */
52   lcp_options->iparam[SICONOS_IPARAM_PATHSEARCH_STACKSIZE] = options->iparam[SICONOS_IPARAM_PATHSEARCH_STACKSIZE];
53 
54 
55 }
56 
57 
58