Comments (5)
Hi Christopher,
Both meet/join transformers assume that the inputs have the same dimensionality. Therefore, you would need to create two 4 dimensional polyhedra by mapping "a->x0", "b->x1", "c->x2" and "d->x3". In the first polyhedron, x2 and x3 will be unconstrained while x0 and x1 will be unconstrained in the other.
Let me know if this helps!
P.S.- The join in this case will return top while the meet will return bottom.
Cheers,
Gagandeep Singh
from elina.
So, is there an easy way to map new dimensions? Say without having to go through each lincons/coeff and such?
The only idea I had is to do something as below (I don't have resizing of the a yet), but the last loop doesn't work because p.linterm isn't always there, it is sometimes p.coeff. How would I change this or do it differently?:
//loop through all of a, if b doesn't agree, then need to add a dimension
map<string, size_t> changePolys(elina_manager_t* man, opt_pk_array_t* aPoly, map<string, size_t>amap, opt_pk_array_t* bPoly, map<string, size_t>bmap){
size_t sizeDim = amap.size() - 1;
map<size_t,size_t> dim2dimMap{};
for (auto avardim : amap) {
string avar = avardim.first;
size_t adim = avardim.second;
auto it = bmap.find(avar)
if( it != bmap.end()) {
auto bdim = it->second;
if (bdim != adim){
dim2dimMap.insert(make_pair(bdim, ++sizeDim));
}
}
}
//exists in b but not a, need to move over still
for (auto bvardim : bmap) {
string bvar = bvardim.first;
size_t bdim = bvardim.second;
auto it = bmap.find(avar)
if (it == amap.end()) {
bDimToDimMap = bDimToDimMap.set(bdim, ++sizeDim);
}
}
// Then loop through the B constraints
// change the dims that need to be changed
auto bArray = opt_pk_to_lincons_array(man, bpoly);
for (int i = 0; i < bArray.size; ++i) {
auto bcons = bArray.p[i];
auto bexpr = bcons.linexpr0;
auto bexprSize = bexpr->size;
auto blinterms = bexpr->p.linterm;
for (auto j = 0; j < bexprSize; ++j) {
auto blinterm = blinterms[j];
auto dim = blinterm.dim;
auto it = bDimToDimMap.find(dim);
if (it != bDimToDimMap.end()) {
blinterm.dim = it->second;
}
}
}
from elina.
Hi Christopher,
The linear expressions in ELINA are encoded as either sparse or dense. You can check whether an expression is dense or sparse as here:
ELINA/elina_zonotope/elina_box_meetjoin.c
Line 476 in fe56503
For Sparse expressions, p.linterm stores the indexes of the variables in the expression. For dense expressions,p.linterm=NULL and p.coeff[i] stores the coefficient for the variable x_i.
Let me know if this helps.
Cheers,
Gagandeep Singh
from elina.
So the output I get for meet is:
--------meet_test State 0--------
2
array of constraints of size 2
0: -x0 + 2147483647 >= 0
1: x0 + 2147483647 >= 0
--------meet_test State 1--------
2
array of constraints of size 2
0: -x1 + 2147483647 >= 0
1: x1 + 2147483647 >= 0
--------meet_test Meet State --------
4
array of constraints of size 4
0: -x0 + 2147483647 >= 0
1: x0 + 2147483647 >= 0
2: -x1 + 2147483647 >= 0
3: x1 + 2147483647 >= 0
I was a bit confused if you meant this as the bottom from your previous comment?
If I print the lincons for the join, I get:
--------join_test State 0--------
2
array of constraints of size 2
0: -x0 + 2147483647 >= 0
1: x0 + 2147483647 >= 0
--------join_test State 1--------
2
array of constraints of size 2
0: -x1 + 2147483647 >= 0
1: x1 + 2147483647 >= 0
--------join_test Join State--------
0
empty array of constraints
Just double checking these are what I should expect correct?
from elina.
Your output for both is correct, there was a misunderstanding on my part when I considered the meet to return bottom.
Cheers,
Gagandeep Singh
from elina.
Related Issues (20)
- elina_abstract0_from_zonotope is not defined
- Compilation failure due to wrong path HOT 4
- Segfault when creating a polyhedra using a tcons_array HOT 1
- Broken ELINA after 9c99c4d177c691f98f2031657c18fe6fbe4c7571 HOT 1
- Adding a new variable and interval to Poly HOT 4
- Makefile in fppoly references non-existant sign_approx.o HOT 1
- Wrong CDD_PREFIX after ./configure --cdd-prefix HOT 4
- Memory leaks (Valgrind) in elina_poly HOT 7
- OSError: libfppoly.so: cannot open shared object file: No such file or directory HOT 4
- error: ‘AP_SCALAR_MPFR’ undeclared (first use in this function); did you mean ‘ELINA_SCALAR_MPFR’? HOT 2
- error when executing make in ELINA HOT 2
- Get relative bounds for dimensions HOT 2
- SEGFAULT when joining bottom HOT 4
- Portability issue with the `funptr` array HOT 7
- -march=native and -DTIMING not supported in Apple M1 HOT 3
- Missing MPFR_LIB_FLAG and GMP_LIB_FLAG in Makefile HOT 2
- How to tune the clam options to reproduce ELINA paper results HOT 14
- Does ELINA support the join and meet operators in case of the NNC Polyhedra? HOT 11
- No bound_texpr support for polyhedra domain
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from elina.