-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #344 from alphaville/feature/333-affine-space-codegen
Support for affine spaces in code generation
- Loading branch information
Showing
13 changed files
with
122 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.8.1 | ||
0.9.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,4 @@ | |
from .finite_set import * | ||
from .halfspace import * | ||
from .simplex import * | ||
from .affine_space import * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import casadi.casadi as cs | ||
import numpy as np | ||
from .constraint import Constraint | ||
import opengen.functions as fn | ||
|
||
|
||
class AffineSpace(Constraint): | ||
"""An affine constraint | ||
A constraint of the form :math:`Ax = b`, where :math:`A` and :math:`b` are | ||
a matrix and a vector of appropriate dimensions | ||
""" | ||
|
||
def __init__(self, A, b): | ||
"""Constructor for an affine space | ||
:return: new instance of AffineSpace | ||
""" | ||
self.__A = A.flatten('C') | ||
self.__b = b | ||
|
||
@property | ||
def matrix_a(self): | ||
"""Matrix A | ||
""" | ||
return self.__A | ||
|
||
@property | ||
def vector_b(self): | ||
"""Vector b | ||
""" | ||
return self.__b | ||
|
||
def distance_squared(self, u): | ||
"""Squared distance to affine space | ||
Not implemented yet | ||
""" | ||
raise NotImplementedError() | ||
|
||
def project(self, u): | ||
"""Projection on affine space | ||
Not implemented yet | ||
""" | ||
raise NotImplementedError() | ||
|
||
def is_convex(self): | ||
"""Affine spaces are convex sets | ||
""" | ||
return True | ||
|
||
def is_compact(self): | ||
"""Affine spaces are not compact sets | ||
""" | ||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.