The behavior of many physical systems, especially at low temperatures, is governed by the properties of their ground states. Usually it is not a trivial task to find the ground state configuration, especially in the case of disordered, complex systems. However, with quenched disorder this can be often done efficiently with the means of combinatorial optimization. In this thesis we study two such problems – directed polymers and the random field Ising model. Directed polymers are elastic line-like objects which provide a simple model for magnetic flux lines (vortices) in type-II superconductors. The pinning of flux lines by static disorder is crucial for sustaining the superconductivity upon the insertion of an external current. Also the topological entanglement of flux lines is believed to increase the maximal amount of the current that can be applied to the sample without losing superconductivity. We investigate the roughening of twoand three-dimensional systems of elastic lines in the presence of two types of randomness in the media: uncorrelated point-like disorder and splayed columnar defects. In addition, in three dimensions also the mutual entanglement of the lines is considered. For point disorder we find that the roughness of lines grows logarithmically with the increasing system width in two dimensions whereas in three dimensions lines exhibit random walk -like behavior. As the consequence of increasing wandering in three dimensions lines become completely entangled above the critical system height. Numerical evidence implies that this transition is in the ordinary percolation universality class. In point disorder the ground state is not separable, i.e. it can not be considered as a set of many independent lines. For splay disorder the ground state is separable leading to a random walk -like roughening in two dimensions and ballistic behavior in three dimensions. Furthermore, we find that in splay disorder lines exhibit the entanglement transition only when the original system is perturbed with point disorder. When applying combinatorial optimization for finding the ground states of physical systems one has to find a mapping from the physical problem to the corresponding combinatorial one. This means that each case has to be treated individually. During the recent years quantum annealing has gained a lot of attention as a promising candidate for a common optimization method, like simulated annealing but with a promise of a faster convergence to the optimal configuration for a given problem. The random field Ising model serves as a test problem for the quantum annealing the performance of which is analyzed numerically in one, two and three dimensions.