Hot answers tagged

7

For a test problem, check manually (outside GAMS) that the solution satisfies all constraints. If not, your GAMS model may be wrong. If all constraints are satisfied, try using a different solver and see if the same objective value is achieved. If the other solver gets a better result, your current runs may be stopping short of optimality. If the objective ...


5

There is a good reference that has been published by Alireza Soroudi. Power System Optimization Modeling in GAMS


5

Collecting things in a parameter is actually very simple. set run /.../; parameter objresult(run,*); loop(run, solve m .... objresult(run,"obj") = m.objval; objresult(run,"bestbound") = m.objest; objresult(run,"absgap") = abs(m.objval-m.objest); );


5

By default, Gams/Cplex will try to calculate duals by fixing the integer variables and then resolving as an LP. This is the "final solve". Usually the objectives are the same. In rare cases the final lp can be infeasible or the objective can be different because of an artifact in Cplex (mind-numbing detail: it can return mip solutions obeying the ...


5

To fix a variable use x.fx(i) = 1. To unfix: x.lo(i) = 0; x.up(i) = 1;. To relax an integer/binary variable you can use: x.prior(i)=INF; Documentation of this can be found at the obvious place: https://www.gams.com/latest/docs/UG_Variables.html. Here is an example of how to use this.


4

The main reason why Pyomo is being used in industry and JuMP is not is that JuMP is a version 0.21.6 package whereas Pyomo is v5.7.3. Naturally, most businesses are not going to use a package with version less than 1. Also, according to the following discussion, first-class nonlinear optimization support is something for v2.0 (two or three years away): https:...


4

It is much better to collect all y.l(i) in a parameter with an extra index t, and export that in one swoop. I.e. parameter results(t,i); loop(t, * calculate y.l(i) solve ...; results(t,i) = y.l(i); ); execute_unload "AllResults.gdx", results; execute 'gdxxrw.exe AllResults.gdx par=results'; Calls to Excel are expensive so they should ...


3

You cannot loop over include files ($include is compile-time, while loop is execution- time, this is similar to say C where you cannot loop over #include). One could loop over complete GAMS models (call gams inside a loop), or over reading data from GDX (GAMS data) files. But often a better approach is the following. I would just read in all problem data in ...


3

The latest JuMP.jl website gives a few examples of its use in industry: route school buses by the Boston school district plan powergrid expansion by PSR optimize milk output by dairy farmers in New Zealand I personally find JuMP.jl, by far, the most user-friendly and flexible optimization interface I ever used. By far.


3

Unfortunately, GAMS does not have an independent low-level API language (such as CPLEX or Gurobi) and you will need to use its high-level language into your favourite API. In the simplest form, you can write your optimization problem in the gams file (.gms) and invoke it in python as follows: # transport1 example in the gams directory from __future__ import ...


3

This analogy might help: CPU usage is like the power output of an engine - more is better in terms of performance. Memory usage is more like the heat produced by the engine - too much heat, aka memory capacity exceeded, and the engine breaks down. There is simply no reason in trying to increase or even max out memory usage.


3

As @ErwinKalvelagen pointed out: by default gams cplex uses only 1 thread which results in a low usage of the pc ressources. In order to change this one has to increase the thread number so that multiple cores can be used at the same time: https://support.gams.com/solver:multiple_cplex_threads


1

While ago, I asked such a question and GAMS answer was: I try solving a VRP problem with the below results without the gap option: Iteration log . . . Iteration: 1 Dual objective = 124.000000 Root relaxation solution time = 0.00 sec. (0.10 ticks) Nodes Cuts/ Node Left Objective ...


1

Eq(h) .. e(h) =e= E0 - sum(t$(ord(t) <=Ord(h) ), pd(t)+n*sum(t, pc(t)); It's better to define E0 as a scalar in GAMS. you should also define alias(h,t);


Only top voted, non community-wiki answers of a minimum length are eligible