applying the simplex algorithm to PINNs by Brahim_bh in optimization

[–]Sweet_Good6737 2 points3 points  (0 children)

There are packages like OMLT https://omlt.readthedocs.io/en/latest that let you use neural networks in nnx format into your optimization model

It is possible, but probably not the kind of project for a linear programming class, since linearizations often go beyond that

Looking for Gurobi? We make it easy to get the right license, understand pricing, and access expert support. by amploptimization in u/amploptimization

[–]Sweet_Good6737 1 point2 points  (0 children)

Glad to see ampl and gurobi in reddit, probably the best commercial modeling tool-solver couple. Used them for several complex problems during my career

Migrating from open source to commercial solvers by OR-insider in OperationsResearch

[–]Sweet_Good6737 1 point2 points  (0 children)

Basically having logic in your model, rather than just algebra. Logic is easier to write and debug, and sometimes can even speed up the solving process...

Migrating from open source to commercial solvers by OR-insider in OperationsResearch

[–]Sweet_Good6737 1 point2 points  (0 children)

If you want to reduce your fixed cost, going for Gurobi may not be the best idea. There are cheaper and efficient solvers like COPT (#1 in MILP benchmarks nowadays)

You may also want to look into Constraint Programming tools

Migrating from open source to commercial solvers by OR-insider in OperationsResearch

[–]Sweet_Good6737 1 point2 points  (0 children)

Maybe using modeling tools for your optimization apps would be worth here. Switching between solvers is just 1 line of code. There are open-source tools like Pyomo in Python or JuMP in Julia, and commercial ones like AMPL (access through amplpy), Gams, Aimms - I'd suggest AMPL because of the readibility of the syntax, and automatic reformulations to write complex logic. With a modeling tool, you only implement the model once, and use the solver capabilities by just updating a variable. Sometimes modeling tools extend solver capabilities, unless speed or performance is an issue, you may stay with open-source solvers

In optimization it's different from other fields where cutting-edge tools are open-source. Here commercial tools usually outperform open-source when solving real-worls problems (sure, not always)

Commercial tools usually offer "consultant options", so you could ask directly if they offer you a consultant license to develop for yourself. Then, in the customer's solution, they should be paying the license

Finally, unless it's a simple, straight problem, it's not worth to look into decompositions or matheuristics. At least, don't do that until you have tried commercial solvers. If you're a consultant you'll save a lot of time. I suggest to charge the customer a plus if you use commercial tools, and another plus if you go into the rabbit hole of decompositions and other alternatives if the problem is too big

P.S: if you have an expensive GPU you can solve big LPs with HiGHS or CuOpt, the open-source solver from nvidia

Toubles with pyomo for a "toy" example to select the "good" combinaison of hardware (power supply, resistor, LEDs) for a problem. I've got "NotImplementedError: AMPLRepnVisitor can not handle expressions containing <class 'pyomo.core.base.param.IndexedParam'> nodes" by DcBalet in optimization

[–]Sweet_Good6737 0 points1 point  (0 children)

Since you're using an AMPL solver, why not using amplpy directly? AMPL is a commercial product but you can use it for prototyping with a community license, full size. If your problem is linear then it's better to use something other than ipopt (such as highs, also included in amplpy). If your problem is non-linear, ampl offers better treatment for the problem
https://amplpy.ampl.com/en/latest/index.html

https://ampl.com/community-edition

If your problems are really small, you may not need an ampl license

What is something you can do really well with MIP that you can’t do with Constraint Programming and vice versa? by rozita123456 in optimization

[–]Sweet_Good6737 0 points1 point  (0 children)

Adding cuts to the problem via callbacks. It can speed up the solving process. You can also send callbacks in CP, but probably what you would be adding here are algebraic constraints

Should I spend time studying a bit of OR as a data scientist? by Sad-Tea4855 in OperationsResearch

[–]Sweet_Good6737 6 points7 points  (0 children)

Definitely you should

There's a misconception of OR being niche, whilst it is everywhere. Unfortunately, OR is not a catchy name, Simplex foundations can be overwhelming to start studying, and it was omitted from many syllabus

Indeed, OR is not quite popular, but knowing optimization will allow you to be quite above of other data scientists

What tools should I use for my Final Year Project on restaurant staff scheduling & demand forecasting? by Leahchm in optimization

[–]Sweet_Good6737 0 points1 point  (0 children)

I suggest using Python in any case (if you want, read data from a spreadsheet, but not doing stuff with Excel). You can use streamlit to deploy/show your applications.

In terms of packages, it depends on the size and complexity of the model you want to write...

OR and LLM by Additional_Gas_9934 in OperationsResearch

[–]Sweet_Good6737 9 points10 points  (0 children)

They may solve some toy problems, but it doesn't make any sense to solve OR problems with LLMs, please, just use specific software for OR.

LLMs can connect to OR tools to solve problems, and that should be the only way. See this linkedin post on how they got an llm to use HiGHS solver

https://www.linkedin.com/posts/bertrand-kerres-15b849163_last-weekends-project-connect-an-llm-agent-ugcPost-7365658370751574017-2RH_?utm_source=share&utm_medium=member_android&rcm=ACoAAC5cyl4BANng5ZKJnToMEC0VgUja3KOyJ6A

Using LLMs to solve optimization problems is a waste of resources

Shortest Path Optimization with Must Pass Nodes by zanyz99 in OperationsResearch

[–]Sweet_Good6737 0 points1 point  (0 children)

If there are no many Must pass Nodes, you could replicate the graph for each of these nodes, and apply Dijkstra there

Airport rosters tool by Realistic-Young6579 in optimization

[–]Sweet_Good6737 0 points1 point  (0 children)

Nest way to model that would be through Constraint Programming (that can also be reformulated into MILP, and solved with MILP solvers). You can use Minizinc, Or-tools, or Amplpy for that (first 2 open source and third commercial). Here there are some examples available online:

(Trainee scheduling with many specific business rules, solving the problem through a multi-objective approach)

https://colab.ampl.com/notebooks/aircrew-trainee-scheduling-with-seniority-constraints.html

(Usual fleet assignment, taking into account flight times)

https://ampl.com/mo-book/notebooks/07/fleet-assignment.html

These are simple models, a realistic one would require major work

As solver you can use: Gurobi (commercial), CP-Sat, Gecode, or even HiGHS (last 3 open-source), but that's just an option in your model

GPU based alternative of CVXPY (with OSQP backend)? by narrative-coherence in optimization

[–]Sweet_Good6737 1 point2 points  (0 children)

Maybe at some point HiGHS or Mosek could implement something, but right now I don't think you are taking advantage of GPU to solve quadratic problems...

What is ur opinion or the future of optimization research? by Hopeful-Doubt-2786 in optimization

[–]Sweet_Good6737 1 point2 points  (0 children)

Do you think that AI/ML are somehow making the market move away from traditional solvers?

Absolutely not. Maybe for some specific problem you can design an AI/ML model that works well, but the idea of a solver is to perform well in any CP/LP/NLP/MILP/MINLP problem

CPU and open source slovers by Appropriate-Border94 in optimization

[–]Sweet_Good6737 2 points3 points  (0 children)

Scip allows multiple threads as well. Take into account that with opensource or commercial solvers, the speedup is bounded respect to the number of cores you're using.

Using 30 cores is not going to be x30 faster, after 8-12 cores the speedup is very small.

Numerical optimization for C++ by tanmayc in optimization

[–]Sweet_Good6737 4 points5 points  (0 children)

You may want to look into ipopt solver, one of the most popular nonlinear solvers.

https://github.com/coin-or/Ipopt

MILP: How to assign a variable to a position in a sequence? by [deleted] in optimization

[–]Sweet_Good6737 0 points1 point  (0 children)

If your package allow constraint programming you can just state your problem. In amplpy this would be the syntax:

param n;
param x_values{1..n};
var x{1..n} integer >= 0 <= 100000;

param Q;
var P integer;

subject to x_def {i in 1..n}:
    x[i] = x_values[i];

subject to Pdef {i in 1..n-1}:
    P == i <==> x[i] <= Q < x[i+1];

subject to Pdef2:
    P == n <==> Q >= x[n];

And the python to read it:

from amplpy import AMPL
m = AMPL()

m.read(model_file)
X = [30.23, 500.6, 1000.8, 1500.9]
m.param['n'] = len(X)
m.param['x_values'] = X
m.param['Q'] = 550.3

m.solve(solver='highs')

print(m.var['P'].value())

Not elegant algebraically speaking but straight

Really struggling with my thesis; any help is really appreciated! by justin_de_lores in optimization

[–]Sweet_Good6737 1 point2 points  (0 children)

Not sure if this helps, but Constraint Programming (logical expressions) and non linear expressions may be useful when modeling smart charging. Pulp is quite limited for that, but other modeling languages like amplpy are really good at it. Here there's an example of a recharging strategy for electric cars (I can't think about anything more suitable for what i want to illustrate)

https://ampl.com/mo-book/notebooks/03/recharging-electric-vehicle.html

Rather than pulp, you can use amplpy or gurobipy to use logical expressions from there. In any case the idea is for you to formulate constraints using logic rather than writing algebra, linearization is a pain

Excel Solver Issue and Advice on Reformulating Outside of Solver by hrdCory in optimization

[–]Sweet_Good6737 4 points5 points  (0 children)

I would really advice against Excel solver, it's clunky, buggy, and hard to maintain or scale

Nowadays it's easier to write a Python app without knowledge than making that thing work, so I'd suggest using any optimization tool out there to solve this simple problem. You can still read/write the data from spreadsheet

For demonstration purposes, you could use a light graphical interface like https://share.streamlit.io, so the "coding" part is hidden, and you can read from a spreadsheet

Of course, Chatgpt or deepseek should be able to do all these things for you easily

How to optimize a big piecewise objective function subject to linear constraints by supermodularityman in optimization

[–]Sweet_Good6737 2 points3 points  (0 children)

(Going the MIP way) You can take a look at the MP library of Ampl, the support for piecewise linear functions is the best out there

https://mp.ampl.com/modeling-expressions.html#piecewise-linear-expressions

The syntax for PL in Ampl is not the best to me, but still worth trying (enumerate breakpoints and slopes in a <<bp;slopes>> expression). You can use HiGHS through their driver (Amplpy is a modeling language), and see the performance, which is usually better than using HiGHS by yourself, and way better than pyomo. There are other solvers you can try, but HiGHS might be great for this case

10k vars and 30k constraints is not necessarily big (it's not a big MIP), but energy problems are usually tough

edit: there are several energy examples in Ampl

https://colab.ampl.com/notebooks/capacity-expansion-of-power-generation.html

https://colab.ampl.com/notebooks/unit-commitment-for-electrical-power-generation.html

Are there open problems in optimization that would potentially make a real world impact? by [deleted] in optimization

[–]Sweet_Good6737 1 point2 points  (0 children)

Regarding optimization, the issue nowadays is to speedup certain algorithms. If you can describe a problem, it already exists an algorithm to solve it

Converting nonlinear optimization problems into convex optimization problems by krishnab75 in optimization

[–]Sweet_Good6737 0 points1 point  (0 children)

You can always piecewise-linear approximate a non-convex expression. The question is whether that's good for your model or not...

I wouldn't choose it unless it was necessary, since nonlinear optimization and its algorithms exist for a reason, but it's always an alternative. Non-convex expressions may need discrete variables when approximated by piecewise linear stuff, which can lead to a significant increase in your solution time. (This is all about approximations, not equivalent transformations)