In GAMS, assume I have s parameters which is indexed over two sets P1(A,B), and I have…
- User
In GAMS, assume I have s parameters which is indexed over two sets P1(A,B), and I have another one-to-one-mapping that maps exactly each element of B to each element of C. How can I create a new parameter P2(A,C) such that each value of P2 takes the mapped value from P1?
Assistant
In GAMS, you can use the FIND function to create a new parameter P2(A,C) that takes the mapped value from P1. Here's how you can do it:
- Define the sets A, B, and C:
sets A /a1, a2, a3/ B /b1, b2, b3/ C /c1, c2, c3/ ;
- Define the one-to-one mapping from B to C using the FIND function:
parameter Mapping(B,C); Mapping(b,c) = 1 if c = FIND(b), 0 otherwise;
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.