-------- Forwarded Message --------

Date: Sun, 28 May 2023 14:08:46 -0300
Subject: Re: [Fwd: Re: [Fwd: MathProg set vs param]]
Cc: [email protected], Andrew Makhorin <[email protected]>
To: Jeff Kantor <[email protected]>
From: Code Raguet <[email protected]>
>  
> > The ’set’ and ‘param’ statements need to be considered from
> > theperspective of a mathematical optimization model. 
> This may be the cause of my struggling. My lack of knowledge in LP
> isn't helping to link the proper domain abstractions.
> 
> For example, I need to work with some dataset as a matrix:
> 
> 
> 
> 
>       
>       
>       
>       
>       
>       
> 
> 
> 
> 
>       
>       
>               
> 
>               p1
>               p2
>       
>       
>               A
>               100
>               20
>       
>       
>               B
>               200
>               30
>       
>       
>               
> 
>               
> 
>               
> 
>       
> I managed to encode this table as the following statements. This works
> but my rationale is that the whole table is my "parameter".
> I'd like to be able to solve the model with another dataset where the
> only things that would remain are column names (p1 and p2).
> Everything else may change.
> So, do I need the S set? why? Is it possible to do this with param  p
> only?
> I think that my parameter is just p and not p and s.
> 
> 
> set S := A B;
> param p :
>             p1   p2    :=
>         A   100  20
>         B   200  30
>         ;
> 
> Thank you very much for your help, time and kindness.
> Ignacio.
> 
> On Sun, May 28, 2023 at 10:18 AM Andrew Makhorin <[email protected]> wrote:
> > -------- Forwarded Message --------
> > 
> > From: Jeff Kantor <[email protected]>
> > 
> > To: Andrew Makhorin <[email protected]>
> > 
> > Cc: [email protected]
> > 
> > Subject: Re: [Fwd: MathProg set vs param]
> > 
> > Date: Sat, 27 May 2023 20:00:37 -0500
> > 
> > 
> > 
> > > Hi Ignacio,
> > 
> > > 
> > 
> > > The ’set’ and ‘param’ statements need to be considered from the
> > 
> > > perspective of a mathematical optimization model. A ’set’ refers
> > to a
> > 
> > > mathematical set of objects that will index other components of
> > the
> > 
> > > model, such as parameters, constraints, and decision variables.
> > The
> > 
> > > elements of the set must be unique. They can be integers or
> > strings.
> > 
> > > Identifying appropriate sets for a particular problem is often
> > 
> > > obvious, but other times worth some thought.
> > 
> > > 
> > 
> > > Elements of a set index parameters and provide a symbolic
> > reference to
> > 
> > > the numbers needed to specify expressions appearing in your model.
> > 
> > > 
> > 
> > > Parameters and sets are very different things.
> > 
> > > 
> > 
> > > Jeff
> > 
> > > 
> > 
> > > > On May 27, 2023, at 7:17 PM, Andrew Makhorin <[email protected]>
> > wrote:
> > 
> > > > 
> > 
> > > > -------- Forwarded Message --------
> > 
> > > > From: Code Raguet <[email protected]>
> > 
> > > > To: [email protected]
> > 
> > > > Subject: MathProg set vs param
> > 
> > > > Date: Sat, 27 May 2023 19:51:01 -0300
> > 
> > > > 
> > 
> > > > > Hi, there!
> > 
> > > > > I'm new to MathProg (and LP) but I have several years as a
> > 
> > > > > software
> > 
> > > > > developer.
> > 
> > > > > I would like to understand the semantic differences between
> > set
> > 
> > > > > and
> > 
> > > > > param.
> > 
> > > > > When reading the doc and looking at examples, I understand
> > that
> > 
> > > > > the
> > 
> > > > > set statement is for sets, arrays, vectors, (n-tuples) and
> > simple
> > 
> > > > > symbolic elements. On the other hand, param statement is for
> > 
> > > > > simple
> > 
> > > > > scalar values or values of a set (usually indexed).
> > 
> > > > > 
> > 
> > > > > My issues are about the semantics and rationale behind these
> > 
> > > > > statements.
> > 
> > > > > Why are two different statements for doing quite similar (in
> > my
> > 
> > > > > understanding) purpose?
> > 
> > > > > I mean, both declare data structures (and initialize in the
> > data
> > 
> > > > > section).
> > 
> > > > > Aren't sets kind of a param after all?
> > 
> > > > > 
> > 
> > > > > for ex.:
> > 
> > > > > Imagine declaring an array of simple elements:
> > 
> > > > > set S := {'A', 'B'};
> > 
> > > > > param P{i in {'A', 'B'}};
> > 
> > > > > 
> > 
> > > > > How are these statements different?
> > 
> > > > > 
> > 
> > > > > 
> > 
> > > > > Thanks in advance,
> > 
> > > > > Ignacio.
> > 
> > > 
> > 
> > > 
> > 
> > 
> 
> 

Reply via email to