Search found 8 matches

by mkbonde
1 year ago
Forum: Syntax
Topic: Subset of multiple subsets
Replies: 4
Views: 6475

Re: Subset of multiple subsets

Thank you for the replies and explanation. @Fred I did not know about the superset(subset) syntax (only the other way around) - that could be very useful! You are all right that there are no extra dollar conditions if I just define everything over the superset (except those stemming from interaction...
by mkbonde
1 year ago
Forum: Syntax
Topic: Subset of multiple subsets
Replies: 4
Views: 6475

Subset of multiple subsets

Dear GAMS forum I regularly run into an issue where we have a set structure in which a set is a subset of two different sets which are both subsets of the same super set, for example: sets abc /a, b, c/ ab[abc] /a, b/ a[abc] /a/ ac[abc] /a, c/ c[abc] /c/ ; The problem is when I define a variable ove...
by mkbonde
3 years ago
Forum: Tools
Topic: Make a noise in GAMS
Replies: 2
Views: 5296

Re: Make a noise in GAMS

You could also use the embedded code feature to run a python snippet - there are a bunch of text to speech libraries out there.

Code: Select all

$onEmbeddedCode Python:
    import pyttsx3
    engine = pyttsx3.init()
    engine.say("I will speak this text")
    engine.runAndWait()
$offEmbeddedCode
by mkbonde
3 years ago
Forum: Modeling
Topic: Different indexing for same variable
Replies: 7
Views: 4371

Re: Different indexing for same variable

Your example can written as a sum: sum(f, generation[f] * fuel_price[f]) where f is a set containing your different fuel types such as gas and oil. You can also insert the set elements directly, for example: generation["oil"] * fuel_price["oil"] + generation["gas"] * fu...
by mkbonde
4 years ago
Forum: API
Topic: GMSPython 3.7 and tkinter
Replies: 2
Views: 4667

Re: GMSPython 3.7 and tkinter

That is very reasonable and we will probably end up using Miniconda to help our clients. I only ask in case you were already planning on updating the interpreter soon (since you recently added support for Python 3.7). Most packages today can be easily installed using pip making it easy to build on t...
by mkbonde
4 years ago
Forum: API
Topic: GMSPython 3.7 and tkinter
Replies: 2
Views: 4667

GMSPython 3.7 and tkinter

What is the timeline for updating the Python installation that comes with GAMS? As of version 3.7, the standard Python installation on Windows comes with tkinter. Will that also be the case for the version shipped with GAMS in future releases? (It would be very convenient if our clients had access t...
by mkbonde
4 years ago
Forum: Modeling
Topic: Indexing a Set with multiple values
Replies: 2
Views: 2449

Re: Indexing a Set with multiple values

You can compare the positions of the two elements in their respective sets by writing

Code: Select all

$(ord(cereq)=ord(t))
or compare the position of cereq with the value of t:

Code: Select all

$(ord(cereq)=t.val)
Using .val is useful when comparing numerical sets that don't naturally start at 1, for example years.
by mkbonde
4 years ago
Forum: Wishes
Topic: Support larger character set for identifiers
Replies: 0
Views: 6278

Support larger character set for identifiers

Would it be possible to add support for more than alphanumeric characters for identifiers in a future release? Both Python and Julia allow many non-ASCII characters in identifiers, e.g. the following is valid python code: β = [1, 2, 3] def Σ(iter): return sum(iter) print(Σ(β)) For most programming I...