Index
+ +_
+A
++ | + |
B
+C
+D
+E
++ | + |
F
++ | + |
G
++ | + |
H
++ |
I
+J
++ |
K
++ |
L
++ | + |
M
+N
++ | + |
O
+
|
+
|
+
P
+R
+S
+T
+V
++ |
W
+X
++ | + |
Z
++ |
' + + '' + + _("Hide Search Matches") + + "
" + ) + ); + }, + + /** + * helper function to hide the search marks again + */ + hideSearchWords: () => { + document + .querySelectorAll("#searchbox .highlight-link") + .forEach((el) => el.remove()); + document + .querySelectorAll("span.highlighted") + .forEach((el) => el.classList.remove("highlighted")); + localStorage.removeItem("sphinx_highlight_terms") + }, + + initEscapeListener: () => { + // only install a listener if it is really needed + if (!DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS) return; + + document.addEventListener("keydown", (event) => { + // bail for input elements + if (BLACKLISTED_KEY_CONTROL_ELEMENTS.has(document.activeElement.tagName)) return; + // bail with special keys + if (event.shiftKey || event.altKey || event.ctrlKey || event.metaKey) return; + if (DOCUMENTATION_OPTIONS.ENABLE_SEARCH_SHORTCUTS && (event.key === "Escape")) { + SphinxHighlight.hideSearchWords(); + event.preventDefault(); + } + }); + }, +}; + +_ready(() => { + /* Do not call highlightSearchWords() when we are on the search page. + * It will highlight words from the *previous* search query. + */ + if (typeof Search === "undefined") SphinxHighlight.highlightSearchWords(); + SphinxHighlight.initEscapeListener(); +}); diff --git a/api-dox/html/genindex.html b/api-dox/html/genindex.html new file mode 100644 index 00000000..f331085b --- /dev/null +++ b/api-dox/html/genindex.html @@ -0,0 +1,1289 @@ + + + + + ++ | + |
+ | + |
+ | + |
+ | + |
+ |
+ |
+ |
+ | + |
+ | + |
|
+
|
+
+ |
+ | + |
+ |
This is the opengen API documentation. Check out the main OpEn documentation page to get started with OpEn.
+You can get a list of all modules here.
+Last updated: Thu Jul 25 13:20:51 UTC 2024
+Bases: object
Builder for code generation
+This class is a builder that can be used to generate +code for a parametric optimizer.
+Constructor of OpEnOptimizerBuilder
+problem – instance of Problem
metadata – instance of OptimizerMeta
build_configuration – instance of BuildConfiguration
solver_configuration – instance of SolverConfiguration
New instance of OpEnOptimizerBuilder
.
Generate code and build project
+Exception – if the build process fails
Exception – if there some parameters have wrong, inadmissible or incompatible values
Dictionary with information that can be used for debugging
+This method is deprecated and should not be used
+This method will be removed in a future release! +Use BuildConfiguration.with_tcp_interface_config instead
+Whether to build (or just generate code)
+If set to true, the code will be generated, but it will not be +build (mainly for debugging purposes)
+flag – generate and not build
+Current builder object
+Specify problem
+problem – optimization problem data
+Current builder object
+Specify the verbosity level
+verbosity_level – level of verbosity (0,1,2,3)
+Current builder object
+Bases: object
Definition of an optimization problem
+Provides the cost function, constraints and additional +ALM/penalty-type constraints.
+Construct an optimization problem
++++
+- param u:
+- +
decision variable (CasADi variable)
+- param p:
+- +
parameter (CasADi variable)
+- param cost:
+- +
cost function (CasADi function of u and p)
+
>>> import casadi.casadi as cs
+>>> import opengen as og
+>>> # Define u and p
+>>> u = cs.SX.sym('u', 5)
+>>> p = cs.SX.sym('p', 2)
+>>> # Cost function
+>>> phi = og.functions.rosenbrock(u, p)
+>>> # Define optimization problem
+>>> problem = og.builder.Problem(u, p, phi)
+
Set C in the definition of constraints: F1(u, p) in C
+Set Y for the Lagrange multipliers
+Hard constraints; set U
+Cost function as a CaADi symbol
+Decision variables (CasADi symbol)
+Not implemented yet
+Number of penalty-type constraints
+Number of decision variables
+number of decision variables
+Number of parameters
+Parameter variables (CasADi symbol)
+Penalty function, g
+ALM mapping F1 as a CasADi symbol
+Penalty-type mapping F2 as a CasADi symbol
+Preconditioning coefficients w = (w_cost, w1, w2)
+Vector of preconditioning coefficients of F1 (ALM constraints) +This is a CasADi symbol (SX or MX)
+Vector of preconditioning coefficients of F2 (PM constraints) +This is a CasADi symbol (SX or MX)
+Preconditioning coefficient of the cost function +This is a CasADi symbol (SX or MX)
+Constraints: F1(u, p) in C
+mapping_f1 – mapping of the form F1: R^{n} x R^{p} –> R^{n1}
set_c – a convex closed set C
set_y – a compact subset of C*, the convex conjugate of C
Current object (self)
+Specify or update the constraints of the problem
+constraints on the decision variable;
+must be a Constraint object (such as opengen.constraints.ball2.Ball2
+and opengen.constraints.rectangle.Rectangle
)
Current object
+Constraints to for the penalty method
+Specify the constraints to be treated with the penalty method (that is, +function F2(u; p))
+penalty_constraints – a function c(u, p), of the decision +variable u and the parameter vector p, which +corresponds to the constraints c(u, p)
+Current object (self)
+Bases: object
Code generation for ROS-related files
+For internal use
+Build ROS-related files
+Bases: object
This class is intended for internal use by the solver
+A large number
+Construct a set Y calculator given set C
+Computes and returns set Y
+The computation of Y is supported only when C is a rectangle or a compact set
+set Y
+Bases: object
Build configuration
+Configuration for the code generator
+Debug mode (fast compilation, worse performance)
+Release mode (great performance, very slow compilation)
+Construct an instance of BuildConfiguration
+build_dir – Target directory, defaults to the current directory
+A new instance of BuildConfiguration
+Memory allocator for generated Rust solver
+Whether to build C bindings
+Directory in which the auto-generated optimizer will be stored
+Build mode (RELEASE_MODE
+or DEBUG_MODE
)
Whether to build Python bindings
+Local path of OpEn (if any)
+OpEn version used with the auto-generated solver
+The method returns either a specific version of OpEn, +which will be used with the auto-generated optimizer, or None, +in which case, the latest version will be used. You may set your +preferred version of OpEn with with_open_version
+Whether to re-build the optimizer from scratch
+ROS package configuration
+instance of RosConfiguration
+Target system
+See also: with_target_system
Whether to build a TCP interface
+Specify a Rust memory allocator.
+With this method the user can choose an alternative memory allocator +such as jemalloc and rpalloc. For example, if you choose jemalloc +as your memory allocator, the autogenerated project will have a +Cargo.toml file where optimization-engine is loaded as a dependency +with the “jem” feature.
+allocator – allocator; instance of RustAllocator
+current instance of BuildConfiguration
+If activated, OpEn will generate C/C++ bindings for the +auto-generated solver
+build_c_bindings – whether to build C/C++ bindings for +auto-generated solver; default: True, i.e., it suffices +to call build_config.with_build_c_bindings() instead of +build_config.with_build_c_bindings(True)
+current instance of BuildConfiguration
+Specify the build directory
+build_dir – build directory as string
+current instance of BuildConfiguration
+Set the build mode (debug/release)
+build_mode – Choose either ‘debug’ or ‘release’; the former is +fast, but suboptimal, while the latter may take a while to compile, +but the generated binary is significantly faster
+current instance of BuildConfiguration
+If activated, OpEn will generate python bindings for the +auto-generated solver
+build_python_bindings – whether to build python bindings for +auto-generated solver; default: True, i.e., it suffices +to call build_config.with_build_python_bindings() instead of +build_config.with_build_python_bindings(True)
+current instance of BuildConfiguration
+Specify the version of OpEn to link to
+open_version – version of OpEn (in case you want to +compile with an older version of OpEn; if not, the latest +version of OpEn will be used)
local_path – you can compile using a local version +of OpEn. In that case, you need to provide the full absolute +path to that local OpEn directory. This option is intended for +developers.
current instance of BuildConfiguration
+Whether to clean and rebuild the code generator, if it already exists
+do_rebuild – if set to True, the target code generator +will be cleaned and rebuilt from scratch
+current instance of BuildConfiguration
+Activates the generation of a ROS package. The caller must provide an +instance of RosConfiguration
+ros_config – Configuation of ROS package
+current instance of BuildConfiguration
+Specify the target system
+target_system – target system as string (e.g., use +“arm-unknown-linux-gnueabihf” or “rpi” for Raspberry Pi). +Note that you must have installed the target using rustup +if you need to cross-compile.
+current instance of BuildConfiguration
+Specify a TCP server configuration object
+tcp_interface_config – Custom TCP server configuration
+current instance of BuildConfiguration
+Bases: Enum
Memory Allocator for the auto-generated project
+Default allocator
+Memory allocator: jemalloc
+Jemalloc is a generic implementation of malloc that emphasises fragmentation +avoidance
+Memory allocator: rpmalloc
+Rpmalloc is a very efficient lock-free thread caching 16-byte aligned +memory allocator implemented in C.
+Bases: object
Metadata of auto-generated parametric optimizer
+General metadata for the auto-generated optimizer
+The most important piece of information is the name of the +optimizer. The optimizer will be stored in a namesake folder +inside the target build directory.
+Constructor of OptimizerMeta
+optimizer_name – optimizer name (default: open_optimizer)
optimizer_version – version (default: 0.0.0)
optimizer_licence – licence name or URL (default: MIT)
optimizer_authors – list of authors, as list of strings (default: [“John Smith”])
The current instance of OptimizerMeta
+>>> import opengen as og
+>>> meta = og.config.OptimizerMeta() \
+>>> .with_version("0.0.2") \
+>>> .with_authors(["P. Sopasakis", "E. Fresk"]) \
+>>> .with_licence("CC4.0-By") \
+>>> .with_optimizer_name("wow_optimizer")
+
List of authors of optimizer
+Licence of optimizer +:meta private:
+Name of optimizer
+Version of optimizer
+Specify list of authors
+optimizer_authors – list of authors
+The current instance of OptimizerMeta
+Specify licence of auto-generated code
+optimizer_licence – licence name (e.g., MIT) or licence URL
+The current instance of OptimizerMeta
+Specify the name of the optimizer
+optimizer_name – name of build, may only contain letters, +numbers and underscores, and may not start with a number
+The current instance of OptimizerMeta
+Specify version
+Specify the version of the auto-generated optimizer.
+optimizer_version – version of auto-generated optimizer
+The current instance of OptimizerMeta
+Bases: object
Configuration of auto-generated ROS package
+Constructor of an instance of RosConfiguration
+Description of ROS package (in package.xml
)
description
+Node name (default: ros_node_optimizer)
+node name
+Package name
+package name (default: ‘open_ros’)
+Size of “parameter” topic queue
+parameter topic name, defaults to 100
+Name of publisher sub-topic (default: “result”)
+publisher sub-topic
+ROS node rate in Hz
+rate, defaults to 10.0
+Size of “result” topic
+result topic name, defaults to 100
+Name of subscriber sub-topic
+subscriber sub-topic, defaults to “parameters”
+Set the description of the ROS package
+description (string) – description, defaults to “parametric optimization with OpEn”
+current object
+Set the node name. The node name can contain lowercase +and uppercase characters and underscores, but not spaces +or other symbols
+node_name (str) – name of node, defaults to “ros_node_optimizer”
+current object
+ValueError – if node_name is not a legal node name
+Set the package name, which is the same as the name +of the folder that will store the auto-generated ROS node. +The node name can contain lowercase and uppercase +characters and underscores, but not spaces or other symbols
+pkg_name (str) – package name, defaults to “open_ros”
+current object
+ValueError – if pkg_name is not a legal package name
+The auto-generated node will output its results to the topic +~/{publisher_subtopic}. The subtopic (publisher_subtopic) +can be specified using this method. The default subtopic name +is ‘result’. This can be configured after the package is +generated, in config/open_params.yaml.
+publisher_subtopic (str) – publisher sub-topic name, defaults to “result”
+current object
+Set queue sizes for ROS node
+result_topic_queue_size (int, optional) – queue size of results, defaults to 100
parameter_topic_queue_size (int, optional) – queue size of topic, defaults to 100
current object
+Set the rate of the ROS node
+rate (float) – rate in Hz
+current object
+The auto-generated node will listen for input at
+~/{subscriber_subtopic}
. The subtopic (subscriber_subtopic)
+can be specified using this method. The default subtopic name
+is ‘parameters’. This can be configured after the package is
+generated, in config/open_params.yaml.
subscriber_subtopic (str) – subscriber sub-topic name
+current object
+Bases: object
Configuration of solver parameters
+Construct an instance of solver configuration parameters
+New instance of SolverConfiguration
+Tolerance on the satisfaction of the constraints
+Initial penalty
+Initial tolerance of inner solver
+“Update factor for inner tolerance
+LBFGS memory for the inner solver
+Maximum execution time in microseconds
+Integer value
+Maximum number of iterations for the inner solver
+Maximum number of iterations for the outer solver
+Multiplicative factor for the update of the penalty weights
+Whether an automatic preconditioning should be applied
+True iff preconditioning is active
+Sufficient decrease coefficient
+Tolerance of inner solver
+Specify the CBFGS parameters alpha and epsilon
+alpha – CBFGS parameter alpha
epsilon – CBFGS parameter epsilon
sy_epsilon – Tolerance on the s-y inner product
the current object
+Tolerance on constraint violation
+constraints_tolerance – tolerance delta (related to constraint violation)
+the current object
+Initial penalty
+If preconditioning is activated, then the initial penalty is computed internally +following the recommendations of the book of Brigin and Martinez (Chapter 12). +If you enable the preconditioning and you use this method, then you will be +overriding the value of the initial penalty.
+If preconditioning is not enabled, you can set the initial penalty using this +method; if you don’t do so, the solver will use the default value (which is 1.0).
+initial_penalty – initial value of penalty
+The current object
+Specify the initial tolerance
+initial_tolerance – initial tolerance
+The current object
+Tolerance update factor
+The tolerance is initially given by
+with_initial_tolerance()
+and it is then updated by this update factor until the target tolerance
+which is given by
+with_tolerance()
Specify L-BFGS memory
+lbfgs_memory – LBFGS memory
+It is required that the L-BFGS memory is larger than or +equal to 2, otherwise an Exception is raised
+Returns the current instance of SolverConfiguration
+Specify the maximum duration in microseconds (must be an integer)
+The solver will interrupt the computation after this time limit and +will return the current iterate.
+max_duration_micros – maximum execution duration in microseconds (integer)
+Exception: if max_duration_micros is less than 1
+The current object
+Maximum number of inner iterations
+max_iters – maximum number of iterations
+The current object
+Maximum number of outer iterations
+max_outer_iterations – maximum number of outer iterations
+the current object
+Penalty update factor
+At every outer iteration of the penalty method, the weights are +multiplied by this factor.
+penalty_weight_update_factor – penalty weight update factor
+Exception, if the update factor is less than 1.0
+the current object
+Whether to apply preconditioning using the approach of [1]
+Note that this overrides the computation of the initial penalty
+Note also that unless this method is called, no preconditioning is +applied (this may change in a future release; we may make enable +preconditioning by default)
+[1] E.G. Birgin and J.M. Martinez, Practical Augmented Lagrangian +Methods for Constrained Optimization, SIAM, 2014
+do_preconditioning – whether to precondition
+the current object
+Specify the sufficient decrease coefficient of the algorithm
++++
+- param sufficient_decrease_coefficient:
+- +
sufficient decrease coefficient
+- returns:
+- +
The current object
+
Specify tolerance
+tolerance – tolerance
+Exception: if tolerance <= 0
+The current object
+Bases: object
TCP server configuration
+Configuration of the TCP server
+bind_ip – IP address of generated TCP server. The default +value is “127.0.0.1” (localhost). Use “0.0.0.0” for the generated +TCP server to bind on all IPs.
bind_port – Port on which the generated TCP server will bind. +The default is 8333. Make sure you use an available port and avoid using +privileged ports (i.e., 1 to 1024), well-known ports that are potentially +used by other services and you should also avoid ephemeral ports +(32768 to 65535 on Linux, 1025 to 5000 on Windows)
new instance of TcpServerConfiguration, which can then be +provided to an instance of OpEnOptimizerBuilder via enable_tcp_interface
+IP at which the TCP server should bind, as a string
+TCP server IP
+Port at which the TCP server should bind, as int
+TCP server port
+Bases: Constraint
Ball1 aka Norm-1 Ball
+Ball-1 with given radius, that is
+\(\mathcal{B}_{1}(x_0, r) = \{x\in{\rm I\!R}^n {}:{} \|x - x_0\|_1 \leq r\}\)
+Constructor for a Ball1
+radius – ball radius (default: 1)
+New instance of Ball1 with given radius
+Returns the center of the ball
+Squared distance of a given point to the set
+u – given point
+squared distance
+float
+Whether the set is compact
+Whether the set is convex
+Project on the current Ball-1
+u – vector u
+projection of u onto the current ball-1
+Returns the radius of this ball
+Bases: Constraint
A Euclidean ball constraint
+A constraint of the form \(\|u-u_0\| \leq r\), where \(u_0\) is the center +of the ball and r is its radius
+Constructor for a Euclidean ball constraint
+center – center of the ball; if this is equal to Null, the +ball is centered at the origin
radius – radius of the ball
New instance of Ball2 with given center and radius
+Returns the center of the ball
+Computes the squared distance between a given point u and this ball
+u – given point; can be a list of float, a numpy +n-dim array (ndarray) or a CasADi SX/MX symbol
+distance from set as a float or a CasADi symbol
+Whether the set is compact
+Whether the set is convex
+Project a given point onto the set
+u – given point
+projection of u onto this set
+Returns the radius of the ball
+Bases: Constraint
Norm-ball of norm infinity translated by given vector
+Centered inf-ball around given point, that is
+\(\mathcal{B}_{\infty}(x_0, r) = \{x\in{\rm I\!R}^n {}:{} \|x - x_0\|_{\infty} \leq r\}\)
+Constructor for an infinity ball constraint
+center – center of the ball; if this is equal to Null, the +ball is centered at the origin
radius – radius of the ball
New instance of Ballinf with given center and radius
+Returns the center of the ball
+Squared distance of a given point to the set
+u – given point
+squared distance
+float
+Whether the set is compact
+Whether the set is convex
+Project a given point onto the set
+u – given point
+projection of u onto this set
+Returns the radius of the ball
+Bases: Constraint
Cartesian product
+\(X = X_1 \times X_1 \times \ldots \times X_s.\)
+Construct a Cartesian product of constraints by providing a list of sets +and their dimensions as follows: an n-dimensional vector x can be partitioned +into subvectors as \(x = (x_{[1]}, x_{[2]}, ..., x_{[s]})\), where each +\(x_{[i]}\) has dimension \(m_i\).
+For example consider the 5-dimensional vector \(x = (x_0, x_1, x_2, x_3, x_4)\), +which can be partitioned into \(x_{[1]} = (x_0, x_1)\) and \(x_{[2]} = (x_2, x_3, x_4)\). +We can associate with \(x_{[1]}\) the indices [0, 1] and with \(x_{[2]}\) the indices [2, 3, 4]. +The segment ids are the indices 1 and 4.
+In this example we shall define the set \(X = \mathcal{B}_{1.5} \times R \times {\rm I\!R}^{5}\), +where \(\mathcal{B}_{1.5}\) is a Euclidean ball of dimension 2 with radius 1.5, \(R\) is a +3-dimensional rectangle with \(x_{\min} = (-1, -2, -3)\) and \(x_{\max} = (0, 10, -1)\). +Here the segments are [1, 4, 9].
+>>> ball = og.constraints.Ball2(None, 1.5)
+>>> rect = og.constraints.Rectangle(xmin=[-1,-2,-3], xmax=[0, 10, -1])
+>>> free = og.constraints.NoConstraints()
+>>> segment_ids = [1, 4, 9]
+>>> my_set = og.constraints.CartesianProduct(segment_ids, [ball, rect, free])
+
segments – ids of segments
constraints – list of sets
list of constraints comprising the current instance of CartesianProduct
+Squared distance of given vector, u, from the current instance of +CartesianProduct
+u – vector u
+squared distance (float)
+Whether the set is compact
+Whether the set is convex
+Project a given point onto the set
+u – given point
+projection of u onto this set
+Dimension of segment i
+i – index of segment (starts at 0)
+dimension of i-th index
+list of segments
+Bases: object
Squared distance of a given point to the set
+u – given point
+squared distance
+float
+Whether the set is compact
+Whether the set is convex
+Project a given point onto the set
+u – given point
+projection of u onto this set
+Bases: Constraint
Finite set
+A set of the form \(A = \{a_1, a_2, \ldots, a_K\}\)
+Constructor for a finite set
+points (list of lists) – the elements of the set
+Cardinality of the set
+Dimension of the set
+Squared distance of a given point to the set
+u – given point
+squared distance
+float
+Whether the set is compact
+Whether the set is convex
+List of points of this set
+Project a given point onto the set
+u – given point
+projection of u onto this set
+Bases: Constraint
Halfspace constraint
+A halfspace is a set of the form \(H = \{c^\intercal x \leq b\}\), where c is a given +vector and b is a constant scalar.
+Construct a new halfspace \(H = \{c^\intercal x \leq b\}\)
+normal_vector – vector c
offset – parameter b
Dimension of the halfspace
+length/dimension of normal vector
+Squared distance of a given point to the set
+u – given point
+squared distance
+float
+Whether the set is compact
+H is compact iff \(b < 0\) and \(c = 0\), in which case H is empty
+A halfspace is a convex set
+True
Vector c
+Parameter b
+Project a given point onto the set
+u – given point
+projection of u onto this set
+Bases: Constraint
This is the entire \({\rm I\!R}^n\)
+Squared distance of a given point to the set
+u – given point
+squared distance
+float
+Whether the set is compact
+Whether the set is convex
+Project a given point onto the set
+u – given point
+projection of u onto this set
+Bases: Constraint
A Rectangle (Box) constraint
+A set of the form
+\(X = \{x\in{\mathrm{I\!R}}^n {}:{} x_{\mathrm{min}} \leq x \leq x_{\mathrm{max}}\}\)
+Construct a new instance of Rectangle
+xmin – minimum bounds (can be None
)
xmax – maximum bounds (can be None
)
Exception – if both xmin
and xmax
is None
Exception – if xmin
and xmax
are both not None
and not a list
Exception – if xmin
and xmax
have incompatible lengths
Exception – if xmin(i) > xmax(i)
for some i
(empty set)
A new instance of Rectangle
+Dimension of this rectangle (inferred by the dimensions of xmin
and xmax
)
Squared distance to this rectangle
+u – given point
+squared distance of u
to this rectangle
Coordinates where both bounds are finite
+list of coordinates
+Coordinates at which xmax
is infinity and xmin
is finite
list of coordinates
+Coordinates at which xmin
is minus infinity and xmax
is finite
list of coordinates
+Whether the set is compact
+Whether the set is convex
+Whether this rectangle is an orthant
+An orthant is a rectangle whose projection on every coordinate is +an interval of the form \([0, \infty)\) or \((-\infty, 0]\).
+boolean
+Project a given point onto the set
+u – given point
+projection of u onto this set
+Maximum bound
+Minimum bound
+Bases: Constraint
Simplex constraint
+A set of the form
+\(X = \left\{x \in \mathrm{I\!R}^n : \sum_{i=1}^{n} x_i = \alpha, x \geq 0\right\}\)
+where \(\alpha\) is a positive constant.
+Constructor for a Simplex constraint
+alpha – size parameter of simplex (default: 1)
+new instance of Simplex with given alpha
+Returns the simplex value alpha
+Squared distance of a given point to the set
+u – given point
+squared distance
+float
+Whether the set is compact (True)
+Whether the set is convex (True)
+Computes the projection of a given point \(y\in{\rm I\!R}^n\) +onto the current simplex.
+y – given point; must be a list of numbers (float, int) or +a numpy n-dim array (ndarray)
+the projection point in \({\rm I\!R}^n\) as a numpy array of float64s
+Bases: Constraint
A Second-Order Cone given by \(C = \{u = (x, r): a\|x\| \leq r\}\)
+Second-order cones are used in conic optimisation to describe +inequalities that involve quadratic terms
+Constructor for a Second-Order Cone set
+a – parameter a
+New instance of a SOC with given parameter a
+Returns the value of parameter a
+Computes the squared distance between a given point u and this +second-order cone
++++
+- param u:
+- +
given point; can be a list of float, a numpy +n-dim array (ndarray) or a CasADi SX/MX symbol
+- return:
+- +
distance from set as a float or a CasADi symbol
+
Whether the set is compact
+Whether the set is convex
+Project a given point onto the set
+u – given point
+projection of u onto this set
+Bases: Constraint
A Euclidean sphere constraint
+A constraint of the form \(\|u-u_0\| = r\), where \(u_0\) is the center +of the ball and r is its radius
+Constructor for a Euclidean sphere constraint
+center – center of the sphere; if this is equal to Null, the +sphere is centered at the origin
radius – radius of the sphere
New instance of Sphere2 with given center and radius
+Returns the center of the ball
+Computes the squared distance between a given point u and this sphere
+u – given point; can be a list of float, a numpy +n-dim array (ndarray) or a CasADi SX/MX symbol
+distance from set as a float or a CasADi symbol
+Whether the set is compact
+Whether the set is convex
+Project a given point onto the set
+u – given point
+projection of u onto this set
+Returns the radius of the sphere
+Bases: Constraint
A set that contains only the origin
+The singleton \(\{0\}\)
+Constructor for set \(Z = \{0\}\)
+Squared distance of a given point to the set
+u – given point
+squared distance
+float
+Whether the set is compact
+Whether the set is convex
+Project a given point onto the set
+u – given point
+projection of u onto this set
+Rosenbrock functions with parameters <code>p = [a, b]</code>
+Problem
Problem.__init__()
Problem.alm_set_c
Problem.alm_set_y
Problem.constraints
Problem.cost_function
Problem.decision_variables
Problem.dim_constraints_aug_lagrangian()
Problem.dim_constraints_penalty()
Problem.dim_decision_variables()
Problem.dim_parameters()
Problem.parameter_variables
Problem.penalty_function
Problem.penalty_mapping_f1
Problem.penalty_mapping_f2
Problem.preconditioning_coefficients
Problem.to_dict()
Problem.w1
Problem.w2
Problem.w_cost
Problem.with_aug_lagrangian_constraints()
Problem.with_constraints()
Problem.with_penalty_constraints()
BuildConfiguration
BuildConfiguration.DEBUG_MODE
BuildConfiguration.RELEASE_MODE
BuildConfiguration.__init__()
BuildConfiguration.allocator
BuildConfiguration.build_c_bindings
BuildConfiguration.build_dir
BuildConfiguration.build_mode
BuildConfiguration.build_python_bindings
BuildConfiguration.local_path
BuildConfiguration.open_version
BuildConfiguration.rebuild
BuildConfiguration.ros_config
BuildConfiguration.target_system
BuildConfiguration.tcp_interface_config
BuildConfiguration.to_dict()
BuildConfiguration.with_allocator()
BuildConfiguration.with_build_c_bindings()
BuildConfiguration.with_build_directory()
BuildConfiguration.with_build_mode()
BuildConfiguration.with_build_python_bindings()
BuildConfiguration.with_open_version()
BuildConfiguration.with_rebuild()
BuildConfiguration.with_ros()
BuildConfiguration.with_target_system()
BuildConfiguration.with_tcp_interface_config()
RustAllocator
+OptimizerMeta
OptimizerMeta.__init__()
OptimizerMeta.alm_mapping_f1_function_name
OptimizerMeta.authors
OptimizerMeta.constraint_penalty_function_name
OptimizerMeta.cost_function_name
OptimizerMeta.grad_function_name
OptimizerMeta.initial_penalty_function_name
OptimizerMeta.licence
OptimizerMeta.optimizer_name
OptimizerMeta.preconditioning_file_name
OptimizerMeta.to_dict()
OptimizerMeta.version
OptimizerMeta.w_cost_function_name
OptimizerMeta.w_f1_function_name
OptimizerMeta.w_f2_function_name
OptimizerMeta.with_authors()
OptimizerMeta.with_licence()
OptimizerMeta.with_optimizer_name()
OptimizerMeta.with_version()
RosConfiguration
RosConfiguration.__init__()
RosConfiguration.description
RosConfiguration.node_name
RosConfiguration.package_name
RosConfiguration.params_topic_queue_size
RosConfiguration.publisher_subtopic
RosConfiguration.rate
RosConfiguration.result_topic_queue_size
RosConfiguration.subscriber_subtopic
RosConfiguration.to_dict()
RosConfiguration.with_description()
RosConfiguration.with_node_name()
RosConfiguration.with_package_name()
RosConfiguration.with_publisher_subtopic()
RosConfiguration.with_queue_sizes()
RosConfiguration.with_rate()
RosConfiguration.with_subscriber_subtopic()
SolverConfiguration
SolverConfiguration.__init__()
SolverConfiguration.cbfgs_alpha
SolverConfiguration.cbfgs_epsilon
SolverConfiguration.cbfgs_sy_epsilon
SolverConfiguration.constraints_tolerance
SolverConfiguration.initial_penalty
SolverConfiguration.initial_tolerance
SolverConfiguration.inner_tolerance_update_factor
SolverConfiguration.lbfgs_memory
SolverConfiguration.max_duration_micros
SolverConfiguration.max_inner_iterations
SolverConfiguration.max_outer_iterations
SolverConfiguration.penalty_weight_update_factor
SolverConfiguration.preconditioning
SolverConfiguration.sufficient_decrease_coefficient
SolverConfiguration.to_dict()
SolverConfiguration.tolerance
SolverConfiguration.with_cbfgs_parameters()
SolverConfiguration.with_delta_tolerance()
SolverConfiguration.with_initial_penalty()
SolverConfiguration.with_initial_tolerance()
SolverConfiguration.with_inner_tolerance_update_factor()
SolverConfiguration.with_lbfgs_memory()
SolverConfiguration.with_max_duration_micros()
SolverConfiguration.with_max_inner_iterations()
SolverConfiguration.with_max_outer_iterations()
SolverConfiguration.with_penalty_weight_update_factor()
SolverConfiguration.with_preconditioning()
SolverConfiguration.with_sufficient_decrease_coefficient()
SolverConfiguration.with_tolerance()
Rectangle
Rectangle.__init__()
Rectangle.dimension()
Rectangle.distance_squared()
Rectangle.idx_bound_finite_all()
Rectangle.idx_infinite_only_xmax()
Rectangle.idx_infinite_only_xmin()
Rectangle.is_compact()
Rectangle.is_convex()
Rectangle.is_orthant()
Rectangle.project()
Rectangle.xmax
Rectangle.xmin
fabs()
fmax()
fmin()
is_numeric()
norm2()
rosenbrock()
sign()
SolverStatus
SolverStatus.__init__()
SolverStatus.cost
SolverStatus.exit_status
SolverStatus.f1_infeasibility
SolverStatus.f2_norm
SolverStatus.lagrange_multipliers
SolverStatus.last_problem_norm_fpr
SolverStatus.num_inner_iterations
SolverStatus.num_outer_iterations
SolverStatus.penalty
SolverStatus.solution
SolverStatus.solve_time_ms
Directory where the original icasadi files are found (for internal use)
+Directory where the templates are found (for internal use, mainly)
+Directory where the templates are found and subfolder relative +to that path(for internal use, mainly)
+Bases: object
Client for TCP interface of parametric optimizers
+This class is used to start and stop a TCP server, which +has been generated by opengen.
+Constructs instance of OptimizerTcpManager
+There are three ways to use this constructor:
+OptimizerTcpManager(optimizer_path)
: creates a TCP manager for a local
+TCP server using the default IP and port of that TCP server (specified
+upon code generation)
OptimizerTcpManager(optimizer_path, ip, port)
: creates a TCP manager
+for a local TCP server, but overrides the default IP and port. This way
+the user can set the address 0.0.0.0, so that the TCP server binds on
+all IPs, or 127.0.0.1 so that it is accessible only locally, or a VPN
+IP address, so that the optimizer is accessible only over a private
+network.
OptimizerTcpManager(ip, port)
: If a path is not provided, then the
+TCP manager can be used to connect to a remote TCP server, as a client,
+but cannot be used to start the server.
optimizer_path (str) – path to auto-generated optimizer (just to be clear: this is
+the folder that contains optimizer.yml
)
ip (str) – the user can provide the IP of a remote TCP server (must be up and +running) so as to establish a remote connection. In that case path +must be equal to None (see examples above)
port (int) – see ip
New instance of OptimizerTcpManager
Calls the server
+Consumes the parametric optimizer by providing a parameter vector +and, optionally, an initial guess
+p (list of float) – vector of parameters
initial_guess (list of float) – initial guess vector
initial_y (list of float) – initial vector of Lagrange multipliers
initial_penalty (float) – initial penalty parameter
buffer_len (int) – buffer length used to read the server response, +defaults to 4096
max_data_size (int) – maximum data size that is expected to be received +from the TCP server, defaults to 1048576
SolverResponse object
+Kills the server
+Pings the server
+Pings the server to check whether it is up and running
+Starts the TCP server
+Note: this method starts a local server whose path must have been +provided - we cannot start a remote server.
+The server starts on a separate thread, so this method does not block +the execution of the caller’s programme.
+Bases: object
Class for storing solver status in the event of an error.
+Constructs instance of SolverError
error – dictionary containing error attributes
+New instance of SolverError
Error code
+Possible error codes are:
+1000: Invalid request: Malformed or invalid JSON
1600: Initial guess has incomplete dimensions
1700: Wrong dimension of Lagrange multipliers
2000: Problem solution failed (solver error)
3003: Parameter vector has wrong length
Error code
+Returns an appropriate error message matching the error code
+Error message
+str
+Bases: object
Stores a solver response of type SolverStatus or SolverError.
+Constructs instance of SolverResponse
This constructor is not to be used by the end-user
+d (dictionary) – dictionary containing either status or error attributes
+New instance of SolverResponse
Returns response, which is an instance of SolverStatus,
+if the call was successful, or an instance of SolverError
+otherwise. It is recommended that you use
+is_ok
to check
+whether the call has succeeded first
Determines if response is OK.
+This method should always be called first when obtaining a server response.
+Bases: object
Class for storing the status of the solver.
+Constructs instance of SolverStatus
+This constructor should not be called by the end-user.
+status – dictionary containing solver status attributes
+Cost at the solution
+Value of cost function at the solution
+Solver status
+The solver status can be:
+Converged
if the solver has converged
NotConvergedIterations
if the maximum number of outer or total inneriterations was reached
+NotConvergedOutOfTime
if the solver did not have enough time to converge
The exit status of the solver
+Returns the infeasibility of the ALM constraints, that is, it +returns
+\(\mathrm{dist}_C(F_1(u))\)
+Infeasibility of the constraint F1(u,p) in C
+Infeasibility of PM constraints
+Euclidean norm of \(\|F_2(u)\|\) at the solution
+Lagrange multipliers at the solution
+Vector of Lagrange multipliers
+Returns the infinity norm of the fixed-point residual of the last +inner optimization problem
+inf-norm of the FPR of the last inner problem
+Returns the total number of inner iterations for all inner problems
+The total number of inner iterations
+Returns the number of outer (ALM/PM) iterations of the algorithm
+The number of outer iterations
+Last penalty at the solution +:return: Last value of the penalty parameter
+Solution +:return: Solution vector +:rtype: list of float
+Solver time +:return: Total execution time in milliseconds
+