[PPL-devel] Another question
Ezio Bartocci
ezio.bartocci at gmail.com
Thu May 3 18:13:51 CEST 2012
Dear PPL developers,
I forward the message that I sent to Roberto. Since he is
traveling, maybe some of you can help us...
Thanks a lot
Best Regards
Ezio
On Thu, May 3, 2012 at 4:42 PM, Ezio Bartocci <ezio.bartocci at gmail.com> wrote:
> Dear Roberto,
>
>
> I have another question. This time in English so that also Radu
> and Gregory can read. I have the following points, describing a
> polytope:
>
> 1 0.005 0.007883
> 0.9967750 0.004769 0.007988
> 1 0.000250 0.007883
> 0.9967750 1.900e-05 0.007988
> 1 0.005000 0.004225
> 0.9967750 0.004769 0.004331
> 1 0.000250 0.004225
> 0.9967750 1.900e-05 0.004331
> 1 0.0050000 0.007883
> 0.4194590 0.0047690 0.007988
> 1 0.0002500 0.007883
> 0.4194590 1.9000e-05 0.007988
> 1 0.0050000 0.004225
> 0.4194590 0.0047690 0.004331
> 1 0.0002500 0.004225
> 0.4194590 1.90000e-05 0.004331
>
>
> From this points stored in a matrix P with rows_P = 16 and cols_P = 3.
>
> I call this function that I developed to generate a C_Polyhedron (or
> Polytope), that uses
>
> add_generator
>
> as you suggested and assign to P the result that is private member of
> the class ppl_wrap
>
>
> ppl_wrap::ppl_wrap (double * Points, int rows_P, int
> cols_P):rows_P(rows_P), cols_P(cols_P)
> {
>
> int debug = 1;
> int i, j, k;
>
> // Convert the standard double representation to a much
> // accurate representation
> vector<mpf_class> *P1_row = double2mpzclass(Points, &rows_P, &cols_P);
> vector<vector<mpf_class> > *P1 = vec2mat(P1_row, &rows_P, &cols_P);
> vector<mpf_class> single_point;
>
> list<Variable> VarList;
> list<Variable>::iterator it;
> Linear_Expression lin_exp[rows_P];
> if (debug)
> cout << "Cols num: " << cols_P << "\n";
>
> for(i=0; i< cols_P; i++) // create a list of n_col_C "Variable" objects
> VarList.push_back(Variable(i));
>
> C_Polyhedron ph (cols_P, EMPTY);
>
> if (debug)
> cout << "Rows num: " << rows_P << "\n";
> for (j = 0; j < rows_P; j++)
> {
> if (debug)
> cout << " j = " << j << "\n";
> single_point.clear();
>
> /*Create linear expression for expressing the point*/
> if (debug)
> cout << " k = ";
> for (k = 0; k < cols_P; k++){ // pick the needed row of matrix C
> if (debug)
> cout << "(" << k << ") " << (*P1)[k][j] << " ";
> single_point.push_back((*P1)[k][j]);
>
> }
> if (debug)
> cout << ";\n";
>
>
> int m;
> for ( it=VarList.begin() ; it != VarList.end(); it++ ) //
> creates linear expression "lin_exp_temp" by using the iterator of the
> Variable-List
> {
> m = it->id();
> if (debug)
> cout << " m = " << m <<"\n";
> lin_exp[j]+=single_point[m]*(*it);
> }
>
> ph.add_generator(point(lin_exp[j]));
> }
> P = ph;
> }
>
>
>
> After obtaining a polytope I need to have the following representation
> to store the polytope back in matlab C * x <= d.
>
> Now as I wrote in a previous email I saw that with:
>
> Constraint_System ConSys_P;
> ConSys_P = P.constraints();
>
> we can actually obtain the representation: C * x >= d
>
> but if I print the constraints:
>
> ConSys_P.print();
>
> -A + C >= 0, -C >= -1, A >= 0, B >= 0, -B >= -1
>
> This does not seem to match with the points and it seems an over
> approximation. I would expected constraints more tight constraints.
>
> Why is like that ?
>
>
> Thanks,
>
> Best
>
>
> Ezio
>
>
>
>
>
>
>
>
> --
> Dr. Ezio Bartocci, Assistant Professor
> Dependable Systems Group
> Department of Computer Engineering
> Faculty of informatics
> TU Wien, Vienna University of Technology, Austria
> Treitlstraße 3, 1040 Vienna, Austria
> E-Mail: ezio.bartocci at tuwien.ac.at
> Phone: +43 (1) 58801 - 18210
> Webiste: http://www.eziobartocci.com
--
Dr. Ezio Bartocci, Assistant Professor
Dependable Systems Group
Department of Computer Engineering
Faculty of informatics
TU Wien, Vienna University of Technology, Austria
Treitlstraße 3, 1040 Vienna, Austria
E-Mail: ezio.bartocci at tuwien.ac.at
Phone: +43 (1) 58801 - 18210
Webiste: http://www.eziobartocci.com
More information about the PPL-devel
mailing list