An important character in the great Hindu epic, the Mahabharata, likely had this condition. She was the great-grandmother of the Pandavas and Kauravas and her name was Satyavati. She was also known as Matsyagandhi ("fish-fragrant").
Similar to what another commenter said about time, have you tried a backtracking approach by:
(1) coloring the whole graph (let's say you end with 42 colors)
(2) start with the highest colored nodes (e.g. N=42, which exceeds your threshold of 40) and
(3) greedily remove the lowest-weight edges (or maybe, edges to other high-colored nodes) until you are either all colored with 40 colors or we reach an invalid state (ie node no longer in the graph) -- with the latter you can add another edge back and try again by removing the next-lowest edge.
That's what I'm doing now, but the results aren't great. If there's a way to estimate a lower bound on the number of edges to remove, I can figure out if the results aren't great because of the approximation, or because of the nature of the graph...
Can take as long as needed as it only needs to be colored one time. About 10,000 nodes, reasonably dense (about half the nodes will have 1,000+ edges).
I have a graph with weighted edges. I want to remove edges to make the graph colorable with N colors (e.g. N=40) such that the total weight of removed edges is minimized. If I'm able to solve this problem, that will complete a project I've been working on for years now to make a working keyboard for a person I know that has cerebral palsy.