SCIP: Find a feasible but not optimal solution to a large LP - scip

I asked this on the soplex mailing list, but no answer yet:
http://listserv.zib.de/pipermail/soplex/2022-August/000001.html
I tried scip, and it took 30sec. Maybe because it performs pre-solve.
Is there an easy way to achieve my objective:
Specify an initial solution (something that I have, which is better than a random init), and use the solver for a limited time to find a better feasible solution
https://math.stackexchange.com/questions/4510587/find-a-feasible-but-not-optimal-solution-to-a-large-lp
Reply from the mailing list:
http://listserv.zib.de/pipermail/soplex/2022-August/000002.html

To find only a feasible solution, you can just remove the objective function. This will terminate as soon as feasibility is attained. Then, you could plug in this solution as a starting basis - I don't think this is going to help much, though.

Related

Make Optaplanner ignore redundant result

I'm having an issue where in my use case I want to just receive the best answer and return with that single best answer. I want the result as quickly as possible and want the nonimprovement timer to trigger as soon as possible.
A lot of times optaplanner will trigger a new solution is found and when reviewing the score, it is a score that was already found. Is there a way to have optaplanner not signal that it found a new solution that is better when it is the same exact score?
Apologies if this is simple to do, I'm new to optaplanner and couldn't find what I was looking for after searching around.
Could not find a way for optaplanner to not trigger when the same best score found.
EDIT:
I just remembered that because of the random seed (which we want to keep), I spawned 8 threads to solve the same problem. So each thread is individually coming up with the same best answer and notifying the main thread. So this is definitely not an optaplanner problem. Your answer just made me think of that. Thank you so much for answering in impressive timing.
The only thing I can think of is to track to see if the same results come up myself in the main application and keep a nonimprovement timer in the main application to kill the solver threads myself... I'll mark the solution as resolved since I was slow in realizing this is an issue in my application.
OptaPlanner should fire the new best solution event only if the score has improved. If you see the event firing without any scope improvements, there might be two possible explanations:
a new best solution has been produced after submitting a ProblemChange, which is expected as this new best solution reflects an external change
there is a score corruption and, as a result, the score is incorrect; try turning on the FULL_ASSERT mode to confirm that

Implementing a custom move in optaplanner

I'm using Optaplanner to make a schedule for a school. Every works good, except that it sometimes have gaps between the lessons, which I do not want. I have rules for punishing this but I think the search space is so big that it will take quite a while before it "fixes" this.
Is it possible to tell Optaplanner to try out some "selected/calculated" moves first and then continue with the moves it is supposed to do?
I'm using the time grain patterns with this.
It is possible to do, but not recommended. There is good literature on the subject here: https://www.optaplanner.org/docs/optaplanner/latest/move-and-neighborhood-selection/move-and-neighborhood-selection.html
I would start first by experimenting with configuring the generic moves that are provided out-of-the-box in optaplanner, which you can do by editing the XML file included with the distribution.
If a custom move is really what you need, you can refer to the docs above, but it is much harder to avoid bugs this way and you will want to enable full assert to double-check that score corruption is not occurring after implementation.

OptaPlanner - Create a good, initial solution by hand

Is there a way to create an initial solution for OptaPlanner by hand, in Java code?
I know that I can write the constructionHeuristic in the config XML to create a good initial solution.
But if I can write a better initial solution than OptaPlanner founds, is there a way to start the planning from my solution?
Thanks,
Vilmos
There are several ways of giving OptaPlanner a custom solution:
You can generate any Solution you like ahead of time. If the solution you give to solver.solve(solution) is already initialized at the time, you do not need to call construction heuristics at all.
If you instead wish to take an uninitialized solution and initialize it yourself in OptaPlanner, look into CustomPhaseCommand. Several OptaPlanner examples use that technique, see Machine Reassignment as an example. (However, beware that this is not a public API and we therefore do not guarantee its long-term stability.)

How can I decide when to use linear programming?

When I look at optimization problems I see a lot of options. One is linear programming. I understand in abstract terms how LP works, but I find it difficult to see whether a particular problem is suitable for LP or not. Are there any heuristics that can help guide this decision?
For example, the work described in Is there a good way to do this type of mining? took weeks before I saw how to structure the problem correctly. Is it possible to know "in advance" that problem could be solved by LP, without first seeing "how to phrase it"?
Is there a checklist I can use to decide whether a problem is suitable for LP? Is there a standard (readable) reference for this topic?
Heuristics (and/or checklists) to decide if the problem at hand is really a Linear Program.
Here's my attempt at answering, and I have also tried to outline how I'd approach this problem.
Questions that indicate that a given problem is suitable to be formulated as an LP/IP:
Are there decisions that need to be taken regularly, at different time intervals?
Are there a number of resources (workers, machines, vehicles) that need to be assigned tasks? (hours, jobs, destinations)
Is this a routing problem, where different "points" have to be visited?
Is this a location or a "layout" problem? (Whole class of Stock-cutting problems fall into this group)
Answering yes to these questions means that an LP formulation might work.
Commonly encountered LP's include: Resource allocation.: (Assignment, Transportation, Trans-shipment, knapsack) ,Portfolio Allocation, Job Scheduling, and network flow problems.
Here's a good list of LP Applications for anyone new to LPs or IPs.
That said, there are literally 1000s of different types of problems that can be formulated as LP/IP. The people I've worked with (researchers, colleagues) develop an intuition. They are good at recognizing that a problem is a certain type of an Integer Program, even if they don't remember the details, which they can then look up.
Why this question is tricky to answer:
There are many reasons why it is not always straightforward to know if an LP formulation will cut it.
There is a lot of "art" (subjectivity) in the approach to modeling/formulation.
Experience helps a lot. People get good at recognizing that this problem can be "likened" to another known formulation
Even if a problem is not a straight LP, there are many clever master-slave techniques (sub-problems), or nesting techniques that make the overall formulation work.
What looks like multiple objectives can be combined into one objective function, with an appropriate set of weights attached.
Experienced modelers employ decomposition and constraint-relaxation techniques and later compensate for it.
How to Proceed to get the basic formulation done?
The following has always steered me in the right direction. I typically start by listing the Decision Variables, Constraints, and the Objective Function. I then usually iterate among these three to make sure that everything "fits."
So, if you have a problem at hand, ask yourself:
What are the Decision Variables (DV)? I find that this is always a good place to start the process of formulation. How many types of DV's are there? (Which resource gets which task, and when should it start?)
What are the Constraints?
Some constraints are very readily visible. Others take a little bit of teasing out. The constraints have to be written in terms of your decision variables, and any constants/limits that are imposed.
What is the Objective Function?
What are the quantities that need to be maximized or minimized? Note: Sometimes, it is not clear what the objective function is. That is okay, because it could well be a constraint-satisfaction problem.
A couple of quick Sanity Checks once you think your LP formulation is done:
I always try to see if a trivial solution (all 0s or all big
numbers) is not part of the solution set. If yes, then the
formulation is most probably not correct. Some constraint is
missing.
Make sure that each and every constraint is "related"' to
the Decision Variables. (I occasionally find constraints that are
just "hanging out there." This means that a "bookkeeping constraint"
has been missed.)
In my experience, people who keep at it almost always develop the needed intuition. Hope this helps.

How do i identify improvement areas for software development in my team?

i just joined this new group and basically haven't even really done any heavy lifting development but just some basic web store migration stuff. and i've been given the challenge of coming up with improvement areas for the development process. I'm thinking of using Joel's list as the basis for determining what can be improved in my team, and besides that perhaps ask few of my seniors there who have been around for a while.
i'm not exactly sure why i was given this but i'll take it on anyway as it sounds like a good challenge. but what other tips or resources that you would advice me on how to do this properly.
P.S: i have about two weeks to do this, thus please suggest something practical and nothing to big as it's just lil ol me who has to do this within this time frame. :)
thanks
Having been in this tricky position a few times let me give you one piece of candid advice.
The person who gave you this task almost certainly has an idea in mind, and they would like you to reinforce that idea.
How you react to this is up to you and the environment in which you work.
I think you'll probably have to start by finding out where the major weaknesses are. Given your time-frame, you'll have to focus on the a few of the major issues.
Try and find out where time is being wasted. Interview your colleagues, customers, etc to try and find out where the pain is being felt. Observe the team at work and try to identify areas of inefficiency.
You'll probably find people are more receptive to your recommendations if you focus on the immediate problems, as opposed to coming at them with a range of good practices.
Once you've identified a few problem areas you'll be able to research some possible solutions in depth. Without a tighter focus, you'll be swamped by the different possibilities. And, in practice, you'll probably need to introduce new initiatives gradually anyway, which will involve you reviewing the next steps incrementally.
In order to decide what to improve you have to take into account the current status (obviously). Try to find "pain points" - the things that cause grief to the developer's while doing their job:
Do they have proper tools?
Are they fully aware of the current development goals?
Do they have an optimal development environment?
Are you using Agile/TDD/Pair programming?
I've choose the points above because they can be fixed easily in two weeks.
You've been working in this company for enough time to come up with several points of improvement, also talk to the other developers to find out what they think could improve their work.
Whatever you decide remember that your goal is to improve the development process for the dev team but also for the end customer - think on how you can provide high quality software in less time (within budget).
Since most humans come with a brain, teams usually already know what the problems are and how they can be solved. Only, there is a reason why the situation is like it is and there are forces which actively prevent change.
So just ask them what needs to be done and then find out a way how you can either do it or talk them out of it.