robotic 0.3.2__cp38-cp38-manylinux2014_x86_64.whl → 0.3.3.dev0__cp38-cp38-manylinux2014_x86_64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of robotic might be problematic. Click here for more details.
- robotic/__init__.py +4 -1
- robotic/_robotic.pyi +45 -34
- robotic/_robotic.so +0 -0
- robotic/include/rai/Algo/RidgeRegression.h +1 -1
- robotic/include/rai/Core/arrayDouble.h +15 -4
- robotic/include/rai/Core/util.h +3 -0
- robotic/include/rai/DataGen/rndStableConfigs.h +1 -0
- robotic/include/rai/Geo/geo.h +4 -4
- robotic/include/rai/Geo/mesh.h +5 -5
- robotic/include/rai/Geo/pairCollision.h +1 -1
- robotic/include/rai/Geo/signedDistanceFunctions.h +2 -3
- robotic/include/rai/KOMO/komo.h +2 -0
- robotic/include/rai/KOMO/komo_NLP.h +2 -2
- robotic/include/rai/KOMO/manipTools.h +4 -0
- robotic/include/rai/KOMO/testProblems_KOMO.h +0 -7
- robotic/include/rai/Kin/kin_physx.h +6 -4
- robotic/include/rai/Kin/simulation.h +9 -4
- robotic/include/rai/LGP/LGP_TAMP_Abstraction.h +33 -0
- robotic/include/rai/LGP/LGP_Tool.h +4 -25
- robotic/include/rai/LGP/LGP_computers2.h +196 -0
- robotic/include/rai/LGP/NLP_Descriptor.h +5 -0
- robotic/include/rai/Optim/BayesOpt.h +3 -3
- robotic/include/rai/Optim/GlobalIterativeNewton.h +1 -1
- robotic/include/rai/Optim/NLP.h +7 -5
- robotic/include/rai/Optim/SlackGaussNewton.h +0 -10
- robotic/include/rai/Optim/constrained.h +1 -1
- robotic/include/rai/Optim/gradient.h +8 -6
- robotic/include/rai/Optim/lagrangian.h +3 -2
- robotic/include/rai/Optim/lbfgs.h +18 -0
- robotic/include/rai/Optim/liblbfgs.h +755 -0
- robotic/include/rai/Optim/m_LeastSquaresZeroOrder.h +38 -0
- robotic/include/rai/Optim/newton.h +3 -3
- robotic/include/rai/Optim/opt-ceres.h +2 -2
- robotic/include/rai/Optim/options.h +3 -2
- robotic/include/rai/Optim/primalDual.h +1 -1
- robotic/include/rai/Optim/testProblems_Opt.h +20 -8
- robotic/include/rai/Optim/utils.h +20 -79
- robotic/include/rai/Perception/pcl.h +10 -10
- robotic/librai.so +0 -0
- robotic/meshTool +0 -0
- robotic/rai-robotModels/panda/panda.g +9 -9
- robotic/rai-robotModels/panda/panda_withoutCollisionModels.g +3 -11
- robotic/rai-robotModels/pr2/pr2.g +5 -5
- robotic/rai-robotModels/pr2/pr2_clean.g +19 -19
- robotic/rai-robotModels/robotiq/robotiq_clean.g +2 -2
- robotic/rai-robotModels/scenarios/liftRing.g +2 -2
- robotic/rai-robotModels/scenarios/pandaSingle.g +1 -1
- robotic/rai-robotModels/tests/arm.g +15 -16
- robotic/ry-h5info +3 -12
- robotic/src/h5_helper.py +20 -5
- robotic/src/h5_helper.py~ +42 -0
- robotic/version.py +1 -1
- robotic-0.3.3.dev0.data/scripts/ry-h5info +23 -0
- {robotic-0.3.2.dist-info → robotic-0.3.3.dev0.dist-info}/METADATA +9 -9
- {robotic-0.3.2.dist-info → robotic-0.3.3.dev0.dist-info}/RECORD +64 -58
- robotic/test.py +0 -15
- robotic-0.3.2.data/scripts/ry-h5info +0 -32
- {robotic-0.3.2.data → robotic-0.3.3.dev0.data}/scripts/ry-bot +0 -0
- {robotic-0.3.2.data → robotic-0.3.3.dev0.data}/scripts/ry-info +0 -0
- {robotic-0.3.2.data → robotic-0.3.3.dev0.data}/scripts/ry-meshTool +0 -0
- {robotic-0.3.2.data → robotic-0.3.3.dev0.data}/scripts/ry-test +0 -0
- {robotic-0.3.2.data → robotic-0.3.3.dev0.data}/scripts/ry-urdfConvert.py +0 -0
- {robotic-0.3.2.data → robotic-0.3.3.dev0.data}/scripts/ry-view +0 -0
- {robotic-0.3.2.dist-info → robotic-0.3.3.dev0.dist-info}/LICENSE +0 -0
- {robotic-0.3.2.dist-info → robotic-0.3.3.dev0.dist-info}/WHEEL +0 -0
- {robotic-0.3.2.dist-info → robotic-0.3.3.dev0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
/* ------------------------------------------------------------------
|
|
2
|
+
Copyright (c) 2011-2024 Marc Toussaint
|
|
3
|
+
email: toussaint@tu-berlin.de
|
|
4
|
+
|
|
5
|
+
This code is distributed under the MIT License.
|
|
6
|
+
Please see <root-path>/LICENSE for details.
|
|
7
|
+
-------------------------------------------------------------- */
|
|
8
|
+
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#include "../Search/ComputeNode.h"
|
|
12
|
+
#include "../Search/AStar.h"
|
|
13
|
+
#include "../Logic/folWorld.h"
|
|
14
|
+
#include "../Optim/NLP_GraphSolver.h"
|
|
15
|
+
#include "../PathAlgos/RRT_PathFinder.h"
|
|
16
|
+
#include "LGP_TAMP_Abstraction.h"
|
|
17
|
+
|
|
18
|
+
namespace rai {
|
|
19
|
+
|
|
20
|
+
//===========================================================================
|
|
21
|
+
|
|
22
|
+
struct LGP2_GlobalInfo {
|
|
23
|
+
RAI_PARAM("LGP/", int, verbose, 1)
|
|
24
|
+
RAI_PARAM("LGP/", double, skeleton_w0, 1.)
|
|
25
|
+
RAI_PARAM("LGP/", double, skeleton_wP, 2.)
|
|
26
|
+
RAI_PARAM("LGP/", double, waypoint_w0, 10.)
|
|
27
|
+
RAI_PARAM("LGP/", double, waypoint_wP, 2.)
|
|
28
|
+
RAI_PARAM("LGP/", int, waypointStopEvals, 1000)
|
|
29
|
+
RAI_PARAM("LGP/", int, rrtStopEvals, 10000)
|
|
30
|
+
RAI_PARAM("LGP/", double, rrtStepsize, .05)
|
|
31
|
+
RAI_PARAM("LGP/", double, rrtTolerance, .03)
|
|
32
|
+
RAI_PARAM("LGP/", double, pathCtrlCosts, 1.)
|
|
33
|
+
RAI_PARAM("LGP/", int, pathStepsPerPhase, 30)
|
|
34
|
+
RAI_PARAM("LGP/", double, collScale, 1e1)
|
|
35
|
+
RAI_PARAM("LGP/", bool, useSequentialWaypointSolver, false)
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
//===========================================================================
|
|
39
|
+
|
|
40
|
+
struct LGPComp2_root : ComputeNode {
|
|
41
|
+
// FOL_World& L;
|
|
42
|
+
Configuration& C;
|
|
43
|
+
LGP_TAMP_Abstraction& tamp;
|
|
44
|
+
// bool useBroadCollisions=false;
|
|
45
|
+
// StringA explicitCollisions;
|
|
46
|
+
// StringA explicitLift;
|
|
47
|
+
// String explicitTerminalSkeleton;
|
|
48
|
+
// std::shared_ptr<rai::AStar> fol_astar;
|
|
49
|
+
std::shared_ptr<LGP2_GlobalInfo> info;
|
|
50
|
+
bool fixedSkeleton=false;
|
|
51
|
+
|
|
52
|
+
LGPComp2_root(Configuration& _C, LGP_TAMP_Abstraction& _tamp, const StringA& explicitLift, const String& explicitTerminalSkeleton);
|
|
53
|
+
|
|
54
|
+
virtual void untimedCompute() {}
|
|
55
|
+
virtual int getNumDecisions() { return -1.; }
|
|
56
|
+
// virtual double effortHeuristic(){ return 11.+10.; }
|
|
57
|
+
virtual double branchingPenalty_child(int i);
|
|
58
|
+
|
|
59
|
+
virtual std::shared_ptr<ComputeNode> createNewChild(int i);
|
|
60
|
+
|
|
61
|
+
int verbose() { return info->verbose; }
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
//===========================================================================
|
|
65
|
+
|
|
66
|
+
struct LGPComp2_Skeleton : ComputeNode {
|
|
67
|
+
LGPComp2_root* root=0;
|
|
68
|
+
int num=0;
|
|
69
|
+
// Skeleton skeleton;
|
|
70
|
+
//shared_ptr<SkeletonSolver> sol;
|
|
71
|
+
// StringA actionSequence;
|
|
72
|
+
Array<StringA> actionSequence;
|
|
73
|
+
// Array<Graph*> states;
|
|
74
|
+
// arr times;
|
|
75
|
+
|
|
76
|
+
LGPComp2_Skeleton(LGPComp2_root* _root, int num);
|
|
77
|
+
// LGPComp2_Skeleton(LGPComp2_root* _root, const Skeleton& _skeleton);
|
|
78
|
+
|
|
79
|
+
void createNLPs(const rai::Configuration& C);
|
|
80
|
+
|
|
81
|
+
virtual void untimedCompute();
|
|
82
|
+
|
|
83
|
+
virtual int getNumDecisions() { return -1.; }
|
|
84
|
+
// virtual double branchingHeuristic(){ return root->info->waypoint_w0; }
|
|
85
|
+
// virtual double effortHeuristic(){ return 10.+10.; }
|
|
86
|
+
virtual double branchingPenalty_child(int i);
|
|
87
|
+
|
|
88
|
+
virtual std::shared_ptr<ComputeNode> createNewChild(int i);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
//===========================================================================
|
|
92
|
+
|
|
93
|
+
struct LGPComp2_FactorBounds: ComputeNode {
|
|
94
|
+
LGPComp2_Skeleton* sket;
|
|
95
|
+
int seed=0;
|
|
96
|
+
KOMO komoWaypoints;
|
|
97
|
+
std::shared_ptr<NLP_Factored> nlp;
|
|
98
|
+
uint t=0;
|
|
99
|
+
|
|
100
|
+
LGPComp2_FactorBounds(LGPComp2_Skeleton* _sket, int rndSeed);
|
|
101
|
+
|
|
102
|
+
virtual void untimedCompute();
|
|
103
|
+
// virtual double effortHeuristic(){ return 10.+1.*(komoWaypoints.T); }
|
|
104
|
+
virtual int getNumDecisions() { return 1; }
|
|
105
|
+
virtual std::shared_ptr<ComputeNode> createNewChild(int i);
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
//===========================================================================
|
|
109
|
+
|
|
110
|
+
struct LGPComp2_PoseBounds: ComputeNode {
|
|
111
|
+
LGPComp2_Skeleton* sket;
|
|
112
|
+
int seed=0;
|
|
113
|
+
uint t=0;
|
|
114
|
+
|
|
115
|
+
LGPComp2_PoseBounds(LGPComp2_Skeleton* _sket, int rndSeed);
|
|
116
|
+
|
|
117
|
+
virtual void untimedCompute();
|
|
118
|
+
// virtual double effortHeuristic(){ return 10.+1.*(sket->states.N); }
|
|
119
|
+
virtual int getNumDecisions() { return 1; }
|
|
120
|
+
virtual std::shared_ptr<ComputeNode> createNewChild(int i);
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
//===========================================================================
|
|
124
|
+
|
|
125
|
+
struct LGPComp2_Waypoints : ComputeNode {
|
|
126
|
+
LGPComp2_Skeleton* sket;
|
|
127
|
+
int seed=0;
|
|
128
|
+
std::shared_ptr<KOMO> komoWaypoints;
|
|
129
|
+
NLP_Solver sol;
|
|
130
|
+
NLP_GraphSolver gsol;
|
|
131
|
+
|
|
132
|
+
LGPComp2_Waypoints(LGPComp2_Skeleton* _sket, int rndSeed);
|
|
133
|
+
|
|
134
|
+
virtual void untimedCompute();
|
|
135
|
+
// virtual double effortHeuristic(){ return 10.+1.*(komoWaypoints->T); }
|
|
136
|
+
virtual int getNumDecisions();
|
|
137
|
+
virtual std::shared_ptr<ComputeNode> createNewChild(int i);
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
//===========================================================================
|
|
141
|
+
|
|
142
|
+
struct LGPComp2_RRTpath : ComputeNode {
|
|
143
|
+
LGPComp2_Waypoints* ways=0;
|
|
144
|
+
LGPComp2_RRTpath* prev=0;
|
|
145
|
+
|
|
146
|
+
shared_ptr<Configuration> C;
|
|
147
|
+
uint t;
|
|
148
|
+
shared_ptr<RRT_PathFinder> rrt;
|
|
149
|
+
arr q0, qT;
|
|
150
|
+
arr path;
|
|
151
|
+
|
|
152
|
+
LGPComp2_RRTpath(ComputeNode* _par, LGPComp2_Waypoints* _ways, uint _t);
|
|
153
|
+
|
|
154
|
+
virtual void untimedCompute();
|
|
155
|
+
// virtual double effortHeuristic(){ return 10.+1.*(ways->komoWaypoints->T-t-1); }
|
|
156
|
+
|
|
157
|
+
virtual int getNumDecisions() { return 1; }
|
|
158
|
+
virtual std::shared_ptr<ComputeNode> createNewChild(int i);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
//===========================================================================
|
|
162
|
+
|
|
163
|
+
struct LGPComp2_OptimizePath : ComputeNode {
|
|
164
|
+
LGPComp2_Skeleton* sket=0;
|
|
165
|
+
LGPComp2_Waypoints* ways=0;
|
|
166
|
+
|
|
167
|
+
shared_ptr<KOMO> komoPath;
|
|
168
|
+
NLP_Solver sol;
|
|
169
|
+
|
|
170
|
+
LGPComp2_OptimizePath(LGPComp2_Skeleton* _sket); //compute path from skeleton directly, without waypoints first
|
|
171
|
+
LGPComp2_OptimizePath(LGPComp2_Waypoints* _ways); //compute path initialized from waypoints
|
|
172
|
+
LGPComp2_OptimizePath(LGPComp2_RRTpath* _par, LGPComp2_Waypoints* _ways); //compute path initialized from series of RRT solutions
|
|
173
|
+
|
|
174
|
+
virtual void untimedCompute();
|
|
175
|
+
// virtual double effortHeuristic(){ return 0.; }
|
|
176
|
+
|
|
177
|
+
virtual double sample() {
|
|
178
|
+
CHECK(sol.ret, "");
|
|
179
|
+
CHECK(sol.ret->done, "");
|
|
180
|
+
if(sol.ret->ineq>1. || sol.ret->eq>4.) return 1e10;
|
|
181
|
+
return sol.ret->ineq+sol.ret->eq;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// if(opt.verbose>0) LOG(0) <<*ret;
|
|
185
|
+
// if(opt.verbose>1) cout <<komoPath.report(false, true, opt.verbose>2);
|
|
186
|
+
// if(opt.verbose>0) komoPath.view(opt.verbose>1, STRING("optimized path\n" <<*ret));
|
|
187
|
+
// //komoPath.checkGradients();
|
|
188
|
+
// if(opt.verbose>1) komoPath.view_play(opt.verbose>2);
|
|
189
|
+
|
|
190
|
+
virtual int getNumDecisions() { return 0; }
|
|
191
|
+
virtual std::shared_ptr<ComputeNode> createNewChild(int i) { HALT("is terminal"); }
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
//===========================================================================
|
|
195
|
+
|
|
196
|
+
}//namespace
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#include "../Core/array.h"
|
|
13
13
|
|
|
14
14
|
struct BayesOpt {
|
|
15
|
-
ScalarFunction f;
|
|
15
|
+
ScalarFunction& f;
|
|
16
16
|
arr bounds;
|
|
17
17
|
|
|
18
18
|
arr data_X;
|
|
@@ -29,12 +29,12 @@ struct BayesOpt {
|
|
|
29
29
|
double lengthScale;
|
|
30
30
|
|
|
31
31
|
//lengthScale is always relative to hi-lo
|
|
32
|
-
BayesOpt(
|
|
32
|
+
BayesOpt(ScalarFunction& f, const arr& bounds, rai::OptOptions& opt, double init_lengthScale=1., double prior_var=1.);
|
|
33
33
|
~BayesOpt();
|
|
34
34
|
|
|
35
35
|
void step();
|
|
36
36
|
void run(uint maxIt=10);
|
|
37
|
-
void report(bool display
|
|
37
|
+
void report(bool display, ScalarFunction& f);
|
|
38
38
|
|
|
39
39
|
private:
|
|
40
40
|
void addDataPoint(const arr& x, double y); //and update the regressions
|
|
@@ -21,7 +21,7 @@ struct GlobalIterativeNewton {
|
|
|
21
21
|
rai::Array<LocalMinimum> localMinima;
|
|
22
22
|
LocalMinimum* best;
|
|
23
23
|
|
|
24
|
-
GlobalIterativeNewton(
|
|
24
|
+
GlobalIterativeNewton(ScalarFunction& f, const arr& bounds, rai::OptOptions& opt);
|
|
25
25
|
~GlobalIterativeNewton();
|
|
26
26
|
|
|
27
27
|
void step();
|
robotic/include/rai/Optim/NLP.h
CHANGED
|
@@ -74,6 +74,8 @@ struct NLP : rai::NonCopyable {
|
|
|
74
74
|
return d;
|
|
75
75
|
}
|
|
76
76
|
arr summarizeErrors(const arr& phi);
|
|
77
|
+
|
|
78
|
+
shared_ptr<rai::NonCopyable> obj;
|
|
77
79
|
};
|
|
78
80
|
|
|
79
81
|
//===========================================================================
|
|
@@ -169,7 +171,7 @@ struct SolverReturn {
|
|
|
169
171
|
uint evals=0;
|
|
170
172
|
double time=0.;
|
|
171
173
|
bool feasible=false;
|
|
172
|
-
double sos
|
|
174
|
+
double sos=0., f=0., ineq=0., eq=0.;
|
|
173
175
|
bool done=false;
|
|
174
176
|
void write(ostream& os) const;
|
|
175
177
|
};
|
|
@@ -178,11 +180,11 @@ stdOutPipe(SolverReturn)
|
|
|
178
180
|
//===========================================================================
|
|
179
181
|
// TRIVIAL only header
|
|
180
182
|
|
|
181
|
-
struct
|
|
183
|
+
struct Conv_NLP2TrivialFactoredNLP : NLP_Factored {
|
|
182
184
|
shared_ptr<NLP> P;
|
|
183
185
|
arr x_buffer;
|
|
184
186
|
|
|
185
|
-
|
|
187
|
+
Conv_NLP2TrivialFactoredNLP(const shared_ptr<NLP>& P) : P(P) {
|
|
186
188
|
copySignature(*P);
|
|
187
189
|
variableDimensions = { dimension };
|
|
188
190
|
featureDimensions = { featureTypes.N };
|
|
@@ -197,7 +199,7 @@ struct Conv_NLP_TrivialFactoreded : NLP_Factored {
|
|
|
197
199
|
|
|
198
200
|
//===========================================================================
|
|
199
201
|
|
|
200
|
-
struct
|
|
202
|
+
struct Conv_FactoredNLP2BandedNLP : NLP {
|
|
201
203
|
shared_ptr<NLP_Factored> P;
|
|
202
204
|
uint maxBandSize;
|
|
203
205
|
bool sparseNotBanded;
|
|
@@ -205,7 +207,7 @@ struct Conv_FactoredNLP_BandedNLP : NLP {
|
|
|
205
207
|
//buffers
|
|
206
208
|
arrA J_i;
|
|
207
209
|
|
|
208
|
-
|
|
210
|
+
Conv_FactoredNLP2BandedNLP(const shared_ptr<NLP_Factored>& P, uint _maxBandSize, bool _sparseNotBanded=false);
|
|
209
211
|
|
|
210
212
|
// trivial
|
|
211
213
|
virtual arr getInitializationSample() { return P->getInitializationSample(); }
|
|
@@ -16,16 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
namespace rai {
|
|
18
18
|
|
|
19
|
-
struct SlackGaussNewton_Options {
|
|
20
|
-
RAI_PARAM("sam/", double, tolerance, .01)
|
|
21
|
-
RAI_PARAM("sam/", double, margin, .0)
|
|
22
|
-
RAI_PARAM("sam/", int, verbose, 2)
|
|
23
|
-
|
|
24
|
-
RAI_PARAM("sam/", int, maxEvals, 50)
|
|
25
|
-
RAI_PARAM("sam/", double, stepMax, .1)
|
|
26
|
-
RAI_PARAM("sam/", double, damping, 1e-2)
|
|
27
|
-
};
|
|
28
|
-
|
|
29
19
|
struct SlackGaussNewton {
|
|
30
20
|
OptOptions opt;
|
|
31
21
|
std::shared_ptr<NLP> nlp;
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
|
|
19
19
|
struct OptGrad {
|
|
20
20
|
arr& x;
|
|
21
|
-
ScalarFunction f;
|
|
21
|
+
ScalarFunction& f;
|
|
22
22
|
rai::OptOptions o;
|
|
23
23
|
|
|
24
24
|
enum StopCriterion { stopNone=0, stopCrit1, stopCrit2, stopCritLineSteps, stopCritEvals, stopStepFailed };
|
|
@@ -29,14 +29,14 @@ struct OptGrad {
|
|
|
29
29
|
StopCriterion stopCriterion;
|
|
30
30
|
ofstream fil;
|
|
31
31
|
|
|
32
|
-
OptGrad(arr& x,
|
|
32
|
+
OptGrad(arr& x, ScalarFunction& f, rai::OptOptions o=DEFAULT_OPTIONS);
|
|
33
33
|
~OptGrad();
|
|
34
34
|
StopCriterion step();
|
|
35
35
|
StopCriterion run(uint maxIt = 1000);
|
|
36
36
|
void reinit(const arr& _x=NoArr);
|
|
37
37
|
};
|
|
38
38
|
|
|
39
|
-
inline int optGrad(arr& x,
|
|
39
|
+
inline int optGrad(arr& x, ScalarFunction& f, rai::OptOptions opt=DEFAULT_OPTIONS) {
|
|
40
40
|
return OptGrad(x, f, opt).run();
|
|
41
41
|
}
|
|
42
42
|
|
|
@@ -48,14 +48,16 @@ inline int optGrad(arr& x, const ScalarFunction& f, rai::OptOptions opt=DEFAULT_
|
|
|
48
48
|
/** Rprop, a fast gradient-based minimization */
|
|
49
49
|
struct Rprop {
|
|
50
50
|
unique_ptr<struct sRprop> self;
|
|
51
|
+
double fx;
|
|
52
|
+
uint evals;
|
|
51
53
|
Rprop();
|
|
52
54
|
~Rprop();
|
|
53
55
|
void init(double initialStepSize=1., double minStepSize=1e-6, double stepMaxSize=50.);
|
|
54
|
-
bool step(arr& x,
|
|
55
|
-
uint loop(arr& x,
|
|
56
|
+
bool step(arr& x, ScalarFunction& f);
|
|
57
|
+
uint loop(arr& x, ScalarFunction& f, double stoppingTolerance=1e-2, double initialStepSize=1., uint maxIterations=1000, int verbose=0);
|
|
56
58
|
};
|
|
57
59
|
|
|
58
|
-
inline uint optRprop(arr& x,
|
|
60
|
+
inline uint optRprop(arr& x, ScalarFunction& f, rai::OptOptions opt=DEFAULT_OPTIONS) {
|
|
59
61
|
return Rprop().loop(x, f, opt.stopTolerance, opt.stepInit, opt.stopEvals, opt.verbose);
|
|
60
62
|
}
|
|
61
63
|
|
|
@@ -34,13 +34,14 @@ struct LagrangianProblem : ScalarFunction, NLP {
|
|
|
34
34
|
arr x; ///< point where P was last evaluated
|
|
35
35
|
arr phi_x, J_x, H_x; ///< features at x
|
|
36
36
|
|
|
37
|
-
LagrangianProblem(const shared_ptr<NLP>& P, const rai::OptOptions& opt);
|
|
37
|
+
LagrangianProblem(const shared_ptr<NLP>& P, const rai::OptOptions& opt, double muSquaredPenalty=-1., double muLogBarrier=-1.);
|
|
38
38
|
|
|
39
39
|
virtual void evaluate(arr& phi, arr& J, const arr& x); //evaluate all features and (optionally) their Jacobians for state x
|
|
40
40
|
virtual void getFHessian(arr& H, const arr& x); //the Hessian of the sum of all f-features (or Hessian in addition to the Gauss-Newton Hessian of all other features)
|
|
41
41
|
virtual arr getInitializationSample() { return P->getInitializationSample(); }
|
|
42
|
+
virtual void report(ostream &os, int verbose, const char *msg){ P->report(os, verbose, msg); }
|
|
42
43
|
|
|
43
|
-
double
|
|
44
|
+
double f(arr& dL, arr& HL, const arr& x); ///< CORE METHOD: the unconstrained scalar function F
|
|
44
45
|
|
|
45
46
|
rai::Graph reportGradients(const StringA& featureNames);
|
|
46
47
|
void reportMatrix(std::ostream& os);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#pragma once
|
|
2
|
+
|
|
3
|
+
#include "NLP.h"
|
|
4
|
+
#include "options.h"
|
|
5
|
+
|
|
6
|
+
struct OptLBFGS{
|
|
7
|
+
ScalarFunction& f;
|
|
8
|
+
uint dimension;
|
|
9
|
+
arr& x;
|
|
10
|
+
rai::OptOptions opt;
|
|
11
|
+
|
|
12
|
+
OptLBFGS(arr& x, ScalarFunction& f, rai::OptOptions o=DEFAULT_OPTIONS);
|
|
13
|
+
|
|
14
|
+
std::shared_ptr<SolverReturn> solve();
|
|
15
|
+
|
|
16
|
+
//private:
|
|
17
|
+
arr g;
|
|
18
|
+
};
|