var Pcharge {BUS , Time};
and
set BUS := {1 2};
set Tiem := { 1 2 3};
I am wondering in AMPL API how I can give a matrix like Z as an initial solving point to the solver
Z = [ 1 2 3 ; 4 5 6];
Thanks.
--
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ampl+uns...@googlegroups.com.
To post to this group, send email to am...@googlegroups.com.
Visit this group at https://groups.google.com/group/ampl.
For more options, visit https://groups.google.com/d/optout.
Hi
thank you very much for your response.
if instead of a vector of size 4, we have a vector for example with size of 1000, then I wonder if there is a way to avoid writing {1;2;3;4;5;6;7;8;9;...;1000} and same for the values.
Thanks,
Mahraz
On Mon, Apr 23, 2018 at 5:23 PM UTC, AMPL Google Group <am...@googlegroups.com> wrote:
According to the documentation, the correct method for indexed entities would be setValues instead of setValue. However, Variable.setValues is apparently missing from the current implementation of the API and a new release is necessary to fix this issue. Nevertheless, you can do the same by creating a DataFrame with two columns, one for the index and another for the values (named after the variable you want to set), and set the variable values with ampl.setData as follows:
ampl.eval('var x {1..4};');
index = {1; 2; 3; 4};
values = {-5; -9; 2; 24};
df = DataFrame(1, 'index', 'x'); % the second column is named after the variable you want to set
df.setMatrix(values, index)
ampl.setData(df)
Best regards,
Filipe
--
Filipe Brandão
am...@googlegroups.com